过着简单,真实的生活,喜欢收藏变形金刚(TFE,G1,SL系列),研究金融股市,KOF98,篮球,学习研究Oracle技术,我并不是一个全职的Oracle DBA,但是对于Oracle技术的热爱和研究,是一个不争的事实,愿意结交广大Oracle技术爱好者!MSN:oracle_kof_tf@hotmail.com

10g中也存在着CACHE对象

上一篇 / 下一篇  2008-03-22 20:00:56 / 个人分类:Oracle Reminder

对于Oracle独一无二的cache对象,在Oracle9i中一直是bootstrap$的一个引导block.
通过system表空间数据文件的File headers可以观察到cache对象的rdba.
那么这个特性在Oracle10g也是同样被延续下来的:

$ sqlplus /nolog

SQL*Plus: Release 10.2.0.3.0 - Production on Sun Mar 23 18:21:57 2008

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

SQL> conn / as sysdba;
Connected.
SQL> select comp_name,version from dba_registry;

COMP_NAME
----------------------------------------------------------------------------
VERSION
------------------------------
Oracle XML Database
10.2.0.3.0

Oracle Data Mining
10.2.0.3.0

OLAP Catalog
10.2.0.3.0


COMP_NAME
----------------------------------------------------------------------------
VERSION
------------------------------
Oracle Ultra Search
9.2.0.6.0

Oracle Text
10.2.0.3.0

Spatial
10.2.0.3.0


COMP_NAME
----------------------------------------------------------------------------
VERSION
------------------------------
Oracle interMedia
10.2.0.3.0

Oracle Workspace Manager
10.2.0.1.0

Oracle Database Catalog Views
10.2.0.3.0


COMP_NAME
----------------------------------------------------------------------------
VERSION
------------------------------
Oracle Database Packages and Types
10.2.0.3.0

JServer JAVA Virtual Machine
10.2.0.3.0

Oracle XDK
10.2.0.3.0


COMP_NAME
----------------------------------------------------------------------------
VERSION
------------------------------
Oracle Database Java Packages
10.2.0.3.0

OLAP Analytic Workspace
10.2.0.3.0

Oracle OLAP API
10.2.0.3.0

SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE    10.2.0.3.0      Production
TNS for IBM/AIX RISC System/6000: Version 10.2.0.3.0 - Productio
NLSRTL Version 10.2.0.3.0 - Production

现在转储一下system表空间的文件头:
SQL>alter session set events 'immediate trace name file_hdrs level 10'
找到其中部分内容
 V10 STYLE. FILE HEADER:
        Software vsn=153092096=0x9200000, Compatibility Vsn=134217728=0x8000000
        Db ID=3056348506=0xb62c2d5a, Db Name='IRMDB'
        Activation ID=0=0x0
        Control Seq=2151=0x867, File size=79360=0x13600
        File Number=1, Blksiz=8192, File Type=3 DATA
Tablespace #0 - SYSTEM  rel_fn:1
Creation   at   scn: 0x0000.0000000a 05/13/2002 02:16:30
Backup taken at scn: 0x0000.00000000 01/01/1988 00:00:00 thread:0
 reset logs count:0x25acbede scn: 0x0000.0002b85d reset logs terminal rcv data:0x0 scn: 0x0000.00000000
 prev reset logs count:0x1b856fc9 scn: 0x0000.00000001 prev reset logs terminal rcv data:0x0 scn: 0x0000.00000000
 recovered at 03/23/2008 14:56:50
 status:0x4root dba:0x004001a1chkpt cnt: 615 ctl cnt:614
begin-hot-backup file size: 0
Checkpointed at scn:  0x0000.052d9d31 03/23/2008 17:06:54
 thread:1 rba:(0x189.173b.10)
 enabled  threads:  01000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  00000000 00000000 00000000 00000000 00000000 00000000

看到这里有一个很重要的root dba:0x004001a1,通过root dba可以快速定位到bootstrap$的位置从而可以进一步通过recursive的SQL来在内存中创建对象从而来引导数据库的open.
分解这个root dba发现指向的是CACHE对象。
SQL> select dbms_utility.data_block_address_file(to_number('4001a1','xxxxxx')) file#,
  2         dbms_utility.data_block_address_block(to_number('4001a1','xxxxxx')) block#
  3  from dual;

     FILE#     BLOCK#
---------- ----------
         1        417

SQL> select segment_name,header_file,header_block from dba_segments
  2  where segment_type='CACHE';

SEGMENT_NAME
--------------------------------------------------------------------------------
HEADER_FILE HEADER_BLOCK
----------- ------------
1.417
          1          417

转储这个block
SQL> alter system dump datafile 1 block 417;

System altered.

......
Compatibility entry for 'COMPATSG':
   Size: 24  Release 0x134217728  By 0x153092096
Dump of memory from 0x0000000110416034 to 0x0000000110416038
110416030          00000000                        [....]
Compatibility entry for 'BOOTSTRP':
   Size: 24  Release 0x134217728  By 0x153092096
Dump of memory from 0x000000011041604C to 0x0000000110416050
110416040                           00400179              [.@.y]
Compatibility entry for 'UNDODATA':
   Size: 36  Release 0x153092096  By 0x153092096
Dump of memory from 0x0000000110416064 to 0x0000000110416074
110416060          00000053 00435870 05246BAE      [...S.CXp.$k.]
110416070 00003BC8                             [..;.]
......
发现00400179这个dba就是指向bootstrap$

通过上面的方法也不难得出bootstrap$位于数据文件1的第377个block
大体上就是这样。

因此可以得出一个结论在open database时,首先需要通过直接路径读取system表空间的root dba,进而通过单块读来获得datafile 1 block 417,并通过417块找到377这个bootstrap$的段头进而读取其中的内容,在内存中创建数据对象.所以我们可以看到System表空间中的数据文件是非常的重要。平时要做好备份,否则一旦损坏将很难恢复

TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

Open Toolbar