oracle 11g bootstrap$系列二

bitifi發表於2015-11-07

背景

  基於上文:http://blog.itpub.net/9240380/viewspace-1821176/,繼續測試瞭解bootstrap$與oracle啟動的關係。
 

結論

1,dd可以複製控制檔案指定個數的資料塊內容到一個臨時檔案
2,dd示例,因為控制檔案每個資料塊大小為16K,而DD預設複製緩衝區大小為512BYTE,所以COUNT=32,這樣正好是複製一個控制檔案資料塊的大小,便於進行分析控制檔案


鑑於控制檔案的資料塊大小為16K,所以調整DD命令為
[oracle@seconary guowang]$ dd if=/oracle/oradata/guowang/control01.ctl of=control01_head32.tmp  count=32
32+0 records in
32+0 records out
16384 bytes (16 kB) copied, 1e-05 seconds, 1.6 GB/s
[oracle@seconary guowang]$ 




3,獲取作業系統資料塊大小
可見作業系統資料塊大小4K
[root@seconary ~]# tune2fs -l /dev/mapper/VolGroup00-LogVol00|grep "Block size"
Block size:               4096   


4,dd複製指定部分的控制檔案與原始控制檔案內容一致


5,經過分析nomount到mount 10046的TRACE檔案,


可見不停在讀控制檔案,即讀一會控制檔案,然後再往控制檔案寫入,這樣迴圈進行,一直操作到控制檔案的第300多個塊,而控制檔案共計666個塊,可見操作了大半個控制檔案,而且是同時對2個控制檔案進行讀取與寫入
引申一下,可見控制檔案的重要性,如果控制檔案損壞,資料庫根本無法載入到mount狀態的
WAIT #3: nam='control file sequential read' ela= 44 file#=0 block#=1 blocks=1 obj#=-1 tim=1446296773013223  --讀取控制檔案的第一個塊
WAIT #3: nam='control file sequential read' ela= 69 file#=1 block#=1 blocks=1 obj#=-1 tim=1446296773039515   
WAIT #3: nam='control file sequential read' ela= 144975 file#=0 block#=3 blocks=8 obj#=-1 tim=1446296773184571  --讀取控制檔案的第3個塊到第10個塊
WAIT #3: nam='control file sequential read' ela= 63738 file#=1 block#=3 blocks=8 obj#=-1 tim=1446296773248392


*** 2015-10-31 09:06:17.249
WAIT #3: nam='control file heartbeat' ela= 4000995 p1=0 p2=0 p3=0 obj#=-1 tim=1446296777249544  --確保程式與控制檔案通訊正常
WAIT #3: nam='control file sequential read' ela= 60 file#=0 block#=3 blocks=8 obj#=-1 tim=1446296777250003 --讀取控制檔案的第3個塊到第10個塊
WAIT #3: nam='control file sequential read' ela= 36 file#=1 block#=3 blocks=8 obj#=-1 tim=1446296777250084
WAIT #3: nam='control file sequential read' ela= 7 file#=0 block#=1 blocks=1 obj#=-1 tim=1446296777250109  ---開始讀取第一個塊
WAIT #3: nam='control file parallel write' ela= 443 files=1 block#=1 requests=1 obj#=-1 tim=1446296777250578  --寫入第一個塊
WAIT #3: nam='control file sequential read' ela= 5 file#=0 block#=1 blocks=1 obj#=-1 tim=1446296777250612   --讀取第一個塊
WAIT #3: nam='control file sequential read' ela= 6 file#=1 block#=1 blocks=1 obj#=-1 tim=1446296777250634
WAIT #3: nam='control file parallel write' ela= 215 files=1 block#=1 requests=1 obj#=-1 tim=1446296777250866  --寫入第一個塊
WAIT #3: nam='control file sequential read' ela= 5 file#=0 block#=1 blocks=1 obj#=-1 tim=1446296777250905
WAIT #3: nam='control file sequential read' ela= 11096 file#=0 block#=16 blocks=1 obj#=-1 tim=1446296777262041  --讀取第16個塊
WAIT #3: nam='control file sequential read' ela= 828 file#=0 block#=18 blocks=1 obj#=-1 tim=1446296777263032  --讀取 第18個塊
WAIT #3: nam='control file parallel write' ela= 338 files=2 block#=17 requests=2 obj#=-1 tim=1446296777263447  --讀取第17個塊
WAIT #3: nam='control file parallel write' ela= 398 files=2 block#=15 requests=2 obj#=-1 tim=1446296777263874  --讀取第15個塊
WAIT #3: nam='control file parallel write' ela= 260 files=2 block#=1 requests=2 obj#=-1 tim=1446296777264159   --讀取第1個塊


