Posts by Doyensys

Script to get explain plan for the baselines created with SQL_ID

Please run the below query and get the explain plan for which baselines created for an SQL ID. col sql_text for a60 wrap set verify off set pagesize 999 set…

Read More

Script to copy table from one database to another database

-- STEPS: -- -- Disable constraints -- Disable triggers -- Copy -- Enable constraints -- Enable triggers SET SERVEROUTPUT ON PROMPT Enter the table's name you want to copy DEFINE…

Read More

Script to get the details of Index fragmentation of a schema

prompt -- Drop and create temporary table to hold stats... drop table my_index_stats / create table my_index_stats ( index_name varchar2(30), height number(8), del_lf_rows number(8), distinct_keys number(8), rows_per_key number(10,2), blks_gets_per_access number(10,2)…

Read More

Script to determine the high water mark of tables

set verify off column owner format a10 column alcblks heading 'Allocated|Blocks' just c column usdblks heading 'Used|Blocks' just c column hgwtr heading 'High|Water' just c break on owner skip page…

Read More

Script to analyze all table and index partitions individually

set feed off echo off head off trimspool on line 500 spool /tmp/analyze$$.sql select 'ANALYZE TABLE '||table_owner||'.'||table_name||' partition ('|| partition_name||') estimate statistics;' from sys.dba_tab_partitions / select 'ANALYZE INDEX '||index_owner||'.'||index_name||' partition…

Read More

Script to know the audit information

conn / as sysdba tti "Auditing Initialisation Parameters:" select name || '=' || value PARAMETER from sys.v_$parameter where name like '%audit%' / tti "Statement Audits Enabled on this Database" column…

Read More

Script to delete RMAN backupsets older than a specified number of days

DAYSTOKEEP=60 # -- Do not change anything below this line --------------------------- CMDFILE=/tmp/rmanpurge$$.rcv LOGFILE=/tmp/rmanprige$$.log if [ ! -x $ORACLE_HOME/bin/rman ]; then echo "ERROR: RMAN not found or ORACLE_HOME not set." exit…

Read More

Script to list all Installed Oracle Products

PAGER=more if [ ! -d "${ORACLE_HOME}" ]; then print "ERROR: Oracle home not set." exit -1 fi print "Oracle Installed Products for ORACLE_HOME ${ORACLE_HOME}:" if [ -f "${ORACLE_HOME}/orainst/inspdver" ]; then…

Read More

DBALAM

# ###################################################################################################################################################### # Database Server Monitoring Script [dbalarm]. VER=”[6.3]” SCRIPT_NAME=”dbalarm${VER}” # Features: # Report ERRORS in DB, ASM Instance, GRID INFRASTRUCTURE, GOLDENGATE and LISTENERS ALERTLOG plus dmesg DEVICE DRIVER OS…

Read More

start and stop tracing script

# ################################################# # Script to Enable tracing for an Oracle Session. # #   #     # # # ################################################# # ########### # Description: # ########### echo echo “==================================================” echo “This…

Read More