Backing Up Control Files
A nice feature of Oracle9i is its ability to configure the control file to be backed up automatically whenever you issue a backup or copy command. You can do this by using the configure command as follows:
RMAN> configure controlfile autobackup on;
Or, if you want to manually back up an Oracle9i control file:
RMAN> backup current controlfile;
Here’s an example that backs up the control file via a shell script that works both for Oracle9i and Oracle8i:
#!/bin/ksh # File: backup_ctrl.ksh #---------------------------------------------- export ORACLE_HOME=/d00/app/oracle/product/9.0.0 export ORACLE_SID=brdstn export PATH=/usr/sbin:/usr/bin:$ORACLE_HOME/bin export MAILX="/usr/ucb/Mail" export MAIL_LIST="chaya@garam.com" #---------------------------------------------- BOX=`uname -a | awk '{print$2}'` #---------------------------------------------- date #---------------------------------------------- rman nocatalog log=rman_control.log <<EOF connect target / run { allocate channel d1 type disk; setlimit channel d1 kbytes 1900000; backup format '/d99/rmanback/brdstn/rman_cntl_%d_%t_%U.bct' (current controlfile); release channel d1; } EOF # if [ $? -ne 0 ]; then $MAILX -s "RMAN problem with $ORACLE_SID on $BOX" \ $MAIL_LIST <<EOF Check control file RMAN backups... EOF # else print "RMAN controlfile backup ran okay..." fi #---------------------------------------------- date #----------------------------------------------
Get Oracle RMAN Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.