_TAPE';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
BACKUP
$BACKUP_TYPE
SKIP INACCESSIBLE
TAG hot_db_bk_level0
FILESPERSET 5
# recommended format
FORMAT 'bk_%s_%p_%t'
DATABASE;
sql 'alter system archive log current';
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
# backup all archive logs
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
BACKUP
filesperset 20
FORMAT 'al_%s_%p_%t'
ARCHIVELOG ALL DELETE INPUT;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
#
# Note: During the process of backing up the database, RMAN also backs up the
# control file. This version of the control file does not contain the
# information about the current backup because "nocatalog" has been specified.
# To include the information about the current backup, the control file should
# be backed up as the last step of the RMAN section. This step would not be
# necessary if we were using a recovery catalog.
#
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
BACKUP
# recommended format
FORMAT 'cntrl_%s_%p_%t'
CURRENT CONTROLFILE;
RELEASE CHANNEL ch00;
}
EOF
"
echo "$CMD_STR" >> $RMAN_LOG_FILE
# Initiate the command string
if [ "$CUSER" = "root" ]
then
su - $ORACLE_USER -c "$CMD_STR" >> $RMAN_LOG_FILE
RSTAT=$
else
/usr/bin/sh -c "$CMD_STR" >> $RMAN_LOG_FILE
RSTAT=$
fi
# ---------------------------------------------------------------------------
# Log the completion of this script.
# ---------------------------------------------------------------------------
if [ "$RSTAT" = "0" ]
then
LOGMSG="ended successfully"
else
LOGMSG="ended in error"
fi
echo >> $RMAN_LOG_FILE
echo Script $0 >> $RMAN_LOG_FILE
echo ==== $LOGMSG on `date` ==== >> $RMAN_LOG_FILE
echo >> $RMAN_LOG_FILE
exit $RSTAT
oracle@sg2as059:/usr/openv/netbackup/ext/db_ext/oracle/test>
从备份脚本得知,备份的log是同目录下的,和备份脚本同名的.out文件。
因此我们可以检查一下备份的log,看看是否备份成功,以及获取其他还原时需要的信息:
oracle@sg2as059:/usr/openv/netbackup/ext/db_ext/oracle/test> cat hot_database_backup.sh.out
Script /usr/openv/netbackup/ext/db_ext/oracle/test/hot_database_backup.sh
==== started on Mon Jun 13 16:11:33 WAUST 2011 ====
RMAN: /u01/app/oracle/OraHome1/bin/rman
ORACLE_SID: test
ORACLE_USER: oracle
ORACLE_HOME: /u01/app/oracle/OraHome1
NB_ORA_FULL: 1
NB_ORA_INCR: 0
NB_ORA_CINC: 0
NB_ORA_SERV: sg2ts001
NB_ORA_POLICY: sg2as059_oracle_nbutest_backup
Full backup requested
ORACLE_HOME=/u01/app/oracle/OraHome1
export ORACLE_HOME
ORACLE_SID=test
export ORACLE_SID
/u01/app/oracle/OraHome1/bin/rman target / nocatalog msglog /usr/openv/netbackup/ext/db_ext/oracle/test/hot_database_backup.sh.out append << EOF
RUN {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
BACKUP
INCREMENTAL LEVEL=0
SKIP INACCESSIBLE
TAG hot_db_bk_level0
FILESPERSET 5
# recommended format
FORMAT 'bk_%s_%p_%t'
DATABASE;
sql 'alter system archive log current';
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
# backup all archive logs
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
BACKUP
filesperset 20
FORMAT 'al_%s_%p_%t'
ARCHIVELOG ALL DELETE INPUT;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
#
# Note: During the process of backing up the database, RMAN also backs up the
# control file. This version of the control file does not contain the
# information about the current backup because nocatalog has been specified.
# To include the information ab