时间:2021-07-01 10:21:17 帮助过:25人阅读
昨天去某客户部署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