Oracle script: Log gathering via adcri

In the implementation of a new system wide monitoring tool, it became apparent the tool was not flexible enough to find the alert log and listener log files in non-default locations.  Below are examples of the shell and perl script used in place for monitoring and gathering ad hoc.  They will probably be most useful in quickly gathering log data to upload to Oracle support without running a full RDA script.  Before implementing confirm your $ORACLE_HOMEs are all registered in adcri and visible.  Just invoke adcri and at the prompt enter ‘show homes’ without the quotes.


The shell script portion, self explanatory:


export ORACLE_HOME=`grep “^$ORACLE_SID” /etc/oratab | cut -f2 -d”:”`

adrci <<EOF > /dev/null
spool adrciout.$$
show homes

./ adrciout.$$

rm adrciout.$$


In the same working directory, create this perl script as


while (<>) {

if ((m/client/) || (m/ADR Home/))

else {
($v1,$v2,$v3,$thing) =split “/”,$_;

if (m/listener/) {
print “Diag log is at $ENV{ORACLE_BASE}/$_/trace/$thing.log\n”;
else {
print “Diag log is at $ENV{ORACLE_BASE}/$_/trace/alert_$thing.log\n”;