frum
1
Hi all,
I'm writing a script to stop & start oracle:
su - oracle -c "sqlplus / as sysdba" -c "shutdown immediate">> ${log} 2>&1
The {log} refers to the log file. The part in bold gives error:
/usr/sbin/shutdown: Only root can run /usr/sbin/shutdown
Pls suggest how to correct this.
regards.
You are running the shutdown in shell context i.e. trying to shutdown the system!
Try to nest two types of quotes
su - oracle -c "sqlplus / as sysdba -c 'shutdown immediate' " >> ${log} 2>&1
frum
3
Hi,
I tried your suggestion but still doesn't work.
regards
According to the article this should work
su - oracle -c "echo 'shutdown immediate' | sqlplus '/ as sysdba' " >> ${log} 2>&1
If sqlplus takes -c instead of stdin, this should work, too
su - oracle -c "sqlplus '/ as sysdba' -c 'shutdown immediate' " >> ${log} 2>&1
frum
6
Hi all,
Thanks for your help.
Below has worked for me:
su - oracle -c "echo 'shutdown immediate' | sqlplus '/ as sysdba' " >> ${log} 2>&1
The 2nd one didn't work but ok 1st one has worked.
Thanks & regards.