数据文件SCN不一致恢复(ORA-00600: internal error code, arguments: [2662], [0])

数据文件SCN不一致恢复(ORA-00600: internal error code, arguments: [2662], [0]

参考eygle老师的BLOG!在此再次感谢各位大师愿意分享的经验!!

http://www.eygle.com/archives/2005/10/ora_600_2662_error.html

http://www.eygle.com/archives/2005/12/oracle_diagnostics_howto_deal_2662_error.html

 

 

1、恢复,开启数据库报错及alert日志

 

SQL> startup

ORACLE instance started.

 

Total System Global Area  457179136 bytes

Fixed Size                  1219976 bytes

Variable Size             146801272 bytes

Database Buffers          306184192 bytes

Redo Buffers                2973696 bytes

Database mounted.

ORA-01092: ORACLE instance terminated. Disconnection forced

SQL> startup mount;

ORA-24324: service handle not initialized

ORA-01041: internal error. hostdef extension doesn't exist

 

Alert日志:

ORA-00600: internal error code, arguments: [2662], [0], [558703], [0], [558891], [4194313], [], []

 

2、尝试在rman startup  竟然可以启动,心有余悸,肯定还有问题。

最有可能是的就是SCN不一致,于是看了一下。结果SCN真的不一致!(突然梦醒,我使用了_allow_resetlogs_corruption=true 隐含参数出现的问题)

 

[ora@dg-pp doudou]$ rman target /

 

Recovery Manager: Release 10.2.0.1.0 - Production on Thu Apr 5 23:15:31 2012

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

connected to target database (not started)

 

RMAN> startup

 

Oracle instance started

database mounted

database opened

 

Total System Global Area     457179136 bytes

 

Fixed Size                     1219976 bytes

Variable Size                146801272 bytes

Database Buffers             306184192 bytes

Redo Buffers                   2973696 bytes

 

SQL> conn /as sysdba

Connected.

 

SQL> select file#,CHECKPOINT_CHANGE# from v$datafile;

 

     FILE# CHECKPOINT_CHANGE#

---------- ------------------

         1             578703

         2             578703

         3             578703

         4             578703

         5                  0

         6                  0

         7             578703

 

7 rows selected.

 

3、关闭数据库,进行强制推进SCN,达到一致!

 

SQL> shutdown abort;

ORACLE instance shut down.

SQL> startup mount;

ORACLE instance started.

 

Total System Global Area  457179136 bytes

Fixed Size                  1219976 bytes

Variable Size             146801272 bytes

Database Buffers          306184192 bytes

Redo Buffers                2973696 bytes

Database mounted.

SQL> alter session set events '10015 trace name adjust_scn level 1';

 

Session altered.

 

SQL> alter database open;

 

Database altered.

 

4、启动参数之后竟然没有被恢复。

想了一下最有可能就是恢复的时候把文件OFFLINE,结果一参数还真是OFFLINE状态,这也说明了强制推进SCN只对在线文件起作用

 

SQL> select file#,CHECKPOINT_CHANGE# from v$datafile;

 

     FILE# CHECKPOINT_CHANGE#

---------- ------------------

         1             598838

         2             598838

         3             598838

         4             598838

         5                  0

         6                  0

         7             598838

 

7 rows selected.

 

SQL> select checkpoint_change#,name,status from v$datafile;

 

CHECKPOINT_CHANGE# NAME                                          STATUS

------------------ --------------------------------------------- --------------

            598838 /opt/oracle/oradata/doudou/system01.dbf       SYSTEM

            598838 /opt/oracle/oradata/doudou/undotbs01.dbf      ONLINE

            598838 /opt/oracle/oradata/doudou/sysaux01.dbf       ONLINE

            598838 /opt/oracle/oradata/doudou/users01.dbf        ONLINE

                 0 /opt/oracle/oradata/doudou/doudou.dbf         OFFLINE

                 0 /opt/oracle/oradata/doudou/test.dbf           OFFLINE

            598838 /opt/oracle/oradata/doudou/doudou_test.dbf    ONLINE

 

5OFFLINE的文件修改成ONLINE文件,然后执行强制推进SCN,达到SCN一致。

OK恢复成功了!

 

SQL> shutdown abort;

ORACLE instance shut down.

SQL> startup mount

ORACLE instance started.

 

Total System Global Area  457179136 bytes

Fixed Size                  1219976 bytes

Variable Size             146801272 bytes

Database Buffers          306184192 bytes

Redo Buffers                2973696 bytes

Database mounted.

SQL> alter database datafile 5 online;

 

Database altered.

 

SQL> alter database datafile 6 online;

 

Database altered.

 

SQL> alter session set events '10015 trace name adjust_scn level 10';

 

Session altered.

 

SQL> alter database open;

alter database open

*

ERROR at line 1:

ORA-01190: control file or data file 5 is from before the last RESETLOGS

ORA-01110: data file 5: '/opt/oracle/oradata/doudou/doudou.dbf'

 

 

SQL> alter database open resetlogs;

 

Database altered.

 

SQL> select checkpoint_change#,name,status from v$datafile;

 

CHECKPOINT_CHANGE# NAME                                          STATUS

------------------ --------------------------------------------- --------------

            598911 /opt/oracle/oradata/doudou/system01.dbf       SYSTEM

            598911 /opt/oracle/oradata/doudou/undotbs01.dbf      ONLINE

            598911 /opt/oracle/oradata/doudou/sysaux01.dbf       ONLINE

            598911 /opt/oracle/oradata/doudou/users01.dbf        ONLINE

            598911 /opt/oracle/oradata/doudou/doudou.dbf         ONLINE

            598911 /opt/oracle/oradata/doudou/test.dbf           ONLINE

            598911 /opt/oracle/oradata/doudou/doudou_test.dbf    ONLINE

 

7 rows selected.

 

SQL>

 

总结:

一、各位同学,如果我们使用隐含参数恢复成功之后,一定要导出数据,重新建库然后导入。不然会有很多异常的问题出现,不可控的风险是不允许在我们生产库的!

二、增进SCN有两种常用方法:

1)通过immediate trace name方式(在数据库Open状态下)

