备份脚本:
RMAN> run {
allocate channel c1 device type disk format '$BACKUP_HOME/level0/level0_%d_%s_%p_%T.bkp' connect sys/oracle@app1;
3> allocate channel c2 device type disk format '$BACKUP_HOME/level0/level0_%d_%s_%p_%T.bkp' connect sys/oracle@app2;
4> change archivelog all crosscheck;
5> backup archivelog all;
6> }
执行结果:
input archive log thread=1 sequence=8325 recid=47541 stamp=854902271
input archive log thread=1 sequence=8326 recid=47547 stamp=854904675
channel c1: starting piece 1 at 06-8月 -14
RMAN-03009: failure of backup command on c1 channel at 08/06/2014 17:31:26
ORA-07217: sltln: environment variable cannot be evaluated.
continuing other job steps, job failed will not be re-run
channel c2: starting archive log backupset
channel c2: specifying archive log(s) in backup set
input archive log thread=1 sequence=8307 recid=47473 stamp=854896289
input archive log thread=2 sequence=9017 recid=46693 stamp=854186419
……
input archive log thread=2 sequence=9242 recid=47521 stamp=854900192
input archive log thread=2 sequence=9243 recid=47527 stamp=854900224
input archive log thread=2 sequence=9244 recid=47529 stamp=854901200
input archive log thread=2 sequence=9245 recid=47534 stamp=854901211
input archive log thread=2 sequence=9246 recid=47537 stamp=854902260
input archive log thread=2 sequence=9247 recid=47543 stamp=854902277
input archive log thread=2 sequence=9248 recid=47545 stamp=854904673
channel c2: starting piece 1 at 06-8月 -14
released channel: c1
released channel: c2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on c2 channel at 08/06/2014 17:31:33
ORA-07217: sltln: environment variable cannot be evaluated.
出错原因:没有定义变量$BACKUP_HOME。
解决办法:将$BACKUP_HOME改成具体的值即可。
示例:
RMAN> run {
allocate channel c1 device type disk format '/home/oracle/rmanbk/level0/level0_%d_%s_%p_%T.bkp' connect sys/oracle@app1;
allocate channel c2 device type disk format '/home/oracle/rmanbk/level0/level0_%d_%s_%p_%T.bkp' connect sys/oracle@app2;
change archivelog all crosscheck;
backup archivelog all;
}
--这是在两个节点的rac环境下执行的。
--一定记得要分配通道,且有必要的话,前面加上命令:change archivelog all crosscheck;
否则,可能备份失败,报如下错误:
RMAN> backup archivelog log all;
RMAN> backup archivelog all;
Starting backup at 06-8月 -14
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=235 instance=orcl1 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 08/06/2014 18:27:38
RMAN-06059: expected archived log not found, lost of archived log compromises recoverability
ORA-19625: error identifying file /u01/app/oracle/archlog/1_8307_821907262.log
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3