打开sql trace,跟踪数据库的打开过程
SQL> startup mount ORACLE instance started. Total System Global Area 771747984 bytes Fixed Size 8900752 bytes Variable Size 629145600 bytes Database Buffers 125829120 bytes Redo Buffers 7872512 bytes Database mounted. SQL> alter session set sql_trace=true; Session altered. SQL> alter database open; Database altered. SQL> alter session set sql_trace=false; Session altered.
通过tkprof对跟踪文件进行格式化:
$ ls -l orcl_ora_23818.* -rw-r----- 1 oracle oinstall 5707447 Apr 26 16:05 orcl_ora_23818.trc -rw-r----- 1 oracle oinstall 701368 Apr 26 16:05 orcl_ora_23818.trm [oracle@oracle18 trace]$ tkprof orcl_ora_23818.trc output = bootstrap.txt TKPROF: Release 18.0.0.0.0 - Development on Mon Apr 26 16:11:44 2021 Copyright (c) 1982, 2018, Oracle and/or its affiliates. All rights reserved. [oracle@oracle18 trace]$ vi bootstrap.txt
创建了一个bootstrap$的表,从file 1 block 520中读取数据到内存表中
create table bootstrap$ ( line# number not null, obj# number not null, sql_text varchar2(4000) not null) storage (initial 50K objno 59 extents (file 1 block 520))
查看file 1 block 520中的对象:
SQL> select segment_name,block_id from dba_extents where block_id=520 and file_id=1; SEGMENT_NAME BLOCK_ID -------------------------------------------------------------------------------------------------------------------------------- ---------- BOOTSTRAP$ 520 SQL>
查看bootstrap$表中内容:
SQL> select * from bootstrap$ where rownum <5; LINE# OBJ# ---------- ---------- SQL_TEXT -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -1 -1 8.0.0.0.0 0 0 CREATE ROLLBACK SEGMENT SYSTEM STORAGE ( INITIAL 112K NEXT 56K MINEXTENTS 1 MAXEXTENTS 32765 OBJNO 0 EXTENTS (FILE 1 BLOCK 128)) 16 16 CREATE TABLE TS$("TS#" NUMBER NOT NULL,"NAME" VARCHAR2(30) NOT NULL,"OWNER#" NUMBER NOT NULL,"ONLINE$" NUMBER NOT NULL,"CONTENTS$" NUMBER NOT NULL,"UNDOFILE#" NUMBER,"UNDOBLOCK#" NUMBER,"BLOCKSIZE" NU MBER NOT NULL,"INC#" NUMBER NOT NULL,"SCNWRP" NUMBER,"SCNBAS" NUMBER,"DFLMINEXT" NUMBER NOT NULL,"DFLMAXEXT" NUMBER NOT NULL,"DFLINIT" NUMBER NOT NULL,"DFLINCR" NUMBER NOT NULL,"DFLMINLEN" NUMBER NOT LINE# OBJ# ---------- ---------- SQL_TEXT -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- NULL,"DFLEXTPCT" NUMBER NOT NULL,"DFLOGGING" NUMBER NOT NULL,"AFFSTRENGTH" NUMBER NOT NULL,"BITMAPPED" NUMBER NOT NULL,"PLUGGED" NUMBER NOT NULL,"DIRECTALLOWED" NUMBER NOT NULL,"FLAGS" NUMBER NOT NULL ,"PITRSCNWRP" NUMBER,"PITRSCNBAS" NUMBER,"OWNERINSTANCE" VARCHAR2(30),"BACKUPOWNER" VARCHAR2(30),"GROUPNAME" VARCHAR2(30),"SPARE1" NUMBER,"SPARE2" NUMBER,"SPARE3" VARCHAR2(1000),"SPARE4" DATE) STORAGE ( OBJNO 16 TABNO 2) CLUSTER C_TS#(TS#) 45 45 CREATE UNIQUE INDEX I_TS1 ON TS$(NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE ( INITIAL 64K NEXT 1024K MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 OBJNO 45 EXTENTS (FILE 1 BLOCK 408))
可以看到bootstrap表 记 录 的 都 是 创 建 数 据 库 对 象 的 语 句 , 如 果 b o o t s t r a p 表记录的都是创建数据库对象的语句,如果bootstrap表记录的都是创建数据库对象的语句,如果bootstrap表出问题,数据库将无法启动
SQL> select count(*) from bootstrap$; COUNT(*) ---------- 60 SQL> select count(*) from bootstrap$ where SQL_TEXT like 'CREATE %'; COUNT(*) ---------- 59
除了第一条之外,剩下59条是创建数据库对象。