ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle 的启动过程分析与数据恢复(一)

oracle 的启动过程分析与数据恢复(一)

原创 Linux操作系统 作者:parameters 时间:2011-08-19 15:03:04 0 删除 编辑
为了能够详细分析了解oracle启动过程,下面进行一下分析;
环境:centos 5.3 ,oracle databae 10gr2
SQL> startup mount
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE instance started.
Total System Global Area  310378496 bytes
Fixed Size                  1219136 bytes
Variable Size             117441984 bytes
Database Buffers          188743680 bytes
Redo Buffers                2973696 bytes
Database mounted.
SQL> alter session set sql_trace=true;
Session altered.
SQL> alter database open;
Database altered.
然后找到相应的 trc文件 ,使用ultraedit 打开,先看第一部分:
--------------------------------------
Release:    2.6.18-128.el5
Version:    #1 SMP Wed Jan 21 10:44:23 EST 2009
Machine:    i686
Instance name: parameter
Redo thread mounted by this instance: 1
Oracle process number: 15
Unix process pid: 3282, image: oracle@localhost.localdomain (TNS V1-V3)

*** 2011-08-19 14:52:17.507
*** SERVICE NAME:() 2011-08-19 14:52:17.506
*** SESSION ID:(159.3) 2011-08-19 14:52:17.506
=====================
PARSING IN CURSOR #1 len=32 dep=0 uid=0 ct=42 lid=0 tim=1282946032720798 hv=1569151342 ad='3231e314'
alter session set sql_trace=true
END OF STMT
EXEC #1:c=1000,e=1028,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=1,tim=1282946032720783
XCTEND rlbk=0, rd_only=1
=====================
PARSING IN CURSOR #1 len=19 dep=0 uid=0 ct=35 lid=0 tim=1282946040907949 hv=1907384048 ad='3231e078'
alter database open
END OF STMT
PARSE #1:c=1000,e=965,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=1,tim=1282946040907936
=====================
PARSING IN CURSOR #2 len=188 dep=1 uid=0 ct=1 lid=0 tim=1282946040976614 hv=1365064427 ad='3231bcd4'
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=2000,e=1372,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,tim=1282946040976601
EXEC #2:c=0,e=416,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,tim=1282946040977166
=====================
PARSING IN CURSOR #2 len=55 dep=1 uid=0 ct=3 lid=0 tim=1282946040978440 hv=2111436465 ad='3231b560'
---------------------------------------------------
oracle 的第一步骤是 创建了 表 bootstrap$,虽然它的操作是 create ,实际上并没有真正的创建,而是重新使用了相关的segment 中的block;
下面来看看bootstra$中到底有什么;
select rowid,
dbms_rowid.rowid_relative_fno(rowid) RFILE#,
dbms_rowid.rowid_block_number(rowid) BLOCK#,
dbms_rowid.rowid_row_number(rowid) ROW#,
t.*from  bootstrap$ t;
从返回的结果知道,bootstrap$的block的从378 开始是存放数据,第377是segmentheader,注意系统表空间还不是assm管理方式,其实从上面的sql也可以知道;使用bbed 查看相关的block;
[oracle@localhost ~]$ bbed parfile=bbed.par
Password:
BBED: Release 2.0.0.0.0 - Limited Production on Fri Aug 19 15:20:14 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> set block 378
        BLOCK#          378
BBED> find /c CREATE
 File: /data/paramete/system01.dbf (1)
 Block: 378              Offsets: 1302 to 1813           Dba:0x0040017a
------------------------------------------------------------------------
 43524541 54452049 4e444558 20495f54 5323204f 4e20434c 55535445 5220435f
 54532320 50435446 52454520 31302049 4e495452 414e5320 32204d41 58545241
 4e532032 35352053 544f5241 47452028 2020494e 49544941 4c203634 4b204e45
 58542031 3032344b 204d494e 45585445 4e545320 31204d41 58455854 454e5453
 20323134 37343833 36343520 50435449 4e435245 41534520 30204f42 4a4e4f20
 37204558 54454e54 53202846 494c4520 3120424c 4f434b20 36352929 2c010302
 c10702c1 07c64352 45415445 20434c55 53544552 20435f54 53232822 54532322
 204e554d 42455229 20504354 46524545 20313020 50435455 53454420 34302049
 4e495452 414e5320 32204d41 58545241 4e532032 35352053 544f5241 47452028
 2020494e 49544941 4c203634 4b204e45 58542031 3032344b 204d494e 45585445
 4e545320 31204d41 58455854 454e5453 20323134 37343833 36343520 50435449
 4e435245 41534520 30204f42 4a4e4f20 36204558 54454e54 53202846 494c4520
 3120424c 4f434b20 35372929 2c010302 c10f02c1 0ffe3202 43524541 54452054
 41424c45 20534547 24282246 494c4523 22204e55 4d424552 204e4f54 204e554c
 4c2c2242 4c4f434b 2322204e 554d4245 52204e4f 54204e55 4c4c2c22 54595045
 2322204e 554d4245 52204e4f 54204e55 4c4c2c22 54532322 204e554d 42455220
 <32 bytes per line>
