Operating System - HP-UX
1753481 Members
4497 Online
108794 Solutions
New Discussion юеВ

remsh oracle shutdown/startup

 
SOLVED
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
2 REPLIES 2
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 ]
then
eval . ~$(id -un)/.profile
fi
Brian Crabtree
Honored Contributor
Solution

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.

shutdownDB:
-------------------
#!/bin/sh
export ORACLE_SID=ORADB
export ORACLE_HOME=/opt/oracle/product/8.1.6
export PATH=$ORACLE_HOME/bin:$PATH

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

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

then you can perform the following:

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

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.

Brian