6,從control file sequential read的file#=0及file#=1,可見是同時操作2個控制檔案的


7,作業系統資料塊大小為4K
可見作業系統資料塊大小4K
[root@seconary ~]# tune2fs -l /dev/mapper/VolGroup00-LogVol00|grep "Block size"
Block size:               4096   


可見讀取一個控制檔案資料塊,即要讀取4個作業系統資料塊

8,請用ue工具以16進位制編輯模式檢視並分析控制檔案及DD產生的臨時檔案內容


測試



1,鑑於nomount到mount從10046產生的等待事件為control file sequential read,所以我們分析下控制檔案


摘錄部分TRC檔案(源於10046)
WAIT #3: nam='control file sequential read' ela= 44 file#=0 block#=1 blocks=1 obj#=-1 tim=1446296773013223
WAIT #3: nam='control file sequential read' ela= 69 file#=1 block#=1 blocks=1 obj#=-1 tim=1446296773039515
WAIT #3: nam='control file sequential read' ela= 144975 file#=0 block#=3 blocks=8 obj#=-1 tim=1446296773184571
WAIT #3: nam='control file sequential read' ela= 63738 file#=1 block#=3 blocks=8 obj#=-1 tim=1446296773248392


DUMP控制檔案頭
SQL> oradebug setmypid
Statement processed.
SQL> oradebug dump controlf 1
Statement processed.
SQL> oradebug tracefile_name
/oracle/diag/rdbms/guowang/guowang/trace/guowang_ora_20750.trc


DUMP OF CONTROL FILES, Seq # 17506 = 0x4462
 V10 STYLE FILE HEADER:
        Compatibility Vsn = 186646528=0xb200000
        Db ID=3254377352=0xc1f9db88, Db Name='GUOWANG'
        Activation ID=0=0x0
        Control Seq=17506=0x4462, File size=666=0x29a
        File Number=0, Blksiz=16384, File Type=1 CONTROL
*** END OF DUMP ***


從TRC檔案看,先是讀取了控制檔案的第一個塊,即頭塊,然後是讀取了第3個到10個塊
[oracle@seconary guowang]$ ll -lh control*
-rw-r----- 1 oracle oinstall 11M Oct 31 21:41 control01.ctl
-rw-r----- 1 oracle oinstall 11M Oct 31 21:41 control02.ctl


我們想分析看看這些頭,到底儲存什麼內容
經過用UEEDIT以16進位制方式檢視上述dump 控制檔案頭,確實可以對應起來


我們現在就確認下控制檔案到底有多少個資料塊,每個資料塊多大,然後和dump控制檔案的內容對應起來,控制檔案共計666個資料塊
SQL> select name,file_size_blks,block_size from v$controlfile;


NAME                                                         FILE_SIZE_BLKS BLOCK_SIZE
------------------------------------------------------------ -------------- ----------
/oracle/oradata/guowang/control01.ctl                                   666      16384
/oracle/oradata/guowang/control02.ctl                                   666      16384


可見每個控制檔案的資料塊大小為16K
SQL> select 16384/1024 from dual;


16384/1024
----------
        16






嘗試用DD輸入控制檔案的指定資料塊到臨時檔案,進行研究,但用DD預設的資料塊大小為512B
[oracle@seconary guowang]$ dd if=/oracle/oradata/guowang/control01.ctl of=control01_head.tmp  count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.035445 seconds, 14.4 kB/s  




