ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 使用“_allow_resetlogs_corruption=true”成功案例

使用“_allow_resetlogs_corruption=true”成功案例

原创 Linux操作系统 作者:wghxwl12 时间:2009-05-22 10:38:30 0 删除 编辑

1.备份生产库的参数文件:
create pfile='/oracle/pfile.ora' from spfile;//这一步可以不做,RMAN自动备份应该有SPFILE文件,保险起见。
2.使用RMAN脚本备份数据库:
run{
configure controlfile autobackup on;
allocate channel node1 device type disk;
sql ' alter system archive log thread 1 current';
backup archivelog all delete input format '/oracle/%U_%s.bak';
backup database;
}
3. 将备份集拷贝出来,然后在别的机器上建一个测试库。
4.首先创建参数文件:
startup pfile='/oracle/pfile.ora' nomount;
create spfile from pfile='/oracle/pfile.ora'
shutdown immediate
5.恢复控制文件:
rman target /
startup nomount;
restore controlfile from autobackup;
6.恢复数据文件:
mkdir  /oracle/XCKY       //创建生产库相应的文件夹
rman target /
startup mount;
restore database;
7.解压归档日志备份集
rman target /
startup mount;
restore archivelog all;
[oracle@dg1 archivelog]$ cd 2008_12_27/
[oracle@dg1 2008_12_27]$ ls
o1_mf_1_10_4ods25r0_.arc  o1_mf_1_2_4of68pq9_.arc  o1_mf_1_6_4of68qf5_.arc
o1_mf_1_11_4of68qlb_.arc  o1_mf_1_3_4of68q6w_.arc  o1_mf_1_7_4of68r7n_.arc
o1_mf_1_12_4of68q58_.arc  o1_mf_1_4_4of68q3f_.arc  o1_mf_1_8_4of68rtq_.arc
o1_mf_1_13_4of68sw6_.arc  o1_mf_1_5_4of68qcg_.arc  o1_mf_1_9_4of68s8d_.arc
8.出现问题:
[oracle@dg1 oracle]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Dec 27 15:48:37 2008
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
SQL> conn sys/oracle as sysdba
Connected.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL> recover database until cancel;
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01194: file 3 needs more recovery to be consistent
ORA-01110: data file 3: '/oracle/oradata/dg1/sysaux01.dbf'
解决办法:
1.尝试RMAN原始恢复:
RMAN> recover database;
Starting recover at 27-DEC-08
using channel ORA_DISK_1
starting media recovery
unable to find archive log
archive log thread=1 sequence=14
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 12/27/2008 16:08:17
RMAN-06054: media recovery requesting unknown log: thread 1 seq 14 lowscn 705360
SQL> recover database using backup controlfile;
ORA-00279: change 705360 generated at 12/27/2008 11:00:27 needed for thread 1
ORA-00289: suggestion :
/oracle/flash_recovery_area/DG1/archivelog/2008_12_27/o1_mf_1_14_%u_.arc
ORA-00280: change 705360 for thread 1 is in sequence #14

Specify log: {=suggested | filename | AUTO | CANCEL}
auto
ORA-00308: cannot open archived log
'/oracle/flash_recovery_area/DG1/archivelog/2008_12_27/o1_mf_1_14_%u_.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3

ORA-00308: cannot open archived log
'/oracle/flash_recovery_area/DG1/archivelog/2008_12_27/o1_mf_1_14_%u_.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
和上面对比分析:
thread 1 seq 14 lowscn 705360 显然是未保存下来的联机日志。
如何解决呢?
[oracle@dg1 oracle]$ vi pfile.ora  //修改PFILE 文件
添加:“_allow_resetlogs_corruption=true”
SQL> startup pfile='/oracle/pfile.ora' mount;
ORACLE instance started.
SQL> create spfile from pfile='/oracle/pfile.ora';
File created.
SQL> shutdown immediate
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area  511705088 bytes
Fixed Size                  1220288 bytes
Variable Size             167772480 bytes
Database Buffers          339738624 bytes
Redo Buffers                2973696 bytes
Database mounted.
SQL> recover database until cancel;
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done

