共计 3346 个字符,预计需要花费 9 分钟才能阅读完成。
在 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.
更多 Oracle 相关信息见 Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-02/141074.htm