#!/bin/bash
exportORACLE_SID=PROD4
exportORACLE_BASE=/u01/app/oracle
exportORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
exportPATH=$ORACLE_HOME/bin:$PATH
exportNLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
echo'----------------------------------------'>>/tmp/rman_PROD4_full.log
echo 'Start FULLBackup at '`date +%Y-%m-%d:%H:%M:%S` >>/tmp/rman_PROD4_full.log
echo'----------------------------------------'>>/tmp/rman_PROD4_full.log
rman target /nocatalog log /tmp/rman_PROD4_full.log append<<EOF
run{
allocate channel c1type disk;
allocate channel c2type disk;
allocate channel c3type disk;
backup database format'/home/oracle/bak/full_%d_%T_%s_%p';
SQL 'alter systemarchive log current';
SQL 'alter systemarchive log current';
backuparchivelog all delete input format '/home/oracle/bak/arch_%d_%t_%s_%p';
backup currentcontrolfile format '/home/oracle/bak/ctl_%d_%T_%s_%p';
backup spfile format'/home/oracle/bak/%d_%U.spfile';
}
EOF
备份后出现 错误
[oracle@rac1 ~]$tail -f /tmp/rman_racdb1_full.log
piecehandle=/home/oracle/bak/full_RACDB_20170610_4_1 tag=TAG20170610T163908comment=NONE
channel c1: backupset complete, elapsed time: 00:00:02
including currentSPFILE in backupset
channel c2: startingpiece 1 at 2017-06-10 16:39:18
channel c2: finishedpiece 1 at 2017-06-10 16:39:19
piecehandle=/home/oracle/bak/full_RACDB_20170610_5_1 tag=TAG20170610T163908comment=NONE
channel c2: backupset complete, elapsed time: 00:00:02
Finished backup at2017-06-10 16:39:19
sql statement: altersystem archive log current
sql statement: altersystem archive log current
Starting backup at2017-06-10 16:39:29
current log archived
released channel: c1
released channel: c2
released channel: c3
RMAN-00571:===========================================================
RMAN-00569:=============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571:===========================================================
RMAN-03002: failureof backup command at 06/10/2017 16:39:32
RMAN-06059: expectedarchived log not found, lost of archived log compromises recoverability
ORA-19625: erroridentifying file /home/oracle/arch2_12_945787105.dbf
ORA-27037: unable toobtain file status
Linux-x86_64 Error:2: No such file or directory
alter.log
ORA-00312: onlinelog 1 thread 1: '+DATA/racdb/onlinelog/group_1.257.945787109'
Fri Jun 09 22:53:24CST 2017
Errors in file/oracle/app/oracle/admin/racdb/bdump/racdb1_arc0_19492.trc:
ORA-16014: log 1sequence# 38 not archived, no available destinations
ORA-00312: onlinelog 1 thread 1: '+DATA/racdb/onlinelog/group_1.257.945787109'
Fri Jun 09 22:58:24CST 2017
/oracle/app/oracle/admin/racdb/bdump/racdb1_arc0_19492.trc:
crrfail: dest:1err:19504 force:0 blast:1
*** 2017-06-1001:30:26.621 22384 kcrr.c
ORA-16038: log 1sequence# 38 cannot be archived
ORA-19504: failed tocreate file ""
ORA-00312: onlinelog 1 thread 1: '+DATA/racdb/onlinelog/group_1.257.945787109'
*** 2017-06-1001:36:26.700
Failed to createfile '/arch/1_38_945787105.dbf' (file not accessible?)
*** 2017-06-1001:36:26.701 64896 kcrr.c
ARC0: Error 19504Creating archive log file to '/arch/1_38_945787105.dbf'
*** 2017-06-1001:36:26.701 63005 kcrr.c
kcrrfail: dest:1err:19504 force:0 blast:1
*** 2017-06-1001:36:26.709 22384 kcrr.c
ORA-16038: log 1sequence# 38 cannot be archived
ORA-19504: failed tocreate file ""
解决方法:
1: RMAN> crosscheck archivelog all; --检查控制文件和实际物理文件的差别。如果一些归档日志已经删除或丢失,那么设置它们为expired
2: RMAN> delete expired archivelog all;--同步控制文件的信息和实际物理文件的信息(it will delete expired archivelog andupdates your controlfile)
手工删除归档日志或移动了归档日志也会出现这个错误,需要手工执行crosscheck过程后,RMAN备份才能正常进行。