SQL> recover database until cancel using backup controlfile;
ORA-00279: change 705360 generated at 12/27/2008 11:00:27 needed for thread 1
ORA-00289: suggestion :
/oracle/flash_recovery_area/DG1/archivelog/2008_12_27/o1_mf_1_14_%u_.arc
ORA-00280: change 705360 for thread 1 is in sequence #14

Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 3 needs more recovery to be consistent
ORA-01110: data file 3: '/oracle/oradata/dg1/sysaux01.dbf'

ORA-01112: media recovery not started

SQL> recover database using backup controlfile;
ORA-00279: change 705360 generated at 12/27/2008 11:00:27 needed for thread 1
ORA-00289: suggestion :
/oracle/flash_recovery_area/DG1/archivelog/2008_12_27/o1_mf_1_14_%u_.arc
ORA-00280: change 705360 for thread 1 is in sequence #14

Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
SQL> alter database open resetlogs;
Database altered.   //使用这个方法解决问题OK啦 。。。。
SQL> desc v$tablespace;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 TS#                                                NUMBER
 NAME                                               VARCHAR2(30)
 INCLUDED_IN_DATABASE_BACKUP                        VARCHAR2(3)
 BIGFILE                                            VARCHAR2(3)
 FLASHBACK_ON                                       VARCHAR2(3)
 ENCRYPT_IN_BACKUP                                  VARCHAR2(3)
SQL> select ts#,name from v$tablespace;
       TS# NAME
---------- ------------------------------
         0 SYSTEM
         1 UNDOTBS1
         2 SYSAUX
         4 USERS
         3 TEMP
         6 EXAMPLE
         7 PHOTO_INFO
         8 XCKY_INFO
         9 BUNCH_INFO
        10 TRANSFER_INFO
        11 OTHER_INFO
       TS# NAME
---------- ------------------------------
        12 BULLETIN_INFO
        13 SYSTEM_INFO
        14 XCKYTMP
14 rows selected.
SQL> conn xcky/xcky
Connected.
SQL> shutdown immediate
ORA-01031: insufficient privileges
SQL> conn sys/oracle as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
最后数据库正常启动,NP啦。。。。。backup database;
}
3. 将备份集拷贝出来,然后在别的机器上建一个测试库。
4.首先创建参数文件:
startup pfile='/oracle/pfile.ora' nomount;
create spfile from pfile='/oracle/pfile.ora'
shutdown immediate
5.恢复控制文件:
rman target /
startup nomount;
restore controlfile from autobackup;
6.恢复数据文件:
mkdir  /oracle/XCKY       //创建生产库相应的文件夹
rman target /
startup mount;
restore database;
7.解压归档日志备份集
rman target /
startup mount;
restore archivelog all;
[oracle@dg1 archivelog]$ cd 2008_12_27/
[oracle@dg1 2008_12_27]$ ls
o1_mf_1_10_4ods25r0_.arc  o1_mf_1_2_4of68pq9_.arc  o1_mf_1_6_4of68qf5_.arc
o1_mf_1_11_4of68qlb_.arc  o1_mf_1_3_4of68q6w_.arc  o1_mf_1_7_4of68r7n_.arc
o1_mf_1_12_4of68q58_.arc  o1_mf_1_4_4of68q3f_.arc  o1_mf_1_8_4of68rtq_.arc
o1_mf_1_13_4of68sw6_.arc  o1_mf_1_5_4of68qcg_.arc  o1_mf_1_9_4of68s8d_.arc
8.出现问题:
[oracle@dg1 oracle]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Dec 27 15:48:37 2008
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
SQL> conn sys/oracle as sysdba
Connected.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL> recover database until cancel;
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01194: file 3 needs more recovery to be consistent
ORA-01110: data file 3: '/oracle/oradata/dg1/sysaux01.dbf'
解决办法:
1.尝试RMAN原始恢复:
RMAN> recover database;
Starting recover at 27-DEC-08
using channel ORA_DISK_1
starting media recovery
unable to find archive log
archive log thread=1 sequence=14
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 12/27/2008 16:08:17
RMAN-06054: media recovery requesting unknown log: thread 1 seq 14 lowscn 705360
SQL> recover database using backup controlfile;
ORA-00279: change 705360 generated at 12/27/2008 11:00:27 needed for thread 1
ORA-00289: suggestion :
/oracle/flash_recovery_area/DG1/archivelog/2008_12_27/o1_mf_1_14_%u_.arc
ORA-00280: change 705360 for thread 1 is in sequence #14

