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

Is the Oracle environment sourced?

Let's see $ORACLE_HOME, $ORACLE_SID, $PATH from the shell script.

Michael Dinh

NOTICE OF CONFIDENTIALITY - This material is intended for the use of the 
individual or entity to which it is addressed, and may contain information that 
is privileged, confidential and exempt from disclosure under applicable laws.  
BE FURTHER ADVISED THAT THIS EMAIL MAY CONTAIN PROTECTED HEALTH INFORMATION 
(PHI). BY ACCEPTING THIS MESSAGE, YOU ACKNOWLEDGE THE FOREGOING, AND AGREE AS 
FOLLOWS: YOU AGREE TO NOT DISCLOSE TO ANY THIRD PARTY ANY PHI CONTAINED HEREIN, 
EXCEPT AS EXPRESSLY PERMITTED AND ONLY TO THE EXTENT NECESSARY TO PERFORM YOUR 
OBLIGATIONS RELATING TO THE RECEIPT OF THIS MESSAGE.  If the reader of this 
email (and attachments) is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. Please notify the sender of the error and delete the 
e-mail you received. Thank you.
From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of sundar mahadevan
Sent: Monday, June 27, 2011 11:11 AM
To: Oracle-L@xxxxxxxxxxxxx
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

Other related posts: