详解Oracle中的隐含参数_disable_logging
程序员文章站
2022-05-10 22:59:09
注意:oracle的隐含参数只应该在测试环境或者在oracle support的支持下使用。
从oracle的系统表中,我们知道oracle存在一个隐含参数_disa...
注意:oracle的隐含参数只应该在测试环境或者在oracle support的支持下使用。
从oracle的系统表中,我们知道oracle存在一个隐含参数_disable_logging可以用于禁用日志生成,这个参数显然只能用于测试目的(可以极大提高benchmark测试的性能),禁止日志生成必然导致事务的不可恢复性,而且会导致日志文件损坏。
sql> select ksppinm,ksppdesc from x$ksppi where ksppinm like '%logging'; ksppinm ksppdesc -------------------- ------------------------------ _disable_logging disable logging
因为特殊的需要,对这个参数进行了一点简单测试:
1.设置参数
[oracle@jumper bdump]$ sqlplus "/ as sysdba" sql*plus: release 9.2.0.4.0 - production on wed oct 19 11:01:19 2005 copyright (c) 1982, 2002, oracle corporation. all rights reserved. connected to: oracle9i enterprise edition release 9.2.0.4.0 - production with the partitioning option jserver release 9.2.0.4.0 - production sql> alter system set "_disable_logging"=true scope=both; system altered.
2.事务测试
sql> create table t as select * from dba_users; table created. sql> select count(*) from t; count(*) ---------- 12 sql> shutdown abort; 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 count(*) from t; select count(*) from t * error at line 1: ora-00942: table or view does not exist
由于未产生相应日志,数据库crash或shutdown abort之后,上一次成功完成的检查点之后变化的数据将无法恢复。
3.观察alert文件
从日志中我们可以看到在instance recovery中,没有数据被恢复,只有成功完成的上次检查点之前数据可以被获取,之后数据都将丢失。
wed oct 19 20:38:38 2005 beginning crash recovery of 1 threads wed oct 19 20:38:38 2005 started first pass scan wed oct 19 20:38:39 2005 completed first pass scan 0 redo blocks read, 0 data blocks need recovery wed oct 19 20:38:39 2005 started recovery at thread 1: logseq 2, block 201, scn 0.897632464 recovery of online redo log: thread 1 group 1 seq 2 reading mem 0 mem# 0 errs 0: /opt/oracle/oradata/conner/redo01.log wed oct 19 20:38:39 2005 completed redo application wed oct 19 20:38:39 2005 ended recovery at thread 1: logseq 2, block 201, scn 0.897652465 0 data blocks read, 0 data blocks written, 0 redo blocks read crash recovery completed successfully
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流。