用隐含参数_allow_resetlogs_corruption和重建undo tablespace 问题: 某个现场做数据库恢复的时侯有一个问题:DB恢复需要这个归档日志文件1_33160.dbf,但是在备份中没有。
SQL> recover database using backup controlfile until cancel;
ORA-00279: change 4207433305 generated at 04/23/2008 02:00:33 needed for thread 1
ORA-00289: suggestion :
/opt/oracle/db02/app/oracle/oradata/ORCL/archive/1_33160.dbf
ORA-00280: change 4207433305 for thread 1 is in sequence #33160
Specify log: {=suggested | filename | AUTO | CANCEL}
ORA-00308: cannot open archived log
'/opt/oracle/db02/app/oracle/oradata/ORCL/archive/1_33160.dbf'
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01195: online backup of file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/opt/oracle/db02/app/oracle/oradata/ORCL/system01.dbf'
解决过程:
SunOS 5.8
login: oracle
Password:
Last login: Sun May 4 10:39:57 from 172.19.136.49
Sun Microsystems Inc. SunOS 5.8 Generic Patch February 2004
$ ls
db01 db02 db03 db04 lost+found
$ sqlplus '/as sysdba'
SQL*Plus:> Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition> With the Partitioning, Oracle Label Security, OLAP and Oracle Data Mining options
SQL>> alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL>> alter database open resetlogs
*
ERROR at line 1:
ORA-01195: online backup of file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/opt/oracle/db02/app/oracle/oradata/ORCL/system01.dbf'
resetlogs的字面意思是重置重做日志。在创建控制文件的时候如果不需要在线重做日志的话可以用resetlogs选项,第二种情况是在做不完全恢复后,数据文件和重做日志的内容不同步了,这个时候打开数据库一定要用resetlogs选项。resetlogs 的时候数据库其实做了很多事,最主要的还是清空重做日志的内容,选定一个重做日志作为当前日志并将日志序列号重置为1,把resetlogs count和resetlogs scn写入控制文件、数据文件头部和重做日志的头部,当然还会做很多其它的事情。
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 826248288 bytes
Fixed>
Variable> Database Buffers 318767104 bytes
Redo Buffers 3432448 bytes
Database mounted.
尝试一下基于时间点的不完全恢复:
SQL> recover database using backup controlfile until time '2008-04-30 01:00:00';
ORA-00279: change 4207433305 generated at 04/23/2008 02:00:33 needed for thread 1
ORA-00289: suggestion :
/opt/oracle/db02/app/oracle/oradata/ORCL/archive/1_33160.dbf
ORA-00280: change 4207433305 for thread 1 is in sequence #33160
Specify log: {=suggested | filename | AUTO | CANCEL}
ORA-00308: cannot open archived log
'/opt/oracle/db02/app/oracle/oradata/ORCL/archive/1_33160.dbf'
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01195: online backup of file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/opt/oracle/db02/app/oracle/oradata/ORCL/system01.dbf'
SQL>> alter database open resetlogs
*
ERROR at line 1:
ORA-01195: online backup of file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/opt/oracle/db02/app/oracle/oradata/ORCL/system01.dbf'