Scripts    Home         

How to: Oracle RMAN Script Examples with VERITAS

Oracle rman utility takes a while to figure out, set up and get a usable recovery scheme. This is a set of rman scripts tested with Veritas for point in time recovery and various backup scenarios. Tested on Oracle 8.05, Veritas is just one file manager of many. Recovery managers in Oracle seem to change every couple releases so be aware and read the manuals.

What I did in the following set of scripts is:
- create an rman catalog schema in an instance
- register the databases to be backed up,
- back up the databases
- try some restores


################################
# How to create an RMAN catalog in an instance
create user identified by password
temporary tablespace temp01 default tablespace user01 quota unlimited on user01;

grant connect to user;
ALTER USER user DEFAULT ROLE ALL;
grant create session to user;

grant recovery_catalog_owner to user;

connect user/password;
@$ORACLE_HOME/rdbms/admin/catrman.sql;

################################
####Register the database with a catalog

export ORACLE_SID=PRD805;

rman target user/password rcvcat user/[email protected] << EOF
register database;
print database;
EOF


################################

####online backup to disk with a catalog
export ORACLE_SID=PRD805

## Check the database.
#svrmgrl <> $ORACLE_HOME/rman/prd805/log_rman_to_veritas.out 2>&1

# If there is no catalog
###su oracle -c '/bin/date;setenv ORACLE_HOME /apps/oracle/product/8.0.5.a; setenv LD_LIBRARY_PATH=$ORACLE_HOME/lib:$VERITAS/lib; $ORACLE_HOME/bin/rman target \"user/[email protected]\" nocatalog cmdfile \"$ORACLE_HOME/rman/prd805/rman_to_veritas\";/bin/date' >> $ORACLE_HOME/rman/prd805/log_rman_to_veritas.out 2>&1

####################################################
# Point in time recovery

svrmgrl << EOF
    connect internal
    shutdown abort;
    startup nomount;
EOF


export NLS_LANG=american
export NLS_DATE_FORMAT='Mon DD YYYY HH24:MI:SS'

rman target user/password rcvcat user/[email protected] msglog=$ORACLE_HOME/rman/tst8/recover.log << EOF
     run {
     # recover database until specific time
     allocate channel dev1 type 'SBT_TAPE';

     set until time 'Apr 20 2003 12:15:00';
     sql "alter database mount" ;
     restore database;
     switch datafile all;
     recover database;
     sql "alter database open resetlogs";

     release channel dev1;
     }

EOF


##############################################3
# backup to tape

export ORACLE_SID=TST8

#svrmgrl <