由于服务器异常短电,导致LGWR写联机日志文件时失败,下次重新启动数据库时,需要做实例级恢复,而又无法从联机日志文件里获取到这些redo信息,因为上次断电时,写日志失败了。
--查看当前日志文件情况,从以下查询结果可以看到当前日志组为 159,117
--恢复数据库,指定redo0.log日志。首先按照它指示的进行恢复,发现/arch/中并不存在117的归档。(之前我已经将其放到了操作节点的/arch中。)
试着恢复:
oracle@testdb1[testdb1]/arch$sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Sun May 16 09:33:10 2021 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options 尝试进行打开一次 SQL> alter database open resetlogs; alter database open resetlogs * ERROR at line 1: ORA-01139: RESETLOGS option only valid after an incomplete database recovery --尝试recover后,打开数据库,仍然报相同错误 SQL> recover database; Media recovery complete. --尝试再次打开 SQL> alter database open; alter database open * ERROR at line 1: ORA-00600: internal error code, arguments: [kcrfr_read_5], [159], [26797], [], [], [], [], [], [], [], [], [] --查看redo log实际情况,可以看到 group 159,117 是当前的归档 SQL> select group#,sequence#,status,first_time,next_change# from v$log; GROUP# SEQUENCE# STATUS FIRST_TIME NEXT_CHANGE# ---------- ---------- ---------------- ------------ ------------ 1 159 CURRENT 15-MAY-21 2.8147E+14 2 158 INACTIVE 15-MAY-21 3062533 3 117 CURRENT 15-MAY-21 2.8147E+14 4 116 INACTIVE 15-MAY-21 3062527 SQL> col member for a30 SQL> / GROUP# STATUS TYPE MEMBER IS_ ---------- ------- ------- ------------------------------ --- 1 ONLINE +DGSYS/testdb/redo01.log NO 2 ONLINE +DGSYS/testdb/redo02.log NO 3 ONLINE +DGSYS/testdb/redo03.log NO 4 ONLINE +DGSYS/testdb/redo04.log NO
恢复:
SQL> select group#,sequence#,status,first_time,next_change# from v$log; GROUP# SEQUENCE# STATUS FIRST_TIME NEXT_CHANGE# ---------- ---------- ---------------- ------------ ------------ 1 159 CURRENT 15-MAY-21 2.8147E+14 2 158 INACTIVE 15-MAY-21 3062533 3 117 CURRENT 15-MAY-21 2.8147E+14 4 116 INACTIVE 15-MAY-21 3062527 SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options oracle@testdb1[testdb1]/arch$sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Sun May 16 09:44:50 2021 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> recover database until cancel using backup controlfile; ORA-00279: change 3104281 generated at 05/15/2021 19:00:50 needed for thread 2 ORA-00289: suggestion : /arch/2_117_971729936.dbf ORA-00280: change 3104281 for thread 2 is in sequence #117 Specify log: {<RET>=suggested | filename | AUTO | CANCEL} +DGSYS/testdb/redo03.log ORA-00279: change 3104281 generated at 05/15/2021 15:13:38 needed for thread 1 ORA-00289: suggestion : /arch/1_159_971729936.dbf ORA-00280: change 3104281 for thread 1 is in sequence #159 Specify log: {<RET>=suggested | filename | AUTO | CANCEL} +DGSYS/testdb/redo01.log Log applied. Media recovery complete. SQL> alter database open; alter database open * ERROR at line 1: ORA-01589: must use RESETLOGS or NORESETLOGS option for database open SQL> alter database open resetlogs; Database altered. SQL> exit
然后重启下
srvctl stop database -d testdb srvctl start database -d testdb