昨天去某客户部署rman备份,在跑shell脚本的时候,提示找不到归档日志,因为客户那里之前只对数据库做expdp逻辑导出备份,并且每
-rw-r----- 1 oracle oinstall 606k sep 24 12:00 ora10g-4175411955_20140924_859118422_297.arc
-rw-r----- 1 oracle oinstall 166m sep 24 12:02 ora10g-4175411955_20140924_859118425_298.db
-rw-r----- 1 oracle oinstall 610k sep 24 12:02 ora10g-4175411955_20140924_859118562_299.arc
-rw-r----- 1 oracle oinstall 7.3m sep 24 12:02 ora10g-c-4175411955-20140924-01.ctl
可以看到,,备份全部完成了,共生成了2个归档日志备份集(arc),1个数据库备份集(db)以及控制文件备份集(ctl),这里有个细节要注意,由于我在脚本中写入了%s参数,从上面生成备份集生成的时间以及顺序可以发现rman备份这样一个顺序:
1. 对现有可以备份的数据库归档日志文件做一个备份
2. 对数据库进行备份
3. 切换一下日志,对完成全库备份后的归档日志再做一个备份(即使你没有通过rman> sql alter system archive log current;来手动切)
4. 对控制文件备份(包括spfile,生成在同一个备份集)
我们可以看一下详细的日志输出,来对这个顺序有更深刻的了解:
starting backup at 24-914
current log archived
using channel ora_disk_1
channel ora_disk_1: starting compressed archive log backupset
channel ora_disk_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=11 recid=216 stamp=859118422
channel ora_disk_1: starting piece 1 at 24-914
channel ora_disk_1: finished piece 1 at 24-914
channel ora_disk_1: backup set complete, elapsed time: 00:00:03
finished backup at 24-914
starting backup at 24-914
using channel ora_disk_1
channel ora_disk_1: starting compressed full datafile backupset
channel ora_disk_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/u01/app/oracle/oradata/ora10g/system01.dbf
input datafile fno=00003 name=/u01/app/oracle/oradata/ora10g/sysaux01.dbf
input datafile fno=00002 name=/u01/app/oracle/oradata/ora10g/undotbs01.dbf
input datafile fno=00005 name=/u01/app/oracle/oradata/ora10g/example01.dbf
input datafile fno=00006 name=/u01/app/oracle/oradata/ora10g/zlm01.dbf
input datafile fno=00004 name=/u01/app/oracle/oradata/ora10g/users01.dbf
channel ora_disk_1: starting piece 1 at 24-914
channel ora_disk_1: finished piece 1 at 24-914
channel ora_disk_1: backup set complete, elapsed time: 00:02:16
finished backup at 24-914
starting backup at 24-914
current log archived
using channel ora_disk_1
channel ora_disk_1: starting compressed archive log backupset
channel ora_disk_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=12 recid=217 stamp=859118561
channel ora_disk_1: starting piece 1 at 24-914
channel ora_disk_1: finished piece 1 at 24-914
channel ora_disk_1: backup set complete, elapsed time: 00:00:02
finished backup at 24-914
starting control file and spfile autobackup at 24-914
finished control file and spfile autobackup at 24-914