oracle 数据库打开报如下错误解决发方案
SQL> alter database open 2 ; alter database open * ERROR at line 1: ORA-01589: must use RESETLOGS or NORESETLOGS option for database open SQL> alter database open resetlogs; alter database open resetlogs * ERROR at line 1: ORA-01194: file 1 needs more recovery to be consistent ORA-01110: data file 1: '/oradata/crmdb/system01.dbf'
1、应该是日志问题,尝试一下命令
recover database using backup controlfile until cancel;
提示:
SQL> recover database until cancel; ORA-00279: change 983510157 generated at 10/30/2019 19:58:11 needed for thread 1 ORA-00289: suggestion : /oracle/fast_recovery_area/CRMDB/archivelog/2019_10_31/o1_mf_1_11767_%u_.arc ORA-00280: change 983510157 for thread 1 is in sequence #11767
注意 : change 983510157 和 sequence #11767
2、通过下面的语句查询要使用的redo日志的 change 和 sequence 确保后上面提示的一致
select v1.group#, member, sequence#, first_change# from v$log v1, v$logfile v2 where v1.group# = v2.group#;
执行结果如下
SQL> select v1.group#, member, sequence#, first_change# 2 from v$log v1, v$logfile v2 3 where v1.group# = v2.group#; GROUP# ---------- MEMBER -------------------------------------------------------------------------------- SEQUENCE# FIRST_CHANGE# ---------- ------------- 1 /oradata/crmdb/redo01.log 11766 983506528 2 /oradata/crmdb/redo02.log 11767 983510157 GROUP# ---------- MEMBER -------------------------------------------------------------------------------- SEQUENCE# FIRST_CHANGE# ---------- ------------- 5 /oradata/crmdb/redo05.log 11765 983500436 4 /oradata/crmdb/redo04.log GROUP# ---------- MEMBER -------------------------------------------------------------------------------- SEQUENCE# FIRST_CHANGE# ---------- ------------- 11764 983305117 3 /oradata/crmdb/redo03.log 11763 983109740
从结果可以看到 redo02.log 的 change 和 sequence 与上面的提示一致,使用改文件恢复。
3、使用/oradata/crmdb/redo02.log 恢复数据库
SQL> recover database using backup controlfile until cancel; ORA-00279: change 983510157 generated at 10/30/2019 19:58:11 needed for thread 1 ORA-00289: suggestion : /oracle/fast_recovery_area/CRMDB/archivelog/2019_10_31/o1_mf_1_11767_%u_.arc ORA-00280: change 983510157 for thread 1 is in sequence #11767 Specify log: {<RET>=suggested | filename | AUTO | CANCEL} /oradata/crmdb/redo02.log Log applied. Media recovery complete.
恢复成功后,执行以下命令:
alter database open resetlogs;
4、问题解决,重启数据库
SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 1.0021E+10 bytes Fixed Size 2261848 bytes Variable Size 1778388136 bytes Database Buffers 8220835840 bytes Redo Buffers 19894272 bytes Database mounted. Database opened.