Oracle在线 redo log文件丢失后的恢复(2)

4、这种情况下使用隐含参数_allow_resetlogs_corruption,创建pfile,把*._allow_resetlogs_corruption=TRUE加入到pfile中。然后mount数据库,强制不完全恢复,再open resetlogs

idle>create pfile='/home/oracle/initorcl.ora' from spfile;
 
File created.
[oracle@rhel6 orcl]$ vi /home/oracle/initorcl.ora
idle>shutdown immediate;
ORA-01109: database not open
 
 
Database dismounted.
ORACLE instance shut down.
idle>startup pfile='/home/oracle/initorcl.ora' mount;
ORACLE instance started.
 
Total System Global Area 1603411968 bytes
Fixed Size        2253664 bytes
Variable Size      1476398240 bytes
Database Buffers    117440512 bytes
Redo Buffers          7319552 bytes
Database mounted.
idle>show parameter _allow_
 
NAME                    TYPE                VALUE
------------------------------------ --------------------------------- ------------------------------
_allow_resetlogs_corruption      boolean                  TRUE
idle>recover database until cancel;
ORA-00279: change 1023441 generated at 02/24/2017 23:54:54 needed for thread 1
ORA-00289: suggestion : /u02/app/oracle/product/11.2.4/db1/dbs/arch1_2_936817668.dbf
ORA-00280: change 1023441 for thread 1 is in sequence #2
 
 
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u02/app/oracle/oradata/orcl/system01.dbf'
 
 
ORA-01112: media recovery not started
 
 
idle>alter database open resetlogs;
 
Database altered.
 
idle>select open_mode from v$database;
 
OPEN_MODE
------------------------------------------------------------
READ WRITE

可以看到现在数据库已经被open了。

5、再次查看第一步中被删除的数据的表,数据仍然存在说明丢失CURRENT或ACTIVE状态的日志文件会导致数据丢失。

idle>select count(*) from zx;
 
  COUNT(*)
----------
      2858

以上是在虚拟机上做测试的恢复过程,但是对于前面说到的开发库的恢复就没有这个过程简单了。可以说是解决了一个报错又出来新的报错。

在使用_allow_resetlogs_corruption参数执行不完全恢复,open resetlogs 时,遇到了ORA-01248

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01248: file 5 was created in the future of incomplete recovery

于是先把这个文件offline drop

1 SQL> alter database datafile 5 offline drop;

再次open resetlogs时又遇到了ORA-00704和ORA-01555

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-00704: bootstrap process failure
ORA-00604: error occurred at recursive SQL level 1
ORA-01555: snapshot too old: rollback segment number 5 with name
"_SYSSMU5_4116806824$" too small
Process ID: 3396
Session ID: 573 Serial number: 51

由于现在的水平有限,在网上查资料也没有能解决这一系列的问题,最后没办法只能重建库,重新导数据了。

如果哪位遇到了类似的问题,而且解决了,也请分享一下经验。

其实上午在模拟这个问题的时候,在open resetlogs时还遇到了一个经典的报错ORA-600 [2662],这个错误可以参考

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/fe35b6c373f8ad5e7ba7e370991bae3e.html