注意:Oracle的隐含参数只应该在测试环境或者在Oracle Support的支持下使用。
从Oracle的系统表中,我们知道Oracle存在一个隐含参数_disable_logging可以用于禁用日志生成,这个参数显然只能用于测试目的(可以极大提高Benchmark测试的性能),禁止日志生成必然导致事务的不可恢复性,而且会导致日志文件损坏。
1
2
3
4
5
|
SQL> select ksppinm,ksppdesc from x$ksppi where ksppinm like '%logging' ; KSPPINM KSPPDESC -------------------- ------------------------------ _disable_logging Disable logging |
因为特殊的需要,对这个参数进行了一点简单测试:
1.设置参数
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
[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.事务测试
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
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中,没有数据被恢复,只有成功完成的上次检查点之前数据可以被获取,之后数据都将丢失。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
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 |
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流。
原文链接:http://www.eygle.com