PL/SQL General PL/SQL Scripts
DBA Scripts General DBA Scripts
Object Management Object Management Scripts
Space Management Space Management Scripts
SQL Tuning SQL Performance Tuning Scripts
DB Security Security Auditing Scripts
DB Tuning Database Performance Tuning Scripts
Backup and Recovery Backup and Recovery Scripts
OS/390 (MVS) JCL OS/390 (MVS) JCL Scripts
Add scripts Add your own scripts
Other Sites Other sites with script collections
General PL/SQL: Scripts Update/ delete from a huge table with intermittent commits Select records from a cursor into PL/SQL table Pass result sets (REF CURSOR) between procedures and functions Count the number of rows for ALL tables in current schema Hex to decimal, and decimal to hex conversion functions Print the ASCII table Fetch LOB column values piece-wise from PL/SQL Fetch LONG column values piece-wise from PL/SQL Random number/ string generator package Demonstrate writing to a file using the UTL_FILE package Map an external file to a database view Demonstrate Java stored procedures FTP Client (GET and PUT files from PL/SQL) Send e-mail messages from PL/SQL Send e-mail messages from PL/SQL with MIME attachments Access Internet Web pages from PL/SQL Track DLL changes (create, drop, alter) within a schema General DBA Scripts Show database uptime in days and hours Create database user like an exiting user (with exact privs) Switch from one database user to another without password (su.sql) Dynamically ZIP large process trace files Tabular display of redo-log archiving history (logs/hour) List control file structures with usage limits Log all database errors to a table Demonstrate database triggers Limit resources using the Database Resource Manager Log Miner - extract undo statements from log files Database cursor usage (open_cursors parameter) Object Management Scripts List foreign keys to and from a given table Script to identify everything to do with a table (Includes Triggers and Constraints) Compile invalid database objects in a schema Compile all invalid database objects Compare indexes on two databases and list the differences Re-create all non-system indexes Re-build all non-system indexes on-line Copy table from one database to another Drop a column from a table Reconstruct DDL for tables Reconstruct DDL for indexes Reconstruct DDL for snapshot logs Reconstruct DDL for triggers Space Management Scripts Show used/free space per tablespace Show used/free space per segment type Save summary of database space history over time List segments that can not extend (tablespace full) List objects in the SYSTEM tablespace that doesn't belong to SYS or SYSTEM Oracle segment sizing recommendations Show database growth in Meg per month for the last year List segments with more than 200 Meg of free DB Blocks List tables with high water mark not equal to used blocks Check index fragmentation status for a schema SQL Performance Tuning Scripts Explain SQL execution plan List analyzed tables with not-analyzed indexes List all indexes for a given table Analyze all table and index partitions individually Database Security and Security Auditing Scripts List database auditing information Try to connect to well known database users Database users with deadly system privileges assigned to them Database users with deadly roles assigned to them Security related database initialization parameters and password file users List security related profile information List Unix OS users that can startup, shutdown and admin Databases Database Performance Tuning Scripts Measure the Buffer Cache Hit Ratio Display Database SGA Statistics Reports free memory available in the SGA List available INIT.ORA parms List unsupported INIT.ORA parms List active database transactions Rollback segment statistics Display database sessions using rollback segments Lookup database details for a given Unix process id Display database locks and latches (with tables names, etc) Another lock monitor script Display and release DBMS_LOCK locks Backup and Recovery Scripts Simple on-line backup script (put tablespaces in backup mode and copy out) Check for tablespaces in backup mode and take them out of backup mode Take database data files out of backup mode List RMAN Backups registered in RMAN catalog database List completed RMAN Backups (data from control file) Monitor running RMAN Backups Demonstrate Oracle 8i transportable tablespaces Unix Shell Scripts Create a DB creation scripts from an running instance Perform on-line database backup Export database directly to tape with label Copy tables in parallel between databases (intelligent scheduler) Delete RMAN backupsets older than a specified number of days Recatalog deleted archived log files with RMAN Manage Oracle trace files (delete old/ send mail for new) Maintain a daily cycle of Oracle alert log, trace and SQL*Net files List Installed Oracle Products An interactive ORAENV script SQL*Plus replacement shell: Scroll through command history!!! (ZIP file) Check if a set of databases is running Wait until a database is available Monitor if an Oracle OID (LDAP) Server is functioning Monitor if an Oracle Names Server is functioning Swap (roll) and initialise the listener's .log files Check if all entries in the TNSNAMES.ORA file is valid Monitor if a Web Server is running or not Download a file from a Web server (eg. latest TNSNAMES.ORA) Parameter driven script to rebuild indexes intelligently Send E-mail from Unix with some file attachments (using mailx) Send E-mail from Unix with some file attachments (using sendmail) Unix sed script to search and replace a string in all files in a directory List free space for disk groups (Veritas Volume Manager) Create new volume for database (Veritas Volume Manager) Delete a volume (Veritas Volume Manager) Rename a volume (Veritas Volume Manager) Other sites with script collections SQL for DBAs The OracleResourceStop Script Archive Mark Lang's Script collection OraMag's Code Depot Material Dreams' DBA Scripts Steve Rea's Oracle Tips, Tricks, and Scripts Back to Oracle FAQ Index
General DBA Scripts Show database uptime in days and hours Create database user like an exiting user (with exact privs) Switch from one database user to another without password (su.sql) Dynamically ZIP large process trace files Tabular display of redo-log archiving history (logs/hour) List control file structures with usage limits Log all database errors to a table Demonstrate database triggers Limit resources using the Database Resource Manager Log Miner - extract undo statements from log files Database cursor usage (open_cursors parameter) Object Management Scripts List foreign keys to and from a given table Script to identify everything to do with a table (Includes Triggers and Constraints) Compile invalid database objects in a schema Compile all invalid database objects Compare indexes on two databases and list the differences Re-create all non-system indexes Re-build all non-system indexes on-line Copy table from one database to another Drop a column from a table Reconstruct DDL for tables Reconstruct DDL for indexes Reconstruct DDL for snapshot logs Reconstruct DDL for triggers Space Management Scripts Show used/free space per tablespace Show used/free space per segment type Save summary of database space history over time List segments that can not extend (tablespace full) List objects in the SYSTEM tablespace that doesn't belong to SYS or SYSTEM Oracle segment sizing recommendations Show database growth in Meg per month for the last year List segments with more than 200 Meg of free DB Blocks List tables with high water mark not equal to used blocks Check index fragmentation status for a schema SQL Performance Tuning Scripts Explain SQL execution plan List analyzed tables with not-analyzed indexes List all indexes for a given table Analyze all table and index partitions individually Database Security and Security Auditing Scripts List database auditing information Try to connect to well known database users Database users with deadly system privileges assigned to them Database users with deadly roles assigned to them Security related database initialization parameters and password file users List security related profile information List Unix OS users that can startup, shutdown and admin Databases Database Performance Tuning Scripts Measure the Buffer Cache Hit Ratio Display Database SGA Statistics Reports free memory available in the SGA List available INIT.ORA parms List unsupported INIT.ORA parms List active database transactions Rollback segment statistics Display database sessions using rollback segments Lookup database details for a given Unix process id Display database locks and latches (with tables names, etc) Another lock monitor script Display and release DBMS_LOCK locks Backup and Recovery Scripts Simple on-line backup script (put tablespaces in backup mode and copy out) Check for tablespaces in backup mode and take them out of backup mode Take database data files out of backup mode List RMAN Backups registered in RMAN catalog database List completed RMAN Backups (data from control file) Monitor running RMAN Backups Demonstrate Oracle 8i transportable tablespaces Unix Shell Scripts Create a DB creation scripts from an running instance Perform on-line database backup Export database directly to tape with label Copy tables in parallel between databases (intelligent scheduler) Delete RMAN backupsets older than a specified number of days Recatalog deleted archived log files with RMAN Manage Oracle trace files (delete old/ send mail for new) Maintain a daily cycle of Oracle alert log, trace and SQL*Net files List Installed Oracle Products An interactive ORAENV script SQL*Plus replacement shell: Scroll through command history!!! (ZIP file) Check if a set of databases is running Wait until a database is available Monitor if an Oracle OID (LDAP) Server is functioning Monitor if an Oracle Names Server is functioning Swap (roll) and initialise the listener's .log files Check if all entries in the TNSNAMES.ORA file is valid Monitor if a Web Server is running or not Download a file from a Web server (eg. latest TNSNAMES.ORA) Parameter driven script to rebuild indexes intelligently Send E-mail from Unix with some file attachments (using mailx) Send E-mail from Unix with some file attachments (using sendmail) Unix sed script to search and replace a string in all files in a directory List free space for disk groups (Veritas Volume Manager) Create new volume for database (Veritas Volume Manager) Delete a volume (Veritas Volume Manager) Rename a volume (Veritas Volume Manager) Other sites with script collections SQL for DBAs The OracleResourceStop Script Archive Mark Lang's Script collection OraMag's Code Depot Material Dreams' DBA Scripts Steve Rea's Oracle Tips, Tricks, and Scripts Back to Oracle FAQ Index
Object Management Scripts List foreign keys to and from a given table Script to identify everything to do with a table (Includes Triggers and Constraints) Compile invalid database objects in a schema Compile all invalid database objects Compare indexes on two databases and list the differences Re-create all non-system indexes Re-build all non-system indexes on-line Copy table from one database to another Drop a column from a table Reconstruct DDL for tables Reconstruct DDL for indexes Reconstruct DDL for snapshot logs Reconstruct DDL for triggers Space Management Scripts Show used/free space per tablespace Show used/free space per segment type Save summary of database space history over time List segments that can not extend (tablespace full) List objects in the SYSTEM tablespace that doesn't belong to SYS or SYSTEM Oracle segment sizing recommendations Show database growth in Meg per month for the last year List segments with more than 200 Meg of free DB Blocks List tables with high water mark not equal to used blocks Check index fragmentation status for a schema SQL Performance Tuning Scripts Explain SQL execution plan List analyzed tables with not-analyzed indexes List all indexes for a given table Analyze all table and index partitions individually Database Security and Security Auditing Scripts List database auditing information Try to connect to well known database users Database users with deadly system privileges assigned to them Database users with deadly roles assigned to them Security related database initialization parameters and password file users List security related profile information List Unix OS users that can startup, shutdown and admin Databases Database Performance Tuning Scripts Measure the Buffer Cache Hit Ratio Display Database SGA Statistics Reports free memory available in the SGA List available INIT.ORA parms List unsupported INIT.ORA parms List active database transactions Rollback segment statistics Display database sessions using rollback segments Lookup database details for a given Unix process id Display database locks and latches (with tables names, etc) Another lock monitor script Display and release DBMS_LOCK locks Backup and Recovery Scripts Simple on-line backup script (put tablespaces in backup mode and copy out) Check for tablespaces in backup mode and take them out of backup mode Take database data files out of backup mode List RMAN Backups registered in RMAN catalog database List completed RMAN Backups (data from control file) Monitor running RMAN Backups Demonstrate Oracle 8i transportable tablespaces Unix Shell Scripts Create a DB creation scripts from an running instance Perform on-line database backup Export database directly to tape with label Copy tables in parallel between databases (intelligent scheduler) Delete RMAN backupsets older than a specified number of days Recatalog deleted archived log files with RMAN Manage Oracle trace files (delete old/ send mail for new) Maintain a daily cycle of Oracle alert log, trace and SQL*Net files List Installed Oracle Products An interactive ORAENV script SQL*Plus replacement shell: Scroll through command history!!! (ZIP file) Check if a set of databases is running Wait until a database is available Monitor if an Oracle OID (LDAP) Server is functioning Monitor if an Oracle Names Server is functioning Swap (roll) and initialise the listener's .log files Check if all entries in the TNSNAMES.ORA file is valid Monitor if a Web Server is running or not Download a file from a Web server (eg. latest TNSNAMES.ORA) Parameter driven script to rebuild indexes intelligently Send E-mail from Unix with some file attachments (using mailx) Send E-mail from Unix with some file attachments (using sendmail) Unix sed script to search and replace a string in all files in a directory List free space for disk groups (Veritas Volume Manager) Create new volume for database (Veritas Volume Manager) Delete a volume (Veritas Volume Manager) Rename a volume (Veritas Volume Manager) Other sites with script collections SQL for DBAs The OracleResourceStop Script Archive Mark Lang's Script collection OraMag's Code Depot Material Dreams' DBA Scripts Steve Rea's Oracle Tips, Tricks, and Scripts Back to Oracle FAQ Index
Space Management Scripts Show used/free space per tablespace Show used/free space per segment type Save summary of database space history over time List segments that can not extend (tablespace full) List objects in the SYSTEM tablespace that doesn't belong to SYS or SYSTEM Oracle segment sizing recommendations Show database growth in Meg per month for the last year List segments with more than 200 Meg of free DB Blocks List tables with high water mark not equal to used blocks Check index fragmentation status for a schema SQL Performance Tuning Scripts Explain SQL execution plan List analyzed tables with not-analyzed indexes List all indexes for a given table Analyze all table and index partitions individually Database Security and Security Auditing Scripts List database auditing information Try to connect to well known database users Database users with deadly system privileges assigned to them Database users with deadly roles assigned to them Security related database initialization parameters and password file users List security related profile information List Unix OS users that can startup, shutdown and admin Databases Database Performance Tuning Scripts Measure the Buffer Cache Hit Ratio Display Database SGA Statistics Reports free memory available in the SGA List available INIT.ORA parms List unsupported INIT.ORA parms List active database transactions Rollback segment statistics Display database sessions using rollback segments Lookup database details for a given Unix process id Display database locks and latches (with tables names, etc) Another lock monitor script Display and release DBMS_LOCK locks Backup and Recovery Scripts Simple on-line backup script (put tablespaces in backup mode and copy out) Check for tablespaces in backup mode and take them out of backup mode Take database data files out of backup mode List RMAN Backups registered in RMAN catalog database List completed RMAN Backups (data from control file) Monitor running RMAN Backups Demonstrate Oracle 8i transportable tablespaces Unix Shell Scripts Create a DB creation scripts from an running instance Perform on-line database backup Export database directly to tape with label Copy tables in parallel between databases (intelligent scheduler) Delete RMAN backupsets older than a specified number of days Recatalog deleted archived log files with RMAN Manage Oracle trace files (delete old/ send mail for new) Maintain a daily cycle of Oracle alert log, trace and SQL*Net files List Installed Oracle Products An interactive ORAENV script SQL*Plus replacement shell: Scroll through command history!!! (ZIP file) Check if a set of databases is running Wait until a database is available Monitor if an Oracle OID (LDAP) Server is functioning Monitor if an Oracle Names Server is functioning Swap (roll) and initialise the listener's .log files Check if all entries in the TNSNAMES.ORA file is valid Monitor if a Web Server is running or not Download a file from a Web server (eg. latest TNSNAMES.ORA) Parameter driven script to rebuild indexes intelligently Send E-mail from Unix with some file attachments (using mailx) Send E-mail from Unix with some file attachments (using sendmail) Unix sed script to search and replace a string in all files in a directory List free space for disk groups (Veritas Volume Manager) Create new volume for database (Veritas Volume Manager) Delete a volume (Veritas Volume Manager) Rename a volume (Veritas Volume Manager) Other sites with script collections SQL for DBAs The OracleResourceStop Script Archive Mark Lang's Script collection OraMag's Code Depot Material Dreams' DBA Scripts Steve Rea's Oracle Tips, Tricks, and Scripts Back to Oracle FAQ Index
SQL Performance Tuning Scripts Explain SQL execution plan List analyzed tables with not-analyzed indexes List all indexes for a given table Analyze all table and index partitions individually Database Security and Security Auditing Scripts List database auditing information Try to connect to well known database users Database users with deadly system privileges assigned to them Database users with deadly roles assigned to them Security related database initialization parameters and password file users List security related profile information List Unix OS users that can startup, shutdown and admin Databases Database Performance Tuning Scripts Measure the Buffer Cache Hit Ratio Display Database SGA Statistics Reports free memory available in the SGA List available INIT.ORA parms List unsupported INIT.ORA parms List active database transactions Rollback segment statistics Display database sessions using rollback segments Lookup database details for a given Unix process id Display database locks and latches (with tables names, etc) Another lock monitor script Display and release DBMS_LOCK locks Backup and Recovery Scripts Simple on-line backup script (put tablespaces in backup mode and copy out) Check for tablespaces in backup mode and take them out of backup mode Take database data files out of backup mode List RMAN Backups registered in RMAN catalog database List completed RMAN Backups (data from control file) Monitor running RMAN Backups Demonstrate Oracle 8i transportable tablespaces Unix Shell Scripts Create a DB creation scripts from an running instance Perform on-line database backup Export database directly to tape with label Copy tables in parallel between databases (intelligent scheduler) Delete RMAN backupsets older than a specified number of days Recatalog deleted archived log files with RMAN Manage Oracle trace files (delete old/ send mail for new) Maintain a daily cycle of Oracle alert log, trace and SQL*Net files List Installed Oracle Products An interactive ORAENV script SQL*Plus replacement shell: Scroll through command history!!! (ZIP file) Check if a set of databases is running Wait until a database is available Monitor if an Oracle OID (LDAP) Server is functioning Monitor if an Oracle Names Server is functioning Swap (roll) and initialise the listener's .log files Check if all entries in the TNSNAMES.ORA file is valid Monitor if a Web Server is running or not Download a file from a Web server (eg. latest TNSNAMES.ORA) Parameter driven script to rebuild indexes intelligently Send E-mail from Unix with some file attachments (using mailx) Send E-mail from Unix with some file attachments (using sendmail) Unix sed script to search and replace a string in all files in a directory List free space for disk groups (Veritas Volume Manager) Create new volume for database (Veritas Volume Manager) Delete a volume (Veritas Volume Manager) Rename a volume (Veritas Volume Manager) Other sites with script collections SQL for DBAs The OracleResourceStop Script Archive Mark Lang's Script collection OraMag's Code Depot Material Dreams' DBA Scripts Steve Rea's Oracle Tips, Tricks, and Scripts Back to Oracle FAQ Index
Database Security and Security Auditing Scripts List database auditing information Try to connect to well known database users Database users with deadly system privileges assigned to them Database users with deadly roles assigned to them Security related database initialization parameters and password file users List security related profile information List Unix OS users that can startup, shutdown and admin Databases Database Performance Tuning Scripts Measure the Buffer Cache Hit Ratio Display Database SGA Statistics Reports free memory available in the SGA List available INIT.ORA parms List unsupported INIT.ORA parms List active database transactions Rollback segment statistics Display database sessions using rollback segments Lookup database details for a given Unix process id Display database locks and latches (with tables names, etc) Another lock monitor script Display and release DBMS_LOCK locks Backup and Recovery Scripts Simple on-line backup script (put tablespaces in backup mode and copy out) Check for tablespaces in backup mode and take them out of backup mode Take database data files out of backup mode List RMAN Backups registered in RMAN catalog database List completed RMAN Backups (data from control file) Monitor running RMAN Backups Demonstrate Oracle 8i transportable tablespaces Unix Shell Scripts Create a DB creation scripts from an running instance Perform on-line database backup Export database directly to tape with label Copy tables in parallel between databases (intelligent scheduler) Delete RMAN backupsets older than a specified number of days Recatalog deleted archived log files with RMAN Manage Oracle trace files (delete old/ send mail for new) Maintain a daily cycle of Oracle alert log, trace and SQL*Net files List Installed Oracle Products An interactive ORAENV script SQL*Plus replacement shell: Scroll through command history!!! (ZIP file) Check if a set of databases is running Wait until a database is available Monitor if an Oracle OID (LDAP) Server is functioning Monitor if an Oracle Names Server is functioning Swap (roll) and initialise the listener's .log files Check if all entries in the TNSNAMES.ORA file is valid Monitor if a Web Server is running or not Download a file from a Web server (eg. latest TNSNAMES.ORA) Parameter driven script to rebuild indexes intelligently Send E-mail from Unix with some file attachments (using mailx) Send E-mail from Unix with some file attachments (using sendmail) Unix sed script to search and replace a string in all files in a directory List free space for disk groups (Veritas Volume Manager) Create new volume for database (Veritas Volume Manager) Delete a volume (Veritas Volume Manager) Rename a volume (Veritas Volume Manager) Other sites with script collections SQL for DBAs The OracleResourceStop Script Archive Mark Lang's Script collection OraMag's Code Depot Material Dreams' DBA Scripts Steve Rea's Oracle Tips, Tricks, and Scripts Back to Oracle FAQ Index
Database Performance Tuning Scripts Measure the Buffer Cache Hit Ratio Display Database SGA Statistics Reports free memory available in the SGA List available INIT.ORA parms List unsupported INIT.ORA parms List active database transactions Rollback segment statistics Display database sessions using rollback segments Lookup database details for a given Unix process id Display database locks and latches (with tables names, etc) Another lock monitor script Display and release DBMS_LOCK locks Backup and Recovery Scripts Simple on-line backup script (put tablespaces in backup mode and copy out) Check for tablespaces in backup mode and take them out of backup mode Take database data files out of backup mode List RMAN Backups registered in RMAN catalog database List completed RMAN Backups (data from control file) Monitor running RMAN Backups Demonstrate Oracle 8i transportable tablespaces Unix Shell Scripts Create a DB creation scripts from an running instance Perform on-line database backup Export database directly to tape with label Copy tables in parallel between databases (intelligent scheduler) Delete RMAN backupsets older than a specified number of days Recatalog deleted archived log files with RMAN Manage Oracle trace files (delete old/ send mail for new) Maintain a daily cycle of Oracle alert log, trace and SQL*Net files List Installed Oracle Products An interactive ORAENV script SQL*Plus replacement shell: Scroll through command history!!! (ZIP file) Check if a set of databases is running Wait until a database is available Monitor if an Oracle OID (LDAP) Server is functioning Monitor if an Oracle Names Server is functioning Swap (roll) and initialise the listener's .log files Check if all entries in the TNSNAMES.ORA file is valid Monitor if a Web Server is running or not Download a file from a Web server (eg. latest TNSNAMES.ORA) Parameter driven script to rebuild indexes intelligently Send E-mail from Unix with some file attachments (using mailx) Send E-mail from Unix with some file attachments (using sendmail) Unix sed script to search and replace a string in all files in a directory List free space for disk groups (Veritas Volume Manager) Create new volume for database (Veritas Volume Manager) Delete a volume (Veritas Volume Manager) Rename a volume (Veritas Volume Manager) Other sites with script collections SQL for DBAs The OracleResourceStop Script Archive Mark Lang's Script collection OraMag's Code Depot Material Dreams' DBA Scripts Steve Rea's Oracle Tips, Tricks, and Scripts Back to Oracle FAQ Index
Backup and Recovery Scripts Simple on-line backup script (put tablespaces in backup mode and copy out)
Unix Shell Scripts Create a DB creation scripts from an running instance Perform on-line database backup Export database directly to tape with label Copy tables in parallel between databases (intelligent scheduler) Delete RMAN backupsets older than a specified number of days Recatalog deleted archived log files with RMAN Manage Oracle trace files (delete old/ send mail for new) Maintain a daily cycle of Oracle alert log, trace and SQL*Net files List Installed Oracle Products An interactive ORAENV script SQL*Plus replacement shell: Scroll through command history!!! (ZIP file) Check if a set of databases is running Wait until a database is available Monitor if an Oracle OID (LDAP) Server is functioning Monitor if an Oracle Names Server is functioning Swap (roll) and initialise the listener's .log files Check if all entries in the TNSNAMES.ORA file is valid Monitor if a Web Server is running or not Download a file from a Web server (eg. latest TNSNAMES.ORA) Parameter driven script to rebuild indexes intelligently Send E-mail from Unix with some file attachments (using mailx) Send E-mail from Unix with some file attachments (using sendmail) Unix sed script to search and replace a string in all files in a directory List free space for disk groups (Veritas Volume Manager) Create new volume for database (Veritas Volume Manager) Delete a volume (Veritas Volume Manager) Rename a volume (Veritas Volume Manager) Other sites with script collections SQL for DBAs The OracleResourceStop Script Archive Mark Lang's Script collection OraMag's Code Depot Material Dreams' DBA Scripts Steve Rea's Oracle Tips, Tricks, and Scripts Back to Oracle FAQ Index
Other sites with script collections SQL for DBAs The OracleResourceStop Script Archive Mark Lang's Script collection OraMag's Code Depot Material Dreams' DBA Scripts Steve Rea's Oracle Tips, Tricks, and Scripts Back to Oracle FAQ Index
Back to Oracle FAQ Index