Commit 84870f16 authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading

9781565920484

0 → 120000
+1 −0
Changes for 9781565920484: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
9781565920484
 No newline at end of file

README

0 → 100755
+30 −0
Changes for README: 30 added lines, 0 removed lines.
Original line number Diff line number Diff line
The following files are extracted from ORACLE Performance Tuning
chapters and appendices:
 examples.c5
 examples.c7
 examples.c8
 examples.c9
 examples.c10
 examples.c11
 examples.c12
 examples.c13
 examples.c14
 examples.c15
 examples.c16
 examples.c17
 examples.c18
 examples.apa
 examples.apc

These files are additional SQL code by Mark Gurry, made available for
your use:
 chain.sql   (Version 6 Oracle) This script is used to detect chaining
             within an Oracle table.
 extents.sql These scripts must be run by a DBA. They: 
             1) Report on all segments having more than 3 extents
                that may be candidates for re-building. 
             2) show the total Free Space for each Tablespace 
             3  Provide the largest extent pieces > 250000 bytes in
                each tablespace. 

 

README.md

0 → 100644
+15 −0
Changes for README.md: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
## Example files for the title:  
	  
# ORACLE Performance Tuning, by Peter Corrigan
	  
[![ORACLE Performance Tuning, by Peter Corrigan](http://akamaicovers.oreilly.com/images/9781565920484/cat.gif)](https://www.safaribooksonline.com/)
	  
The following applies to example files from material published by O’Reilly Media, Inc. Content from other publishers may include different rules of usage. Please refer to any additional usage rights explained in the actual example files or refer to the publisher’s website.
	  
O'Reilly books are here to help you get your job done. In general, you may use the code in O'Reilly books in your programs and documentation. You do not need to contact us for permission unless you're reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from our books does not require permission. Answering a question by citing our books and quoting example code does not require permission. On the other hand, selling or distributing a CD-ROM of examples from O'Reilly books does require permission. Incorporating a significant amount of example code from our books into your product's documentation does require permission.
	  
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN.
	  
If you think your use of code examples falls outside fair use or the permission given here, feel free to contact us at <permissions@oreilly.com>.
	  
Please note that the examples are not production code and have not been carefully testing. They are provided "as-is" and come with no warranty of any kind.

chain.sql

0 → 100755
+62 −0
Changes for chain.sql: 62 added lines, 0 removed lines.
Original line number Diff line number Diff line
# 
# Program:   chain.sql   (Version 6 Oracle)
# 
# Author:    Mark Gurry
# 
# Purpose:   This script is used to detect chaining within an Oracle
# 	   table. To run the script
# 
# 	   sqlplus un/pw @chain
# 
#            The script will then prompt you for a Table Name.
# 
# 	   A Temporary Dynamic SQL Script ch.sql is created
#            for the selectd table. This script will then list
#            all rows that are chaining. If you want to find 
#            which actual rows are chained, you can list them with
# 
#            select * from table where substr(rowid,1,8) = '$$$$$$$$'
#            n.b.  $$$$$$$$ is the rowid shown for the chained block.
# 
#
set heading off
set verify off
set feedback off
set echo off
set embedded on
set pagesize 9999
break on blk;
set recsep off
set linesize 150;
column blk format a60;
column rest format a80 ;
spool ch.sql
select 'ttitle '''Chaining Summary for Table '||&&Enter_Table||''''
from dual 
/
select 'select substr(rowid,1,8)||substr(rowid,15,4) blk, sum (' blk,
       decode(column_id,1,'','+')||
             'nvl(vsize('||column_name||'),0)+1 ' rest 
>From user_tab_columns
where table_name=upper('&&Enter_Table')
order by column_id
/
select '+5)+100 summary  from '||upper('&&Enter_Table')||' group by substr(rowid,1,8)||substr(rowid,15,4)'
from dual
/
select 'having   sum (' blk,
       decode(column_id,1,'','+')||
             'nvl(vsize('||column_name||'),0)+1' rest 
from user_tab_columns
where table_name=upper('&&Enter_Table')
order by column_id
/
select '+5) +100   > 4096; ' from dual
/
spool off
Set feedback on  
@ch.sql
exit


examples.apa

0 → 100755
+90 −0
Changes for examples.apa: 90 added lines, 0 removed lines.
Original line number Diff line number Diff line
#
# ORACLE Performance Tuning Appendix A p. 455
# Multiplexed Redo Logs
    CREATE DATABASE  . . .
        LOGFILE GROUP 1 ( 'DISK:A\ORA1.LOG',
                          'DISK:B\ORA1.LOG', 
                          'DISK:C\ORA1.LOG') SIZE 100K,
        LOGFILE GROUP 2 ( 'DISK:A\ORA2.LOG', 
                          'DISK:B\ORA2.LOG',
                          'DISK:C\ORA2.LOG') SIZE 100K,
        LOGFILE GROUP 3 ( 'DISK:A\ORA3.LOG',
                          'DISK:B\ORA3.LOG',
                          'DISK:C\ORA3.LOG') SIZE 100K
#
# ORACLE Performance Tuning Appendix A p. 456
# Setting an Optimal Size for a Rollback Segment
     CREATE PUBLIC ROLLBACK SEGMENT RB1 
                TABLESPACE  RB_TS
                STORAGE (OPTIMAL 50K . . .);
#
# ORACLE Performance Tuning Appendix A p. 460
# Declarative Data Integrity Constraints
    CREATE TABLE EMP   (EMP_NO      NUMBER (6,0)     UNIQUE NOT NULL,
                        EMP_NAME    VARCHAR2 (30)    NOT NULL,
                        SEX         VARCHAR2  (1),
                        HIRE_DATE   DATE             DEFAULT  SYSDATE)
                        CHECK (SEX IN ('M', 'F'))
                        CONSTRAINT  EMP_PK  PRIMARY KEY ( EMP_NO )
#
    CREATE TABLE EMP  (EMP_NO       NUMBER (6,0)
                      .
                      .
                      .
                      MGR_EMP       NUMBER (6,0)    CONSTRAINT EMP_MGR
                                                    REFERENCES EMP,
                      . . . )
                     CONSTRAINT  EMP_PK  
                                 PRIMARY KEY  ( EMP_NO )
                     CONSTRAINT  EMP_SALARY_TYPE
                                 FOREIGN KEY ( DEPT, GRP )
                                 REFERENCES  SALARY_GROUPS
#
    CREATE  TABLE  EMP ( . . . )
                        CHECK     (COLUMN3, COLUMN4 IS UNIQUE)
                        CHECK     (COLUMN3  >=  '01-JUL-93' )
                        CHECK     (COLUMN6 IN ('A', 'C', 'X'))
#
# ORACLE Performance Tuning Appendix A p. 464
# Foreign Key Constraints
    CREATE TABLE. . .
        ( column1 . . . CONSTRAINT TAB_FK REFERENCES TAB,
          column2  . . .,
          column3  . . .) ;
    CREATE TABLE . . .
        ( column1  . . .,
          column2  . . .,
          column3  . . . )
    CONSTRAINT TAB_FK
              FOREIGN KEY ( column1, column2 ) REFERENCES TAB;
#
# ORACLE Performance Tuning Appendix A p. 464
# Integrity Constraint Warnings
    ALTER TABLE tab     DISABLE PRIMARY KEY;
    ALTER TABLE tab     DISABLE CONSTRAINT Tab_FK;

    PERFORM DATA TAKEUP  .....

    ALTER TABLE tab     ENABLE PRIMARY Key;
    ALTER TABLE tab     ENABLE CONSTRAINT Tab_FK
                        EXCEPTIONS INTO excep_tab;
#
# ORACLE Performance Tuning Appendix A p. 465
# Integrity Constraint Warnings
    TABLE EXCEP_TAB (ROW_ID       ROWID,
                     CONSTRAINTS  VARCHAR2 (30),
                     OWNER        VARCHAR2 (30),
                     TABLE_OWNER  VARCHAR2 (30) );
#
    TABLE EMPLOYEE_MASTER.
        EMP_NUM         PRIMARY KEY      INDEXED
        COMPANY_CODE    FOREIGN KEY      INDEXED
        REPORT_GRP      FOREIGN KEY 
        DEPT_CODE       FOREIGN KEY      INDEXED
                 
        CREDIT_RATING   FOREIGN KEY
        SALARY_GRADE    FOREIGN KEY
        ADDRESS_LINE1
        ADDRESS_LINE2
        ADDRESS_LINE3
        POST_CODE       FOREIGN KEY
Loading