RMAN hot level 0 backup script

posted Sep 17, 2010, 8:08 AM by Sachchida Ojha   [ updated Sep 17, 2010, 8:15 AM ]
# $Header: hot_database_backup_level0.rcv
#  Backs up the whole database.  This backup is part of the incremental
#  strategy (this means it can have incremental backups of levels > 0
#  applied to it).
#
#  We do not need to explicitly request the control file to be included
#  in this backup, as it is automatically included each time file 1 of
#  the system tablespace is backed up (the inference: as it is a whole
#  database backup, file 1 of the system tablespace will be backed up,
#  hence the controlfile will also be included automatically).
#
#  Typically, a level 0 backup would be done at least once a week.
#
#  The scenario assumes:
#     o you want to perform a level 0 backup
#     o you are backing your database up to two tape drives
#     o you want each backup set to include a maximum of 5 files
#     o you wish to include offline datafiles, and read-only tablespaces,
#       in the backup
#     o you want the backup to continue if any files are inaccessible.
#     o you are not using a Recovery Catalog
#     o you want to archive the current log and then back up all the
#       archive logs, putting a maximum of 20 logs in a backup set and
#       deleting them once the backup is complete.
#     o you are using a TNS alias name for the target database
#
#  Note that the format string is constructed to guarantee uniqueness and
#  to enhance NetBackup for Oracle backup and restore performance.
#
#  The connect statements could be part of the rman command line in the
#  Oracle script file that calls this script. They were put here so that
#  the passwords could be protected by setting file permissions to only
#  allow the Oracle dba access.
#
#  Add the following connect statement if using a Recovery Catalog.
#      connect rcvcat '<user>/<passwd>@<TNS alias>'
#
#  Modify the target connect statement according to the following syntax:
#      connect target '<user>/<passwd>@<TNS alias>'
#
#  Script run by:
#      rman nocatalog cmdfile hot_database_backup_level0.rcv
#
# ---------------------------------------------------------------------------

connect target /
connect catalog rman/rman@RMANDB

run {
# Hot database level 0 whole backup

allocate channel t1 type 'SBT_TAPE';
allocate channel t2 type 'SBT_TAPE';
#allocate channel t3 type 'SBT_TAPE';
#allocate channel t4 type 'SBT_TAPE';

backup
  incremental level 0
  tag hot_db_bk_level0
  filesperset 5
  # recommended format
  format 'bk_%s_%p_%t'
    (database);
  sql 'alter system archive log current';
  # backup all archive logs
  backup
   filesperset 20
   format 'al_%s_%p_%t'
   (archivelog all
    delete input);
}


Comments