BBED> dump /v
 File: /data/paramete/system01.dbf (1)
 Block: 378     Offsets: 1302 to 1813  Dba:0x0040017a
-------------------------------------------------------
 43524541 54452049 4e444558 20495f54 l CREATE INDEX I_T
 5323204f 4e20434c 55535445 5220435f l S# ON CLUSTER C_
 54532320 50435446 52454520 31302049 l TS# PCTFREE 10 I
 4e495452 414e5320 32204d41 58545241 l NITRANS 2 MAXTRA
 4e532032 35352053 544f5241 47452028 l NS 255 STORAGE (
 2020494e 49544941 4c203634 4b204e45 l   INITIAL 64K NE
 58542031 3032344b 204d494e 45585445 l XT 1024K MINEXTE
 4e545320 31204d41 58455854 454e5453 l NTS 1 MAXEXTENTS
 20323134 37343833 36343520 50435449 l  2147483645 PCTI
 4e435245 41534520 30204f42 4a4e4f20 l NCREASE 0 OBJNO
 37204558 54454e54 53202846 494c4520 l 7 EXTENTS (FILE
 3120424c 4f434b20 36352929 2c010302 l 1 BLOCK 65)),...
 c10702c1 07c64352 45415445 20434c55 l .艭REATE CLU
 53544552 20435f54 53232822 54532322 l STER C_TS#("TS#"
 204e554d 42455229 20504354 46524545 l  NUMBER) PCTFREE
 20313020 50435455 53454420 34302049 l  10 PCTUSED 40 I
 4e495452 414e5320 32204d41 58545241 l NITRANS 2 MAXTRA
 4e532032 35352053 544f5241 47452028 l NS 255 STORAGE (
 2020494e 49544941 4c203634 4b204e45 l   INITIAL 64K NE
 58542031 3032344b 204d494e 45585445 l XT 1024K MINEXTE
 4e545320 31204d41 58455854 454e5453 l NTS 1 MAXEXTENTS
 20323134 37343833 36343520 50435449 l  2147483645 PCTI
 4e435245 41534520 30204f42 4a4e4f20 l NCREASE 0 OBJNO
 36204558 54454e54 53202846 494c4520 l 6 EXTENTS (FILE
 3120424c 4f434b20 35372929 2c010302 l 1 BLOCK 57)),...
 c10f02c1 0ffe3202 43524541 54452054 l ..CREATE T
 41424c45 20534547 24282246 494c4523 l ABLE SEG$("FILE#
 22204e55 4d424552 204e4f54 204e554c l " NUMBER NOT NUL
 4c2c2242 4c4f434b 2322204e 554d4245 l L,"BLOCK#" NUMBE
 52204e4f 54204e55 4c4c2c22 54595045 l R NOT NULL,"TYPE
 2322204e 554d4245 52204e4f 54204e55 l #" NUMBER NOT NU
 4c4c2c22 54532322 204e554d 42455220 l LL,"TS#" NUMBER

 <16 bytes per line>

看到block当中存放的主要就句是这些语句;

试想一下,如果是这些相关的block 发生损坏,那么oracle 是无法启动;此时会报 ora-00704 的错误;
通过以上分析后,你应该可以知道,在没有备份的情况下,如果修正这个错误了吧;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25656398/viewspace-705373/,如需转载,请注明出处,否则将追究法律责任。

上一篇: bbed的使用(二)
请登录后发表评论 登录
全部评论

注册时间:2011-04-07

  • 博文量
    45
  • 访问量
    48661