解析bootstrap$表

打开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条是创建数据库对象。

姚远ACE CSDN认证博客专家 ACE 华为云 MVP
Oracle ACE,华为云 MVP,Oracle10g,12c OCM; MySQL 5.6,5.7,8.0 OCP;CCNA; EMC Certified; IBM P Certified; RHCE; SQLServer 764; DB2 Certified; TOEIC 890;获得过两次国家部级科技进步奖;发明过两项计算机专利。微信:yaoyuanace 邮箱:yaoyuanace(at)qq.com
相关推荐
©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页