_Oracle Scripts_ Author notes regarding the updated and missing scripts: All reported errors and omissions in the scripts have been corrected. New versions are available here on the web site. This note was last modified on 12/3/98. analyze.sql Modified to fix "Divide by zero" errors if the ANALYZEd table had no rows or no distinct keys. crbodys.sql The following bug fixes and enhancements have been made to this script: 1) The SET TRIMSPOOL command was added to remove the extra blanks in the generated output file. 2) Additional descriptive comments have been added. 3) Minor formatting errors have been fixed. 4) The "---" string was changed to "+++" (so SQL*Plus won't think that the next line is a continuation of the previous line.) 5) A "SHOW ERRORS" command has been added after every "/". 6) The DEFINE character has been disabled in the output file. 7) Automatically support either Oracle7 or Oracle8 syntax. crdb This script has had the following bug fixes and enhancements made to it: 1) Additional error debugging information was added. 2) It now automatically supports AUTOEXTEND for Oracle7/8. 3) The owner_name typo for public rollback segments was fixed. 4) Enhanced to support Oracle8 syntax. 5) Use DBA_TABLESPACES instead of SYS.TS$ for Oracle8 (since SYS.TS$ was changed in Oracle8). 6) Added SET TRIMSPOOL commands. 7) Modified to skip null OPTIMAL values. 8) Enhance the restriction comments. 9) Modified to use svrmgrl, if it exists (even if sqldba also exists). 10) Removed call to utlmontr.sql. 11) Enhanced to enable redo log threads for Parallel Server. 12) Modified to handle MAXEXTENTS UNLIMITED clause. crfuncs.sql This script has had the following bug fixes and enhancements made to it: 1) Added SET TRIMSPOOL commands. 2) Added additional comments. 3) Modified to fix minor formatting errors. 4) The "---" string was changed to "+++" (so SQL*Plus won't think that the next line is a continuation of the previous line.) 5) A "SHOW ERRORS" command has been added after every "/". 6) The DEFINE character has been disabled in the output file. 7) Modified to add SPOOL statements in the created file. 8) Automatically support either Oracle7 or Oracle8 syntax. crpacks.sql This script has had the following bug fixes and enhancements made to it: 1) Added SET TRIMSPOOL commands. 2) Modified to fix minor formatting errors. 3) The "---" string was changed to "+++" (so SQL*Plus won't think that the next line is a continuation of the previous line.) 4) A "SHOW ERRORS" command has been added after every "/". 5) The DEFINE character has been disabled in the output file. 6) Modified to add SPOOL statements in the created file. 7) Automatically support either Oracle7 or Oracle8 syntax. crprocs.sql This script has had the following bug fixes and enhancements made to it: 1) Added SET TRIMSPOOL commands. 2) Added additional comments. 3) Modified to fix minor formatting errors. 4) The "---" string was changed to "+++" (so SQL*Plus won't think that the next line is a continuation of the previous line.) 5) A "SHOW ERRORS" command has been added after every "/". 6) The DEFINE character has been disabled in the output file. 7) Modified to add SPOOL statements in the created file. 8) Automatically support either Oracle7 or Oracle8 syntax. crviews.sql We have discovered that the crviews.sql script provided with the book will not work as-is on SAP systems, and others that use column aliases. We have enhanced the script to handle column aliases. The following enhancements and bug fixed have also been made to the crviews.sql script: 1) Automatically support either Oracle7 or Oracle8 syntax. 2) Error traps have been modified. 3) Some Oracle8-specific owners are skipped. 4) Trailing linefeeds in the output text are removed. 5) The "SET TRIMSPOOL ON" and "SET RECSEP OFF" commands have been added. 6) The brkline function has been fixed to handle certain syntax. 7) The DEFINE character has been disabled in the output file. 8) Modified to add SPOOL statements in the created file. getsyi This script has been modified, by removing the extra semicolon from "esac", to fix an error when trying to run this script on SunOS operating systems. It has also been enhanced to support a different Pyramid O/S (in addition to the prior Pyramid definitions.) menu The menu script was accidently omitted from the book's CD. menu.dat The menu.dat script was accidently omitted from the book's CD. noblank The noblank script was accidently omitted from the book and the CD. This script is called by tabanali and tabanalt, in order to remove all blank lines from stdin. It writes its output to stdout. privsdc.sql The privsdc.sql script was accidently omitted from the book and the CD. This script is called by the privs.sql script, in order to print the Direct and Public Column Grants for the specified user or role. privsdt.sql The privsdt.sql script was accidently omitted from the book and the CD. This script is called by the privs.sql script, in order to print the Direct and Public Table Grants for the specified user or role. resize.sql The resize.sql script was accidently omitted from the book and the CD. This script is executed by the resize shell script. It creates a SQL script that can be used to resize a table. tblsize.sql The tblsize.sql script has had the following bug fixes and enhancements made to it: 1) The extra owner parameter was removed from the default_cursor cursor. 2) The calculations of data file sizes greater than 1gig have been fixed. 3) Table and Index sizes are limited to a minimum of 10K bytes. 4) For multiple large data files, a file size of 900meg is now used instead of 1000meg. Extent sizes are also limited to 900meg. -- crconstr.sql Bugs fixed: 1) Fix errors in length calculations. 2) Fix syntax error for disabled check constraints. 3) Fix brkline function. 4) Include Primary key constraint names. Enhancements: 1) Support Oracle8 constraint syntax. 2) Add trimspool to reduce spool file size. 3) Add tblsize_schema parameter, to support the constraint syntax required for the tblsize.sql script. 4) Reformat cursors and variables for standard template. 5) Add additional error traps. 6) Renamed temp report table. 7) Renamed variables. 8) Support freelists parameter. 9) Add "set define off" to created script. 10) Handle maxextents unlimited. 11) Add SPOOL statements in created file. 12) Include SYS%-named constraints. crtrigs.sql Bugs fixed: 1) Fix errors in length calculations. 2) Fix brkline function. 3) Use dynamic PL/SQL, since trigger bodies > 32760 chars can not be returned into a PL/SQL variable. This requires Oracle 7.2.2.3 or later, in order to support dynamic SQL. 4) Fix update bug where no trigger columns exist. 5) Add missing / to execute trigger definition. 6) Add missing ' OF ' clause before updated column name. Enhancements: 1) Omit TLOG$* triggers. 2) Add additional debugging information. 3) Add comment separator between triggers. 4) Add "show errors" after each trigger. 5) Add "exit" at end of created script. 6) Support Oracle8 trigger syntax. 7) Add trimspool to reduce spool file size. 8) Add "set define off" to created script. 9) Include trigger description. 10) Add SPOOL statements in created file. 11) Specify "create or replace" for each trigger. 12) Wrap table owner.name to new line for readability. rollback.sql Bugs fixed: 1) Fix error in rollback contention calculations for system and user undo headers and blocks. tblsizec.sql Bugs fixed: 1) Exclude LONG RAW from column_cursor. 2) Comment out calls to dbms_sql.last_error_position, since it sometimes returned an error where none existed. 3) Allow default values to contain an apostrophe. Enhancements: 1) Add restriction warning about sufficient free space in the default tablespace. 2) Add support to create snapshot data. 3) Extract database block size. 4) Add use_current_size parameter. 5) Support LONG datatype. waitstat.sql Bugs fixed: 1) Change time headings from .001 to .01 seconds.