oracle 11g bootstrap$系列二
背景
基于上文: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
正文到此结束