一:版本信息
操作系统版本 AIX 6109
数据库版本 11.2.0.3(PSU5)
二:错误描述
同事在做数据库恢复演练的时候recover database时报如下错误:
SQL> recover database; ORA-00283: recovery session canceled due to errors ORA-01610: recovery using the BACKUP CONTROLFILE option must be done##他跟我咨询的时候,我首先想到的就是他恢复出来的控制文件肯定是比恢复出来的数据文件旧,于是我就查了一下他们的scn
1.System Checkpoint SCN
SQL> set line 200 pages 2000; SQL> col checkpoint_change# format 999,999,999,999; SQL> select checkpoint_change# from v$database; CHECKPOINT_CHANGE# ------------------ 241,086,682,2172.Datafile Checkpoint SCN
SQL> select name,checkpoint_change# from v$datafile; NAME CHECKPOINT_CHANGE# -------------------------------------------------- ------------------ /data01/egcmcdb/datafile/system.dbf 241,086,682,217 /data01/egcmcdb/datafile/sysaux.dbf 241,086,682,217 /data01/egcmcdb/datafile/undotbs1.dbf 241,086,682,217 /data01/egcmcdb/datafile/users.dbf 241,086,682,217 /data01/egcmcdb/datafile/tbs_channel01.dbf 241,086,682,217 /data01/egcmcdb/datafile/tbs_channel02.dbf 241,086,682,217 /data01/egcmcdb/datafile/tbs_channel03.dbf 241,086,682,217 /data01/egcmcdb/datafile/tbs_channel_bak01.dbf 241,086,682,217 /data01/egcmcdb/datafile/tbs_channel_bak02.dbf 241,086,682,217 /data01/egcmcdb/datafile/undotbs02.dbf 241,086,682,217 /data01/egcmcdb/datafile/uk01.dbf 241,086,682,217 /data01/egcmcdb/datafile/uk02.dbf 241,086,682,2173.Start SCN号
SQL> select name,checkpoint_change# from v$datafile_header; NAME CHECKPOINT_CHANGE# -------------------------------------------------- ------------------ /data01/egcmcdb/datafile/system.dbf 241,086,340,779 /data01/egcmcdb/datafile/sysaux.dbf 241,086,340,779 /data01/egcmcdb/datafile/undotbs1.dbf 241,086,340,779 /data01/egcmcdb/datafile/users.dbf 241,086,340,820 /data01/egcmcdb/datafile/tbs_channel01.dbf 241,086,340,820 /data01/egcmcdb/datafile/tbs_channel02.dbf 241,086,340,820 /data01/egcmcdb/datafile/tbs_channel03.dbf 241,086,340,779 /data01/egcmcdb/datafile/tbs_channel_bak01.dbf 241,086,340,820 /data01/egcmcdb/datafile/tbs_channel_bak02.dbf 241,086,340,779 /data01/egcmcdb/datafile/undotbs02.dbf 241,086,340,779 /data01/egcmcdb/datafile/uk01.dbf 241,086,340,820 /data01/egcmcdb/datafile/uk02.dbf 241,086,340,8204.End SCN (Stop SCN)号
SQL> select name,last_change# from v$datafile; NAME LAST_CHANGE# -------------------------------------------------- ------------ /data01/egcmcdb/datafile/system.dbf /data01/egcmcdb/datafile/sysaux.dbf /data01/egcmcdb/datafile/undotbs1.dbf /data01/egcmcdb/datafile/users.dbf /data01/egcmcdb/datafile/tbs_channel01.dbf /data01/egcmcdb/datafile/tbs_channel02.dbf /data01/egcmcdb/datafile/tbs_channel03.dbf /data01/egcmcdb/datafile/tbs_channel_bak01.dbf /data01/egcmcdb/datafile/tbs_channel_bak02.dbf /data01/egcmcdb/datafile/undotbs02.dbf /data01/egcmcdb/datafile/uk01.dbf /data01/egcmcdb/datafile/uk02.dbf
##从上面可以看到他恢复出来的控制文件的scn是大于各个数据文件的scn号的,那么为什么会报这个错,一时真没想起来
三.问题原因
问题原因可以参考OERR: ORA 1610 recovery using the BACKUP CONTROLFILE option must be done (Doc ID 19007.1)
Cause: Either an earlier database recovery session specified BACKUP
CONTROLFILE or the control file was recreated with the RESETLOGS
option.
Only BACKUP CONTROLFILE recovery is allowed, and it must be followed
by resetting the online redo log files when the database is next
opened.
Action: Perform recovery using the BACKUP CONTROLFILE option.
##有两个原因会导致恢复的时候出现该错误,第一个是你的恢复出来的控制文件比恢复出来的数据文件旧,第二个是你的控制文件使用resetlogs选项重建过。(问了一下这个库是从其他的地方迁过来的,做过resetlogs,所以问题原因清楚了)
四.解决方案
解决方法就是 recovery using the BACKUP CONTROLFILE option.