最初的問題是這個帖子:
請大家仔細看那些測試的例子.
看了tom的解釋,始終覺得牽強.
開始以為可能是bug
經過觀察和測試,終於發現了nologging的秘密
我們知道,nologging只在很少情況下生效
通常,dml操作總是要生成redo的
這個我們不多說.
我們來看一下測試:
1.nologging的設定跟資料庫的執行模式有關
a.資料庫執行在非歸檔模式下:
sql> archive log list;database log mode no archive mode
automatic archival enabled
archive destination /opt/oracle/oradata/hsjf/archive
oldest online log sequence 155
current log sequence 157
sql> @redo
sql> create table test as select * from dba_objects where 1=0;
table created.
sql> select * from redo_size;
value
----------
63392
sql>
sql> insert into test select * from dba_objects;
10470 rows created.
sql> select * from redo_size;
value
----------
1150988
sql>
10470 rows created.
sql> select * from redo_size;
value
----------
1152368
----------- ----------
1380 1087596
sql> drop table test;
table dropped.
b.在歸檔模式下
sql> shutdown immediatedatabase closed.
database di**ounted.
oracle instance shut down.
sql> startup mount
oracle instance started.
total system global area 235999908 bytes
fixed size 451236 bytes
variable size 201326592 bytes
database buffers 33554432 bytes
redo buffers 667648 bytes
database mounted.
sql> alter database archivelog;
database altered.
sql> alter database open;
database altered.
sql> @redo
sql> create table test as select * from dba_objects where 1=0;
table created.
sql> select * from redo_size;
value
----------
56288
sql>
sql> insert into test select * from dba_objects;
10470 rows created.
sql> select * from redo_size;
value
----------
1143948
sql>
10470 rows created.
sql> select * from redo_size;
value
----------
2227712
----------- ----------
1083764 1087660
sql> drop table test;
table dropped.
通過logmnr分析日誌得到以下結果:
sql> select operation,count(*)2 from v$logmnr_contents
3 group by operation;
operation count(*)
-------------------------------- ----------
commit 17
direct insert 10470
internal 49
start 17
1
我們注意到這裡是direct insert,而且是10470條記錄,也就是每條記錄都記錄了redo.
2.對於nologging的table的處理
a. 在歸檔模式下:
sql> create table test nologging as select * from dba_objects where 1=0;table created.
sql> select * from redo_size;
value
----------
2270284
sql>
sql> insert into test select * from dba_objects;
10470 rows created.
sql> select * from redo_size;
value
----------
3357644
sql>
10470 rows created.
sql> select * from redo_size;
value
----------
3359024
----------- ----------
1380 1087360
sql> drop table test;
table dropped.
b.在非歸檔模式下:
sql> shutdown immediatedatabase closed.
database di**ounted.
oracle instance shut down.
sql> startup mount
oracle instance started.
total system global area 235999908 bytes
fixed size 451236 bytes
variable size 201326592 bytes
database buffers 33554432 bytes
redo buffers 667648 bytes
database mounted.
sql> alter database noarchivelog;
database altered.
sql> alter database open;
database altered.
sql> @redo
sql> create table test nologging as select * from dba_objects where 1=0;
table created.
sql> select * from redo_size;
value
----------
56580
sql>
sql> insert into test select * from dba_objects;
10470 rows created.
sql> select * from redo_size;
value
----------
1144148
sql>
10470 rows created.
sql> select * from redo_size;
value
----------
1145528
----------- ----------
1380 1087568
sql>
這就是通常大家認識的情況.
中國式「xx門」報道何時才能進行到底?
沒時間寫新東西,只好帖帖老文章,小廢物請原諒則個 關於 某某門 的問題兩周前就琢磨上了,只是一直沒空筆記。今天感冒好點了,前兩天睡得也足,於是就抽出精力來咬文嚼字磕磕牙。將愛情進行到底 熱播之後,有無數文章照貓畫虎 偷梁換柱,起名叫做 將xx進行到底 至今綿延不絕。去年是 中國式離婚 大熱,不用說,...
linux到底在何時panic
遇到核心panic,我們很無奈,我們總是以為核心自動的檢查出了錯誤,然後panic了,可事實上,panic是乙個函式,需要顯式呼叫的,panic機制固然是一種檢查核心正常的好機制,可是其背後隱藏了大量核心開發者的心血,核心開發者必須知道什麼情況下核心屬於不正常狀態,然後顯式呼叫panic,如果此時不...
美麗的姑娘,你何時才能重現
美麗的姑娘,你何時才能重現?代騰飛 2006年11月28日 於成都 美麗的姑娘,與你戲劇相識的一瞬間 我便深深地迷戀上了你婀娜多姿的身材與嬌豔欲滴的容顏 你那醉人的微笑與歡言,從此永駐了我的心間 開始了我今生永恆不變的愛戀 你的蜜語我的甜言,時空為我停留在那一永恆的瞬間 從此我便擁有了整個世界 然而...