Showing posts with label Shell Script. Show all posts
Showing posts with label Shell Script. Show all posts

Thursday, November 01, 2012

Purging Oracle ADR (Automatic Diagnostic Repository) logs

 

When ADR logs become unexpectedly large, or too many (as in too many databases for one host), then manual purging is necessary. Following Scripts will be of handy during this time.


#!/bin/ksh
# Purge ADR logs
# Call oraenv first (or at least set $ORACLE_HOME)

# -- Customize the following variables
D1=1440    # to purge older than one day
D5=7200    # to purge older than five days
D7=10080   # to purge older than seven days
DD=        # set to your ADR_BASE (Ex. /app/oracle)
HP=        # set to your ADR_HOME (Ex. diag/rdbms/<dbname>/<instname>)

$ORACLE_HOME/bin/adrci <<_EOF
set base $DD
set homepath $HP
show homes
purge -age $D7 -type alert
purge -age $D7 -type incident
purge -age $D7 -type trace
purge -age $D7 -type cdump
quit
_EOF

Friday, August 26, 2011

ksh: =: is not an identifier

 

Error:  ksh: =: is not an identifier
-------------------------------------------------------------------------------------------
Cause:  Space between VariableName, = and Value

Resolution: Remove the space betwen Variablename, = and Value

Example

oracle@myDBSrvr1: export ORACLE_HOME = /app/oracle/product/11g/db_1
ksh: =: is not an identifier
oracle@myDBSrvr1: export ORACLE_HOME=/app/oracle/product/11g/db_1

Tuesday, May 10, 2011

Are Oracle instances down on the host?


This script would be of useful as a Pre-Check for Patching and Linking

#!/bin/sh
cat <<eof
Check if Oracle Down?
Pre-Check for Patching and Linking
Remember to also stop all cron and scheduled jobs
eof
ps -ef|egrep -i "oracle| sqlplus| rman| sqlldr| imp| exp| impdp| expdp| dgmgrl|tnslsnr|fastreader"