Skip to content

Redo and Undo - 3. page

_disable_logging对数据库产生的影响

测试下_disable_logging将对数据库产生的影响,由于是隐含参数,所以通过如下方法获取对这个参数的描述:

SQL> select ksppinm,ksppdesc from x$ksppi where ksppinm like '%logging';

KSPPINM              KSPPDESC
------------------------------------
_disable_logging     Disable logging
 

将其改为ture,也就是启用了不记录日志的方式:

SQL> alter system set "_disable_logging"=true scope=both;
System altered.
 

创建一个,并模拟事务运行,生成大量的redo,

SQL> create table mm tablespace marvener as select * from dba_objects;
Table created.

SQL> insert into mm  select * from dba_objects;
45167 rows created.

SQL> /
 45167 rows created.

此时模拟掉电,shutdown abort关闭数据库:

SQL> shutdown abort
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1610612736 bytes
Fixed Size                  2084296 bytes
Variable Size             385876536 bytes
Database Buffers         1207959552 bytes
Redo Buffers               14692352 bytes
Database mounted.
ORA-00354: corrupt redo log block header
ORA-00353: log corruption near block 81435 change 856029 time 01/30/2012
15:50:39
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/marven/redo01.log'
 

如上。可以发现数据库无法正常打开,并提示重做日志块头损坏,在告警中可见大量的告警,
即使通过Resetlogs方式打开数据库:

alter system set "_allow_resetlogs_corruption"=true scope=spfile;
shutdown abort
startup
 

数据库仍然会显然如下告警,并强制关闭实例:

SMON: enabling cache recovery
Mon Jan 30 16:15:41 2012
Errors in file /u01/app/oracle/admin/marven/udump/marven_ora_2900.trc:
ORA-00600: internal error code, arguments: [2662], [0], [855728], [0], [855937], [8388649], [], []
Mon Jan 30 16:15:42 2012
Errors in file /u01/app/oracle/admin/marven/udump/marven_ora_2900.trc:
ORA-00600: internal error code, arguments: [2662], [0], [855728], [0], [855937], [8388649], [], []
Mon Jan 30 16:15:42 2012
Error 600 happened during db open, shutting down database
USER: terminating instance due to error 600
Instance terminated by USER, pid = 2900
ORA-1092 signalled during: alter database open resetlogs...
Mon Jan 30 16:16:34 2012
  

然而可以通过推进Oracle的SCN来解决此类问题:

增进SCN有几种常用方法,这里介绍其中2种:
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’;
注:10015的推进级别有个计算算法,具体可以参考adjust的官方说明。

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

SQL> alter database open;

Database altered.
  

ORA-00600: internal error code, arguments: [4193], [10837], [10841], [], [], [], [], []

大清早遭遇这个内部错误

Thu May 26 08:48:01 2011
Error 607 happened during db open, shutting down database
USER: terminating instance due to error 607
Thu May 26 08:48:01 2011
Errors in file d:oracleadmincqkfbdumpcqkf_smon_2904.trc:
ORA-00604: error occurred at recursive SQL level 1
ORA-00607: Internal error occurred while making a change to a data block
ORA-00600: internal error code, arguments: [4193], [10837], [10841], [], [], [], [], []

600的4193错误是由于undo和redo块不一致造成的,一般伴随在2662之后

PURPOSE:           
  This article discusses the internal error “ORA-600 [4193]”, what
  it means and possible actions. The information here is only applicable
  to the versions listed and is provided only for guidance.

ERROR:             
  ORA-600 [4193] [a] [b]

VERSIONS:          
  versions 6.0 to 10.1

DESCRIPTION:       

  A mismatch has been detected between Redo records and Rollback (Undo)
  records.

  We are validating the Undo block sequence number in the undo block against
  the Redo block sequence number relating to the change being applied.

  This error is reported when this validation fails.

ARGUMENTS:
  Arg [a] Undo record seq number
  Arg [b] Redo record seq number

这里的解决办法很简单,重建表空间可以解决问题

1.设置undo为手动管理,然后设置参数_CORRUPTED_ROLLBACK_SEGMENTS=(_SYSSMU1$, _SYSSMU2$, _SYSSMU3$, _SYSSMU4$, _SYSSMU5$, _SYSSMU6$, _SYSSMU7$, _SYSSMU8$, _SYSSMU9$, _SYSSMU10$)

这些回滚段可以在日志中找到:

SMON: enabling cache recovery
Thu May 26 08:47:48 2011
Undo Segment 1 Onlined
Undo Segment 2 Onlined
Undo Segment 3 Onlined
Undo Segment 4 Onlined
Undo Segment 5 Onlined
Undo Segment 6 Onlined
Undo Segment 7 Onlined
Undo Segment 8 Onlined
Undo Segment 9 Onlined
Undo Segment 10 Onlined

………

然后启动数据库使用初始化参数文件,再重建回滚表空间,问题解决。

如果出现错误的回滚段存在与system表空间中,那么以上的方法无法解决,需要修改system回滚表空间的块信息才能够打开数据库,具体方法参考如下:
《使用bbed修改system undo segment修复4193》