alter session set events 'IMMEDIATE trace name ADJUST_SCN level x';

2)通过10015事件(在数据库无法打开,mount状态下)

alter session set events '10015 trace name adjust_scn level x';

 

 

 

 

附表:

盖老师解决SCN的方法

通过正常方式启动数据库时,从alert文件中,我们可以看到ora-00600 2662号错误。

Sun Dec 11 18:02:25 2005
Errors in file /opt/oracle/admin/conner/udump/conner_ora_13349.trc:
ORA-00600: internal error code, arguments: [2662], [0], [547743994], [0], [898092653], [8388617], [], []
Sun Dec 11 18:02:27 2005
Errors in file /opt/oracle/admin/conner/udump/conner_ora_13349.trc:
ORA-00600: internal error code, arguments: [2662], [0], [547743994], [0], [898092653], [8388617], [], []
Sun Dec 11 18:02:27 2005
Error 600 happened during db open, shutting down database
USER: terminating instance due to error 600

此时我们可以通过Oracle内部事件来调整SCN:

增进SCN有两种常用方法:

1.通过immediate trace name方式(在数据库Open状态下)

alter session set events 'IMMEDIATE trace name ADJUST_SCN level x';

2.通过10015事件(在数据库无法打开,mount状态下)

alter session set events '10015 trace name adjust_scn level x';

:level 1为增进SCN 10亿 (1 billion) (1024*1024*1024),通常Level 1已经足够。也可以根据实际情况适当调整。

本例由于数据库无法打开,只能使用的二种方法。

[oracle@jumper dbs]$ sqlplus "/ as sysdba"
SQL*Plus: Release 9.2.0.4.0 - Production on Sun Dec 11 18:26:18 2005
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
Connected to an idle instance.
SQL> startup mount pfile=initconner.ora
ORACLE instance started.
Total System Global Area   97588504 bytes
Fixed Size                   451864 bytes
Variable Size              33554432 bytes
Database Buffers           62914560 bytes
Redo Buffers                 667648 bytes
Database mounted.
SQL> alter session set events '10015 trace name adjust_scn level 10';
Session altered.
SQL> alter database open;
Database altered.

注意,由于我使用了10015事件,使得SCN增进了10 billion,稍后我们可以验证。 

[oracle@jumper dbs]$ sqlplus "/ as sysdba"
SQL*Plus: Release 9.2.0.4.0 - Production on Sun Dec 11 18:26:18 2005
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
Connected to an idle instance.
SQL> startup mount pfile=initconner.ora
ORACLE instance started.
Total System Global Area   97588504 bytes
Fixed Size                   451864 bytes
Variable Size              33554432 bytes
Database Buffers           62914560 bytes
Redo Buffers                 667648 bytes
Database mounted.
SQL> alter session set events '10015 trace name adjust_scn level 10';
Session altered.
SQL> alter database open;
Database altered.

此时数据库可以打开,从alert文件中我们可以看到如下提示:

Sun Dec 11 18:27:04 2005
SMON: enabling cache recovery
Sun Dec 11 18:27:05 2005
Debugging event used to advance scn to 10737418240

SCN被增进了10 billion, 10 * (1024*1024*1024) = 10737418240,正好是日志里记录的数量。

我们从数据库内部看一下检查点的增进情况:

SQL> select open_mode from v$database;
OPEN_MODE
----------
READ WRITE
SQL> select file#,CHECKPOINT_CHANGE# from v$datafile;
     FILE# CHECKPOINT_CHANGE#
---------- ------------------
         1          547783998
         2          547783998
         3          547783998
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area   97588504 bytes
Fixed Size                   451864 bytes
Variable Size              33554432 bytes
Database Buffers           62914560 bytes
Redo Buffers                 667648 bytes
Database mounted.
Database opened.
SQL> select file#,CHECKPOINT_CHANGE# from v$datafile;
     FILE# CHECKPOINT_CHANGE#
---------- ------------------
         1         1.0737E+10
         2         1.0737E+10
         3         1.0737E+10
SQL> col CHECKPOINT_CHANGE# for 99999999999999999
SQL>  select file#,CHECKPOINT_CHANGE# from v$datafile;
     FILE# CHECKPOINT_CHANGE#
---------- ------------------
         1        10737418447
         2        10737418447
         3        10737418447

我们看到CHECKPOINT_CHANGE# 最终被增进了10 Billion.这要是账户上的钱该有多好:)

盖老师还是一个风趣的人,哇哈!

 

 

你可能感兴趣的:(数据文件SCN不一致恢复(ORA-00600: internal error code, arguments: [2662], [0]))