Re: Return Code from SQLDBA Session?

From: David Scott <dscott_at_is.net>
Date: 1995/12/06
Message-ID: <dscott-0612952308460001_at_dscott.is.net>#1/1


In article <4a1e8n$1gs_001_at_go-rlr.oedison.com>, rhodesr_at_watt.oedison.com (Richard L. Rhodes) wrote:

> I'm writing a script that needs to run a SQLDBA session and I want the
> script to check whether the SQLDBA session worked. The one example
> below is straight from the admin book - backing up the control file.
>
> Example:
>
> echo "\n==> Control File Backup - Begin"
> $ORACLE_HOME/bin/sqldba lmode=y <<eof
> connect system/manager
> alter database backup controlfile to
> '$root/control.file.backup' reuse;
> exit
> eof
>
> if [[ <check for some type of return code> ]]; then
> send error
> exit
> fi
>
> Is there a way in the script to check whether the alter command
> worked? I went through DBA Handbook and Oracle Reference and didn't
> find anything obvious.
>
> If there is is a way to do this, will it work for a SQLPLUS session
> also?
>
You might want to alter your script to spool the output to a file and then grep out the ORA errors; pipe this through a word count (wc) to see if there is more than 0 lines; if so, then do your paging. I do this with a runsql shell that I created for sqlplus and a runloader shell for sqlldr; they work great.

Let me know if you would like more information on this; I have copies of the scripts I can share if you are interested.

Good luck...



David Scott
...how can I keep from singing?
email: dscott_at_is.net
Received on Wed Dec 06 1995 - 00:00:00 CET

Original text of this message