ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


當無論怎樣recover都出現下面錯誤的時候:
SQL> recover database using backup controlfile until cancel;
ORA-00279: change 797381 generated at 05/17/2010 20:35:40 needed for thread 1
ORA-00289: suggestion : /oracle/oradata/archivelog/1_17_718660226.dbf
ORA-00280: change 797381 for thread 1 is in sequence #17


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/oracle/oradata/denver/redo01.log
ORA-00310: archived log contains sequence 14; sequence 17 required
ORA-00334: archived log: '/oracle/oradata/denver/redo01.log'


ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 8 needs more recovery to be consistent
ORA-01110: data file 8: '/oracle/oradata/bakdb/rmantbs01.dbf'

alter system set "_allow_resetlogs_corruption"=true scope=spfile;
SQL> shutdown immediate
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 1061158912 bytes
Fixed Size                  2026128 bytes
Variable Size             348128624 bytes
Database Buffers          704643072 bytes
Redo Buffers                6361088 bytes
Database mounted.
SQL> alter database open resetlogs;

Database altered.
_allow_resetlogs_corruption(危險)
提示:Oracle的隱含參數只應該在測試環境或者在Oracle Support的支持下使用。
設置此參數之后,在數據庫Open過程中,Oracle會跳過某些一致性檢查,從而使數據庫可能跳過不一致狀態。
SQL> !oerr ora 01194

一次恢復DB的過程:試用隱含參數_allow_resetlogs_corruption和重建undo tablespace系統管理技術 2009-10-29 19:03:54 閱讀247 評論0 字號:大中小
問題:

某個現場做數據庫恢復的時侯有一個問題: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: {<RET>=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: Release 9.2.0.4.0 - Production on Sun May 4 11:49:10 2008

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /opt/oracle/db02/app/oracle/oradata/ORCL/archive
Oldest online log sequence     33159
Next log sequence to archive   33161
Current log sequence           33161
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;
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 Size                   732256 bytes
Variable Size             503316480 bytes
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: {<RET>=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;
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'

准備使用隱含參數_allow_resetlogs_corruption強制啟動DB:

SQL> show parameter spfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string                                     
SQL> create spfile from pfile;

File created.

SQL> shutdown immediate
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 826248288 bytes
Fixed Size                   732256 bytes
Variable Size             503316480 bytes
Database Buffers          318767104 bytes
Redo Buffers                3432448 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


SQL> show parameter spfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string     ?/dbs/spfile@.ora
SQL> alter system set "_allow_resetlogs_corruption"=true scope=spfile;

System altered.

提示:Oracle的隱含參數只應該在測試環境或者在Oracle Support的支持下使用。
設置此參數之后,在數據庫Open過程中,Oracle會跳過某些一致性檢查,從而使數據庫可能跳過不一致狀態。

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 Size                   732256 bytes
Variable Size             503316480 bytes
Database Buffers          318767104 bytes
Redo Buffers                3432448 bytes
Database mounted.
SQL> alter database open resetlogs;

alter database open resetlogs
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel


SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-03114: not connected to ORACLE


SQL> conn /as sysdba
Connected to an idle instance.
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01034: ORACLE not available


SQL> shutdown immediate
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
SVR4 Error: 2: No such file or directory
SQL> startup
ORACLE instance started.

Total System Global Area 826248288 bytes
Fixed Size                   732256 bytes
Variable Size             503316480 bytes
Database Buffers          318767104 bytes
Redo Buffers                3432448 bytes
Database mounted.
ORA-00607: Internal error occurred while making a change to a data block
ORA-00600: internal error code, arguments: [4194], [53], [43], [], [], [], [],[]

以上強制啟動后,產生Ora-600錯誤了,在預料之中。。。。

SQL> startup force;
ORACLE instance started.

Total System Global Area 826248288 bytes
Fixed Size                   732256 bytes
Variable Size             503316480 bytes
Database Buffers          318767104 bytes
Redo Buffers                3432448 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced


SQL> startup mount
ORACLE instance started.

Total System Global Area 826248288 bytes
Fixed Size                   732256 bytes
Variable Size             503316480 bytes
Database Buffers          318767104 bytes
Redo Buffers                3432448 bytes
Database mounted.
SQL> set pages 0 feedback off lines 132
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced


SQL>
SQL> !oerr ora 1092
01092, 00000, "ORACLE instance terminated. Disconnection forced"
// *Cause: The instance this process was connected to was terminated
//          abnormally, probably via a shutdown abort. This process
//          was forced to disconnect from the instance.
// *Action: Examine the alert log for more details. When the instance has been
//          restarted, retry action.

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-03114: not connected to ORACLE


SQL> startup force;
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn't exist
SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup force;
ORACLE instance started.
Total System Global Area 826248288 bytes
Fixed Size                   732256 bytes
Variable Size             503316480 bytes
Database Buffers          318767104 bytes
Redo Buffers                3432448 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced

由於和undo表空間不同步,那好重建undo tablespace:

SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 826248288 bytes
Fixed Size                   732256 bytes
Variable Size             503316480 bytes
Database Buffers          318767104 bytes
Redo Buffers                3432448 bytes
Database mounted.
SQL> show parameter undo
undo_management                      string      AUTO
undo_retention                       integer     3600
undo_suppress_errors                 boolean     FALSE
undo_tablespace                      string      UNDOTBS1
SQL> alter system set undo_management=manual scope=spfile;
SQL> alter database open;

先改成不使用undo,可以啟動DB,但沒法新建對象:

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 826248288 bytes
Fixed Size                   732256 bytes
Variable Size             503316480 bytes
Database Buffers          318767104 bytes
Redo Buffers                3432448 bytes
Database mounted.
Database opened.
SQL>
SQL> conn wacos/oss   
Connected.
SQL> select count(*) from tab;
      2034
SQL> create table t_test (c1 date);
create table t_test (c1 date)
*
ERROR at line 1:
ORA-01552: cannot use system rollback segment for non-system tablespace 'WACOS'


SQL> !oerr ora 1552
01552, 00000, "cannot use system rollback segment for non-system tablespace '%s'"
// *Cause: Tried to use the system rollback segment for operations involving
//        non-system tablespace. If this is a clone database then this will
//        happen when attempting any data modification outside of the system
//        tablespace. Only the system rollback segment can be online in a
//        clone database.
// *Action: Create one or more private/public segment(s), shutdown and then
//         startup again. May need to modify the INIT.ORA parameter
//         rollback_segments to acquire private rollback segment. If this is
//         a clone database being used for tablspace point in time recovery
//         then this operation is not allowed.

那就新建一個undo表空間,並棄用原先的:

SQL> create undo tablespace UNDOTBS1 datafile '/opt/oracle/db02/app/oracle/oradata/ORCL/undotbs01.dbf' size 3000m;
create undo tablespace UNDOTBS1 datafile '/opt/oracle/db02/app/oracle/oradata/ORCL/undotbs01.dbf' size 3000m
*
ERROR at line 1:
ORA-01543: tablespace 'UNDOTBS1' already exists


SQL> create undo tablespace UNDOTBS2 datafile '/opt/oracle/db02/app/oracle/oradata/ORCL/undotbs02.dbf' size 3000m;

SQL> show parameter undo
undo_management                      string      MANUAL
undo_retention                       integer     3600
undo_suppress_errors                 boolean     FALSE
undo_tablespace                      string      UNDOTBS1
SQL> alter system set undo_management=auto scope=spfile;
SQL> alter system set undo_tablespace=UNDOTBS2 scope=spfile;
SQL> shutdown immediate
ORA-01031: insufficient privileges
SQL> show user
USER is "WACOS"
SQL> conn /as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 826248288 bytes
Fixed Size                   732256 bytes
Variable Size             503316480 bytes
Database Buffers          318767104 bytes
Redo Buffers                3432448 bytes
Database mounted.
Database opened.
SQL> conn wacos/oss
Connected.
SQL> create table t_test (c1 date);
SQL>
SQL> drop tablespace undotbs1;
SQL> create table t_test2 (c1 date);
SQL> select * from t_test;
SQL> insert into t_test values (sysdate);
SQL> commit;
SQL> select * from t_test;
04-MAY-08

現在沒問題了,把隱含參數改回默認的:

SQL> alter system set "_allow_resetlogs_corruption"=false scope=spfile;
SQL> shutdown immediate
ORA-01031: insufficient privileges
SQL> conn /as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 826248288 bytes
Fixed Size                   732256 bytes
Variable Size             503316480 bytes
Database Buffers          318767104 bytes
Redo Buffers                3432448 bytes
Database mounted.
Database opened.

重啟沒問題了,問題解決,哈!

SQL> show parameter undo
undo_management                      string      AUTO
undo_retention                       integer     3600
undo_suppress_errors                 boolean     FALSE
undo_tablespace                      string      UNDOTBS2
SQL> show parameter spfile
spfile                               string     ?/dbs/spfile@.ora
SQL>  

通常使用此方法Open數據庫之后,應該立即通過導出、導入重建數據庫。

--End--

 


使用未寫入文檔參數_ALLOW_RESETLOGS_CORRUPTION進行崩潰恢復經典作者:碩博網    文章來源:中華碩博網    點擊數:    更新時間:2008-5-3中華碩博網(http://www.china-b.com/)全球500所高校指定報名中心--使用未寫入文檔參數_ALLOW_RESETLOGS_CORRUPTION進行崩潰恢復經典
  什么情況可能使用該參數
   有些時侯可能你的庫處於非歸檔的模式下,而你的聯機重做日志又currupted,你的數據文件不能完成完全的恢復。而這時當你試圖打開數據庫時,oracle提示你用resetlogs選項,當你使用該選項時oracle又不允許你使用該選項,總之你想打開數據庫,可就是打不開。
  
  1、最好做一個物理的庫的全備
  
  2、使用sqlplus 啟動庫至mount
   sqlplus /nolog
   sql>connect internal
   sql>startup mount
  3、確保所有的數據文件都處於"END BACKUP"狀態
   sql>set pages 0 feedback off lines 132
   sql>spool alter_df.sql
   sql>SELECT 'alter database datafile '||file_name||' END BACKUP;' from v$datafile;
   sql>spool off
   sql>@alter_df.sql
  4、試着打開數據庫
   sql>alter database open;
   如數據庫成功打開,余下的都不需要做了,到此為止
  5、如果你在打開時被要求進行恢復,使用"UNTIL CANCEL"這種進行恢復,然后再發出ALTER DATABASE OPEN RESETLOGS這個命令
   sql>recover database until cancel;
   sql>alter database open resetlogs;
  6、如果數據庫仍不能打開,把庫down掉
   sql>shutdown immediate
  7、在init.ora中加入如下參數
   _allow_resetlogs_corruption=TRUE
  8、執行如下語句
   sql>connect internal
   sql>startup mount
   sql>@alter_df.sql
   sql>alter database open


使用未寫入文檔參數_ALLOW_RESETLOGS_CORRUPTION進行崩潰恢復_ALLOW_RESETLOGS_CORRUPTION進行崩潰恢復經典
  9、如在alter database open時仍舊報錯,使用until cancel恢復
   sql>recover database until cancel;
   sql>alter database open resetlogs;
  10、經過"9",數據庫一定被打開了,數據庫被打開后,馬上執行一個full export
  11、down掉庫,去掉_all_resetlogs_corrupt參數
  12、重建庫
  13、import並完成恢復
  14、建議執行一下ANALYZE TABLE ...VALIDATE STRUCTURE CASCADE;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM