1.通过immediate trace name方式(在数据库Open状态下)alter session set events
测试下_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有两种常用方法:
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已经足够。也可以根据实际情况适当调整。
本次由于数据库并未打开,而处于mount状态,所以只能通过第二种方式:
alter session set events '10015 trace name adjust_scn level 10';
SQL> alter database open;
Database altered.