可見作業系統資料塊大小4K
[root@seconary ~]# tune2fs -l /dev/mapper/VolGroup00-LogVol00|grep "Block size"
Block size:               4096   




鑑於控制檔案的資料塊大小為16K,所以調整DD命令為
[oracle@seconary guowang]$ dd if=/oracle/oradata/guowang/control01.ctl of=control01_head32.tmp  count=32
32+0 records in
32+0 records out
16384 bytes (16 kB) copied, 1e-05 seconds, 1.6 GB/s
[oracle@seconary guowang]$ 




經過對比dd產生的檔案和原始控制檔案,內容是一致的




經過分析,可知,nomount到mount經過等待事件control file sequential read就是讀取控制檔案中的內容,進行一致性檢驗(注意,在控制檔案中反序儲存的)


我們把與控制檔案的TRC檔案全摘錄過來,進行分析
可見是讀一會控制檔案,然後再往控制檔案寫入,這樣迴圈進行,一直操作到控制檔案的第300多個塊,而控制檔案共計666個塊,可見操作了大半個控制檔案,而且是同時對2個控制檔案進行讀取與寫入
引申一下,可見控制檔案的重要性,如果控制檔案損壞,資料庫根本無法載入到mount狀態的
WAIT #3: nam='control file sequential read' ela= 44 file#=0 block#=1 blocks=1 obj#=-1 tim=1446296773013223  --讀取控制檔案的第一個塊
WAIT #3: nam='control file sequential read' ela= 69 file#=1 block#=1 blocks=1 obj#=-1 tim=1446296773039515   
WAIT #3: nam='control file sequential read' ela= 144975 file#=0 block#=3 blocks=8 obj#=-1 tim=1446296773184571  --讀取控制檔案的第3個塊到第10個塊
WAIT #3: nam='control file sequential read' ela= 63738 file#=1 block#=3 blocks=8 obj#=-1 tim=1446296773248392


