RE: cannot spool the mounted standby database through cron job shell script. Any other suggestions?

From: Jorgensen, Finn <Finn.Jorgensen_at_constellation.com>
Date: Mon, 27 Jun 2011 14:30:13 -0400
Message-ID: <9CE162BC5ED2C643956B526A7EDE46FF02693F38E832_at_EXM-OMF-04.Ceg.Corp.Net>



You need to setup your environment before logging into sqlplus. Set ORAENV_ASK=NO and ORACLE_SID=dbname and then run ". oraenv" in the shell script first. Or manually set the required environment variables in the script (ORACLE_HOME, PATH etc.).

I would also recommend you give the spool command a full path so you know exactly where the spool file ends up. Use /tmp or something similar.

Thanks,
Finn

From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of sundar mahadevan Sent: Monday, June 27, 2011 2:11 PM
To: Oracle-L_at_freelists.org
Subject: cannot spool the mounted standby database through cron job shell script. Any other suggestions?

Hi All,
Greetings. I have a standby in mount state. I would like to query the latest archive log applied on standby (in mount state) to apply the archive logs from primary with a cron job shell script. When i query "select max(sequence#) from v\$log_history;" from a shell script it works. But if i set it up as cron job as below, it does not work. I cannot assign the output to a shell variable since the database is not open and it would crap out. Any other suggestions? And the reason for this behaviour? Thanks a lot in advance.

test.sh
#!/bin/bash
sqlplus -s /nolog << EOF
set head off
connect / as sysdba
spool last_applied_on_standby.log
select max(sequence#) from v\$log_history; spool off
quit
EOF
>>> This e-mail and any attachments are confidential, may contain legal, professional or other privileged information, and are intended solely for the addressee. If you are not the intended recipient, do not use the information in this e-mail in any way, delete this e-mail and notify the sender. CEG-IP1

--
http://www.freelists.org/webpage/oracle-l
Received on Mon Jun 27 2011 - 13:30:13 CDT

Original text of this message