Examples of pre-exec and post-exec scripts on unix – HP A.06.11 User Manual
Page 69

Specify a command or RMAN script that will be started by
ob2rman.pl
on the Oracle Server system before the backup
(pre-exec) or after it (post-exec). RMAN scripts must
have the .rman extension. Do not use double quotes.
For example, you can provide scripts to shut down and start
an Oracle instance. For examples of shut-downing and
starting an Oracle instance on UNIX, see “
pre-exec and post-exec scripts on UNIX
Provide the pathname of the command or RMAN script.
HP OpenVMS
: Provide the pathname of the command
(OMNI$ROOT:[BIN]).
Pre-exec, Post-exec
Examples of pre-exec and post-exec scripts on UNIX
Pre-exec example
The following is an example of a script that shuts down an Oracle instance:
#!/bin/sh
export ORACLE_HOME=$2
export ORACLE_SQLNET_NAME=$1
if [ -f $ORACLE_HOME/bin/sqlplus ]; then
$ORACLE_HOME/bin/sqlplus << EOF
connect sys/manager@$ORACLE_SQLNET_NAME as sysdba
shutdown
EOF
echo "Oracle database \"$DB_NAME\" shut down."
exit 0
else
echo "Cannot find Oracle SQLPLUS ($ORACLE_HOME/bin/sqlplus)."
exit 1
fi
Post-exec example
The following is an example of a script that starts an Oracle instance:
#!/bin/sh
export ORACLE_HOME=$2
export ORACLE_SQLNET_NAME=$1
if [ -f $ORACLE_HOME/bin/sqlplus ]; then
$ORACLE_HOME/bin/sqlplus << EOF
connect sys/manager@$ORACLE_SQLNET_NAME as sysdba
startup
Integration guide for Oracle and SAP
69