ORA-00600: internal error code, arguments: [2662]

时间:2024-01-16 14:31:38

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

ORA-00600 2262错误解决一文中,我曾经提到过,很多时候使用隐含参数_ALLOW_RESETLOGS_CORRUPTION后resetlogs打开数据库,我们可能会由于SCN不一致而遭遇到ORA-00600 2662号错误,这里给出一个完整的例子及解决过程。

当然模拟2662错误需要技巧,本文并不会涉及这个内容。

通过正常方式启动数据库时,从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.这要是账户上的钱该有多好