*** 2015-10-31 09:06:17.249
WAIT #3: nam='control file heartbeat' ela= 4000995 p1=0 p2=0 p3=0 obj#=-1 tim=1446296777249544  --確保程式與控制檔案通訊正常
WAIT #3: nam='control file sequential read' ela= 60 file#=0 block#=3 blocks=8 obj#=-1 tim=1446296777250003 --讀取控制檔案的第3個塊到第10個塊
WAIT #3: nam='control file sequential read' ela= 36 file#=1 block#=3 blocks=8 obj#=-1 tim=1446296777250084
WAIT #3: nam='control file sequential read' ela= 7 file#=0 block#=1 blocks=1 obj#=-1 tim=1446296777250109  ---開始讀取第一個塊
WAIT #3: nam='control file parallel write' ela= 443 files=1 block#=1 requests=1 obj#=-1 tim=1446296777250578  --寫入第一個塊
WAIT #3: nam='control file sequential read' ela= 5 file#=0 block#=1 blocks=1 obj#=-1 tim=1446296777250612   --讀取第一個塊
WAIT #3: nam='control file sequential read' ela= 6 file#=1 block#=1 blocks=1 obj#=-1 tim=1446296777250634
WAIT #3: nam='control file parallel write' ela= 215 files=1 block#=1 requests=1 obj#=-1 tim=1446296777250866  --寫入第一個塊
WAIT #3: nam='control file sequential read' ela= 5 file#=0 block#=1 blocks=1 obj#=-1 tim=1446296777250905
WAIT #3: nam='control file sequential read' ela= 11096 file#=0 block#=16 blocks=1 obj#=-1 tim=1446296777262041  --讀取第16個塊
WAIT #3: nam='control file sequential read' ela= 828 file#=0 block#=18 blocks=1 obj#=-1 tim=1446296777263032  --讀取 第18個塊
WAIT #3: nam='control file parallel write' ela= 338 files=2 block#=17 requests=2 obj#=-1 tim=1446296777263447  --讀取第17個塊
WAIT #3: nam='control file parallel write' ela= 398 files=2 block#=15 requests=2 obj#=-1 tim=1446296777263874  --讀取第15個塊
WAIT #3: nam='control file parallel write' ela= 260 files=2 block#=1 requests=2 obj#=-1 tim=1446296777264159   --讀取第1個塊
WAIT #3: nam='control file sequential read' ela= 6 file#=0 block#=1 blocks=1 obj#=-1 tim=1446296777264181
WAIT #3: nam='control file sequential read' ela= 30 file#=0 block#=3 blocks=8 obj#=-1 tim=1446296777264234
WAIT #3: nam='control file parallel write' ela= 343 files=1 block#=3 requests=1 obj#=-1 tim=1446296777264600
WAIT #3: nam='control file sequential read' ela= 31 file#=0 block#=3 blocks=1 obj#=-1 tim=1446296777264743
WAIT #3: nam='control file parallel write' ela= 161 files=1 block#=4 requests=1 obj#=-1 tim=1446296777265035
WAIT #3: nam='control file sequential read' ela= 5 file#=0 block#=4 blocks=1 obj#=-1 tim=1446296777265058
WAIT #3: nam='control file parallel write' ela= 146 files=1 block#=5 requests=1 obj#=-1 tim=1446296777265219
WAIT #3: nam='control file sequential read' ela= 7 file#=0 block#=5 blocks=1 obj#=-1 tim=1446296777265248
WAIT #3: nam='control file parallel write' ela= 211 files=1 block#=6 requests=1 obj#=-1 tim=1446296777265475
WAIT #3: nam='control file sequential read' ela= 134 file#=0 block#=6 blocks=1 obj#=-1 tim=1446296777265625
WAIT #3: nam='control file parallel write' ela= 8503 files=1 block#=7 requests=1 obj#=-1 tim=1446296777274158
WAIT #3: nam='control file sequential read' ela= 9 file#=0 block#=7 blocks=1 obj#=-1 tim=1446296777274229
WAIT #3: nam='control file parallel write' ela= 197 files=1 block#=8 requests=1 obj#=-1 tim=1446296777274449
WAIT #3: nam='control file sequential read' ela= 4 file#=0 block#=8 blocks=1 obj#=-1 tim=1446296777274467
WAIT #3: nam='control file parallel write' ela= 129 files=1 block#=9 requests=1 obj#=-1 tim=1446296777274607
WAIT #3: nam='control file sequential read' ela= 3 file#=0 block#=9 blocks=1 obj#=-1 tim=1446296777274624
WAIT #3: nam='control file parallel write' ela= 277 files=1 block#=10 requests=1 obj#=-1 tim=1446296777274912
WAIT #3: nam='control file sequential read' ela= 347 file#=0 block#=10 blocks=1 obj#=-1 tim=1446296777275274
WAIT #3: nam='control file parallel write' ela= 403 files=1 block#=11 requests=1 obj#=-1 tim=1446296777275717
WAIT #3: nam='control file sequential read' ela= 4 file#=0 block#=11 blocks=1 obj#=-1 tim=1446296777275736
WAIT #3: nam='control file parallel write' ela= 130 files=1 block#=12 requests=1 obj#=-1 tim=1446296777275877
WAIT #3: nam='control file sequential read' ela= 4 file#=0 block#=12 blocks=1 obj#=-1 tim=1446296777275894
WAIT #3: nam='control file parallel write' ela= 106 files=1 block#=13 requests=1 obj#=-1 tim=1446296777276010
WAIT #3: nam='control file sequential read' ela= 3 file#=0 block#=13 blocks=1 obj#=-1 tim=1446296777276026
WAIT #3: nam='control file sequential read' ela= 63871 file#=0 block#=282 blocks=1 obj#=-1 tim=1446296777339913
WAIT #3: nam='control file parallel write' ela= 8327 files=2 block#=281 requests=2 obj#=-1 tim=1446296777348493
WAIT #3: nam='control file parallel write' ela= 340 files=2 block#=18 requests=2 obj#=-1 tim=1446296777348897
WAIT #3: nam='control file parallel write' ela= 293 files=2 block#=16 requests=2 obj#=-1 tim=1446296777349217
WAIT #3: nam='control file parallel write' ela= 289 files=2 block#=1 requests=2 obj#=-1 tim=1446296777349531
WAIT #3: nam='control file sequential read' ela= 7 file#=0 block#=1 blocks=1 obj#=-1 tim=1446296777349554
WAIT #3: nam='control file sequential read' ela= 77 file#=0 block#=23 blocks=1 obj#=-1 tim=1446296777365937
WAIT #3: nam='control file sequential read' ela= 12930 file#=0 block#=181 blocks=1 obj#=-1 tim=1446296777378929
WAIT #3: nam='control file sequential read' ela= 19939 file#=0 block#=309 blocks=1 obj#=-1 tim=1446296777422063
WAIT #3: nam='control file sequential read' ela= 18 file#=0 block#=281 blocks=1 obj#=-1 tim=1446296777446057
WAIT #3: nam='control file parallel write' ela= 341 files=2 block#=310 requests=2 obj#=-1 tim=1446296777446470
WAIT #3: nam='control file sequential read' ela= 520 file#=0 block#=283 blocks=1 obj#=-1 tim=1446296777447014
WAIT #3: nam='control file sequential read' ela= 11495 file#=0 block#=519 blocks=1 obj#=-1 tim=1446296777459545
WAIT #3: nam='control file sequential read' ela= 17 file#=0 block#=281 blocks=1 obj#=-1 tim=1446296777459856
WAIT #3: nam='control file parallel write' ela= 12696 files=2 block#=520 requests=2 obj#=-1 tim=1446296777472579
WAIT #3: nam='control file parallel write' ela= 293 files=2 block#=17 requests=2 obj#=-1 tim=1446296777473101
WAIT #3: nam='control file parallel write' ela= 336 files=2 block#=15 requests=2 obj#=-1 tim=1446296777473462
WAIT #3: nam='control file parallel write' ela= 416 files=2 block#=1 requests=2 obj#=-1 tim=1446296777473902
WAIT #3: nam='control file sequential read' ela= 7 file#=0 block#=1 blocks=1 obj#=-1 tim=1446296777473929
WAIT #3: nam='rdbms ipc reply' ela= 700 from_process=10 timeout=910 p3=0 obj#=-1 tim=1446296777492487
WAIT #3: nam='rdbms ipc reply' ela= 8099 from_process=11 timeout=1800 p3=0 obj#=-1 tim=1446296777501110
WAIT #3: nam='control file sequential read' ela= 6 file#=0 block#=1 blocks=1 obj#=-1 tim=1446296777501170
WAIT #3: nam='control file sequential read' ela= 4 file#=0 block#=16 blocks=1 obj#=-1 tim=1446296777501191
WAIT #3: nam='control file sequential read' ela= 4 file#=0 block#=18 blocks=1 obj#=-1 tim=1446296777501206
WAIT #3: nam='rdbms ipc reply' ela= 521 from_process=12 timeout=2147483647 p3=0 obj#=-1 tim=1446296777501843
WAIT #3: nam='control file sequential read' ela= 6 file#=0 block#=1 blocks=1 obj#=-1 tim=1446296777502027
WAIT #3: nam='control file sequential read' ela= 5 file#=1 block#=1 blocks=1 obj#=-1 tim=1446296777502047
WAIT #3: nam='control file sequential read' ela= 4 file#=0 block#=16 blocks=1 obj#=-1 tim=1446296777502062
WAIT #3: nam='control file sequential read' ela= 4 file#=0 block#=18 blocks=1 obj#=-1 tim=1446296777502076
WAIT #3: nam='control file sequential read' ela= 6 file#=0 block#=281 blocks=1 obj#=-1 tim=1446296777502096

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30496894/viewspace-1825223/,如需轉載,請註明出處,否則將追究法律責任。

相關文章