Welcome to the Linux Foundation Forum!

oratab file

Options
bdby
bdby Posts: 2
edited June 2014 in Getting Started with Linux

Hi,

I could use some assistance. I am new at this and have been requested to find out

the last time someone accessed the oracle database from the SYS.AUD$ table.

I have 5 servers with each oratab listing hundreds of databases. There in lies

my problem. To go through each one manually would take weeks.

What I am trying to do is run a script that will read the oratab file and isolate the name of the oracle_sid which I have accomplished. Some of those sids are obsolete so I need to account for that. Right now I am just trying to capture the ORA-01078 error and if I do to continue looping to the next ora_sid

Here is my work:

partial list:

snslcsunu03{oranet}-bash> cat /var/opt/oracle/oratab | cut -d':' -f1,3 | sed s/#//g | grep : | cut -d':' -f1

lsnr <<<=== bad name for a sid but it is a real one.<br />
ora10205

ora10205b

ora11203

musidt

musiot

cli112_64

cli112_32

dev101

============================== script

#!/usr/bin/bash

## PLEASE NOTE THE LOOPING ON THIS WORKS PROPERLY.

exec 1> /home/oracle/bash/outfile #records output to file. Later to be searched.

cat /var/opt/oracle/oratab | cut -d':' -f1,3 | sed s/#//g | grep : | cut -d':' f1>list #this strips the sid from the oratab

LIMIT=5 #this counter limits the number of interations through the list. It will be removed later.

a=0

for i in `cat list`; do

a=$(($a+1))

if [[ "$a" -eq 5 [[; then

break

fi

ORACLE_SID="$i"

if [ "$?" -eq 0 ] ; then #if a sid is returned zero means success and to continue processing.

export ORACLE_SID

sqlplus / as sysdba @startup.sql >outfile #grep the outfile for the ora error below.

fi

if [ -e `grep "ORA-01078" outfile` ] #if this is found in the list there is no spfile available

then

"exit" #<<<==== IT SEEMS TO HANG HERE. I NEED TO CONTINUE LOOPING<br />
/

continue #loop to the next oratab

fi

done

==========

output

ORA-01078 failure in processing system parametersThanks for your help in advance.

Any suggestions or help would be appreciated.

thanks,

bdby

Categories

Upcoming Training