|
最初由 eygle 发布
[B]
你所论述的其他问题都和前面的讨论差别不大。
关键就在于最后这一句。
如果bootstrap$的位置是可以修改的。
那么Oracle是怎样找到这个对象的?
显然在源程序里不会标记这个位置。
那么还能怎么办呢?
我猜测Oracle是启动时到数据文件上去找的
你可以试试看把SYSTEM表空间建的大一些,比如搞个2G,把bootstrap$放到后面去,看看启动时,速度是不是慢了 [/B]
Root dba: This field only occurs in data file #1, and is the location of blocks required
during bootstrapping the data dictionary (bootstrap$)
不过从我的测试系统上开来, root DBA 都是指向一个以数字命名的segment_type为cache的segment..
本机测试机相关dump
file_hdrs level 10
FILE HEADER:
Software vsn=153092096=0x9200000, Compatibility Vsn=134217728=0x8000000
Db ID=1073838953=0x40017b69, Db Name='WEBORA9'
Activation ID=0=0x0
Control Seq=3091=0xc13, File size=62720=0xf500
File Number=1, Blksiz=8192, File Type=3 DATA
Tablespace #0 - SYSTEM rel_fn:1
Creation at scn: 0x0000.0000000b 05/12/2002 16:17:58
Backup taken at scn: 0x0000.00000000 01/01/1988 00:00:00 thread:0
reset logs count:0x2177cb2a scn: 0x0000.0002e872 recovered at 10/30/2006 14:44:18
status:0x4 root dba:0x004001a1 chkpt cnt: 634 ctl cnt:633
begin-hot-backup file size: 0
-----------------------------------------------------------------------------------------------------------------
root dba对应的segment以及bootstrap$对应的file/block
SQL> select * from dba_extents where file_id = 1 and block_id between 417 and 41
7 + blocks - 1;
OWNER
------------------------------
SEGMENT_NAME
--------------------------------------------------------------------------------
PARTITION_NAME SEGMENT_TYPE TABLESPACE_NAME
------------------------------ ------------------ ------------------------------
EXTENT_ID FILE_ID BLOCK_ID BYTES BLOCKS RELATIVE_FNO
---------- ---------- ---------- ---------- ---------- ------------
SYS
1.417
CACHE SYSTEM
0 1 417 65536 8 1
SQL>
SQL> select * from dba_extents where segment_name = 'BOOTSTRAP$';
OWNER
------------------------------
SEGMENT_NAME
--------------------------------------------------------------------------------
PARTITION_NAME SEGMENT_TYPE TABLESPACE_NAME
------------------------------ ------------------ ------------------------------
EXTENT_ID FILE_ID BLOCK_ID BYTES BLOCKS RELATIVE_FNO
---------- ---------- ---------- ---------- ---------- ------------
SYS
BOOTSTRAP$
TABLE SYSTEM
0 1 377 65536 8 1
SQL>
------------------------------------------------------------------------------------------------------------------------
dump of datafile block 1/417(block of root dba)
Start dump data blocks tsn: 0 file#: 1 minblk 417 maxblk 417
WAIT #1: nam='db file sequential read' ela= 10508 p1=1 p2=417 p3=1
buffer tsn: 0 rdba: 0x004001a1 (1/417)
scn: 0x0006.c7cc8304 seq: 0x01 flg: 0x04 tail: 0x83040d01
frmt: 0x02 chkval: 0xc750 type: 0x0d=Compatibility segment
Header: size 12 next rdba 0x0 entries 53 offset 1096f
Compatibility entry for 'COMPATSG':
Size: 24 Release 0x134217728 By 0x153092096
Dump of memory from 0x04BF3034 to 0x04BF3038
4BF3030 00000000 [....]
Compatibility entry for 'BOOTSTRP':
Size: 24 Release 0x134217728 By 0x153092096
Dump of memory from 0x04BF304C to 0x04BF3050
4BF3040 00400179 [y.@.]
Compatibility entry for 'UNDODATA':
Size: 36 Release 0x153092096 By 0x153092096
Dump of memory from 0x04BF3064 to 0x04BF3074
00400179 对应file_id = 1 , block_id = 377的DBA address.
--------------------------------------------------------------------------------------------------------------------
sql trace of database open
PARSING IN CURSOR #1 len=19 dep=0 uid=0 oct=35 lid=0 tim=81522298189 hv=1991530103 ad='7a7c0474'
ALTER DATABASE OPEN
END OF STMT
PARSE #1:c=0,e=2647,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=4,tim=81522298177
BINDS #1:
WAIT #1: nam='control file sequential read' ela= 268 p1=0 p2=1 p3=1
WAIT #1: nam='control file sequential read' ela= 229 p1=1 p2=1 p3=1
WAIT #1: nam='control file sequential read' ela= 356 p1=2 p2=1 p3=1
WAIT #1: nam='control file sequential read' ela= 232 p1=0 p2=240 p3=1
WAIT #1: nam='control file sequential read' ela= 213 p1=0 p2=1 p3=1
WAIT #1: nam='control file sequential read' ela= 218 p1=1 p2=1 p3=1
WAIT #1: nam='control file sequential read' ela= 253 p1=2 p2=1 p3=1
WAIT #1: nam='control file sequential read' ela= 243 p1=0 p2=240 p3=1
WAIT #1: nam='rdbms ipc reply' ela= 101866 p1=3 p2=910 p3=0
WAIT #1: nam='control file sequential read' ela= 290 p1=0 p2=1 p3=1
WAIT #1: nam='control file sequential read' ela= 195 p1=1 p2=1 p3=1
WAIT #1: nam='control file sequential read' ela= 212 p1=2 p2=1 p3=1
WAIT #1: nam='control file sequential read' ela= 226 p1=0 p2=240 p3=1
WAIT #1: nam='control file sequential read' ela= 21733 p1=0 p2=11 p3=1
WAIT #1: nam='direct path read' ela= 22 p1=1 p2=1 p3=1
WAIT #1: nam='direct path read' ela= 3 p1=2 p2=1 p3=1
WAIT #1: nam='direct path read' ela= 2 p1=3 p2=1 p3=1
WAIT #1: nam='direct path read' ela= 2 p1=4 p2=1 p3=1
WAIT #1: nam='direct path read' ela= 2 p1=8 p2=1 p3=1
WAIT #1: nam='direct path read' ela= 2 p1=201 p2=1 p3=1
这一段是读取数据文件头的信息..
FILE# NAME
---------- --------------------------------------------------
3 D:\ORACLE\ORADATA\WEBORA9\APPDATA1K01.DBF
4 D:\ORACLE\ORADATA\WEBORA9\TEST01.DBF
2 D:\ORACLE\ORADATA\WEBORA9\UNDOTBS01.DBF
8 D:\ORACLE\ORADATA\WEBORA9\TOOLS01.DBF
1 D:\ORACLE\ORADATA\WEBORA9\SYSTEM01.DBF
WAIT #1: nam='rdbms ipc reply' ela= 13887 p1=3 p2=2147483647 p3=0
WAIT #1: nam='control file sequential read' ela= 204 p1=0 p2=1 p3=1
WAIT #1: nam='control file sequential read' ela= 190 p1=1 p2=1 p3=1
WAIT #1: nam='control file sequential read' ela= 206 p1=2 p2=1 p3=1
WAIT #1: nam='control file sequential read' ela= 198 p1=0 p2=240 p3=1
[color]WAIT #1: nam='db file sequential read' ela= 23087 p1=1 p2=417 p3=1
WAIT #1: nam='rdbms ipc reply' ela= 287223 p1=4 p2=910 p3=0
WAIT #1: nam='control file sequential read' ela= 207 p1=0 p2=1 p3=1
WAIT #1: nam='control file sequential read' ela= 180 p1=1 p2=1 p3=1
WAIT #1: nam='control file sequential read' ela= 179 p1=2 p2=1 p3=1
WAIT #1: nam='control file sequential read' ela= 245 p1=0 p2=239 p3=1
WAIT #1: nam='db file sequential read' ela= 144903 p1=1 p2=417 p3=1
WAIT #1: nam='db file sequential read' ela= 25062 p1=1 p2=377 p3=1
这段为读取root dba以及根据root dba对应的block的信息得到的bootstrap$对应的存储位置的信息
=====================
PARSING IN CURSOR #2 len=188 dep=1 uid=0 oct=1 lid=0 tim=81523003167 hv=0 ad='4c1de24'
create table bootstrap$ ( line# number not null, obj# number not null, sql_text varchar2(4000) not null) storage (initial 50K objno 56 extents (file 1 block 377))
END OF STMT
PARSE #2:c=0,e=558,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,tim=81523003157
BINDS #2:
EXEC #2:c=0,e=4166,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,tim=81523026706
=====================
根据上面的dump信息可以这么推理..
1. 系统启动的时候根据control file的信息, 得到各个数据文件的位置.
2. 根据file# = 1 (system tablespace的第一个数据文件)的文件头的信息得到root dba的地址(此处为file_id = 1 ,block_id = 417
3. 根据root dba的信息, 得到bootstrap$对应的segment的存储位置, (此处为file_id = 1, block_id = 377) 得到系统启动的那只母鸡
4. 根据bootstrap$表中的信息, 得到系统中系统表的创建信息, 完成母鸡生下主要的小鸡的过程..
5.处理主要表生成之后的进一步处理, 生成主要的数据字典信息, 以及启动相关的undo segment(rollback segments).
6. 数据库启动完毕.. |
|