Specify log: {=suggested | filename | AUTO | CANCEL}
auto
ORA-00308: cannot open archived log
'/oracle/flash_recovery_area/DG1/archivelog/2008_12_27/o1_mf_1_14_%u_.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3

ORA-00308: cannot open archived log
'/oracle/flash_recovery_area/DG1/archivelog/2008_12_27/o1_mf_1_14_%u_.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
和上面对比分析:
thread 1 seq 14 lowscn 705360 显然是未保存下来的联机日志。
如何解决呢?
[oracle@dg1 oracle]$ vi pfile.ora  //修改PFILE 文件
添加:“_allow_resetlogs_corruption=true”
SQL> startup pfile='/oracle/pfile.ora' mount;
ORACLE instance started.
SQL> create spfile from pfile='/oracle/pfile.ora';
File created.
SQL> shutdown immediate
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area  511705088 bytes
Fixed Size                  1220288 bytes
Variable Size             167772480 bytes
Database Buffers          339738624 bytes
Redo Buffers                2973696 bytes
Database mounted.
SQL> recover database until cancel;
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done

SQL> recover database until cancel using backup controlfile;
ORA-00279: change 705360 generated at 12/27/2008 11:00:27 needed for thread 1
ORA-00289: suggestion :
/oracle/flash_recovery_area/DG1/archivelog/2008_12_27/o1_mf_1_14_%u_.arc
ORA-00280: change 705360 for thread 1 is in sequence #14

Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 3 needs more recovery to be consistent
ORA-01110: data file 3: '/oracle/oradata/dg1/sysaux01.dbf'

ORA-01112: media recovery not started

SQL> recover database using backup controlfile;
ORA-00279: change 705360 generated at 12/27/2008 11:00:27 needed for thread 1
ORA-00289: suggestion :
/oracle/flash_recovery_area/DG1/archivelog/2008_12_27/o1_mf_1_14_%u_.arc
ORA-00280: change 705360 for thread 1 is in sequence #14

Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
SQL> alter database open resetlogs;
Database altered.   //使用这个方法解决问题OK啦 。。。。
SQL> desc v$tablespace;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 TS#                                                NUMBER
 NAME                                               VARCHAR2(30)
 INCLUDED_IN_DATABASE_BACKUP                        VARCHAR2(3)
 BIGFILE                                            VARCHAR2(3)
 FLASHBACK_ON                                       VARCHAR2(3)
 ENCRYPT_IN_BACKUP                                  VARCHAR2(3)
SQL> select ts#,name from v$tablespace;
       TS# NAME
---------- ------------------------------
         0 SYSTEM
         1 UNDOTBS1
         2 SYSAUX
         4 USERS
         3 TEMP
         6 EXAMPLE
         7 PHOTO_INFO
         8 XCKY_INFO
         9 BUNCH_INFO
        10 TRANSFER_INFO
        11 OTHER_INFO
       TS# NAME
---------- ------------------------------
        12 BULLETIN_INFO
        13 SYSTEM_INFO
        14 XCKYTMP
14 rows selected.
SQL> conn xcky/xcky
Connected.
SQL> shutdown immediate
ORA-01031: insufficient privileges
SQL> conn sys/oracle as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
最后数据库正常启动,NP啦。。。。。

转自:http://space.itpub.net/8334342/viewspace-523079

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/187805/viewspace-600801/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2007-12-14

  • 博文量
    155
  • 访问量
    564731