Showing results for 
Search instead for 
Did you mean: 

remsh oracle shutdown/startup

Go to solution
Greg Butler
Occasional Advisor

remsh oracle shutdown/startup

I am trying to incorporate oracle shutdown/startup scripts into a script that syncs primary luns to business copy luns in a san environment. The bc luns reside on a management server and I use remsh to unmount the remote primary luns. I thought that this would work for oracle scripts as well but am getting errors from svrmgr (mgr-11401) when it tries to execute the scripts that work natively. I can get the scripts to run via rlogin but would like to automate it from the bc lun machine. I hesitate to cron since I then have to ensure , in the script, that clocks are in sync. Any thoughts on this would be much appreciated. TIA
Jordan Bean
Honored Contributor

Re: remsh oracle shutdown/startup

What are the errors? Perhaps the script needs to source the account's profile to set up the environment properly through remsh. This isn't likely to be a problem through rlogin.

If the script uses korn, bourne, or posix shell, then putting this at the top may help:

# no tty or profiles via remsh,
# so do it myself
if [ ! -t 0 ]
eval . ~$(id -un)/.profile
Brian Crabtree
Honored Contributor

Re: remsh oracle shutdown/startup

You will want to create a script to perform the shutdown/startup first, and then remsh that. The problem that you are having is that you cannot set the enviroment variables through the remsh.

The following would be an example.

export ORACLE_HOME=/opt/oracle/product/8.1.6

svrmgrl <> /dev/null
spool /opt/oracle/log/shutdown.log
connect internal
shutdown abort;
startup restrict;
shutdown immediate;

if [ `grep ORA- /opt/oracle/log/shutdown.log | wc -l` -ne 0 ]; then
exit 1;
exit 0;

then you can perform the following:

remsh hostA -n /opt/oracle/bin/shutdownDB
if [ $? -eq 1 ]; then
; Unlink LUN's

NOTE: We do not shutdown the database, but put the database into online backup mode (only valid for ARCHIVELOG mode). This keeps the database up during the split, but does require the logfiles to be backed up at a later time.