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