阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

深入剖析Oracle启动过程内部初始化

213次阅读
没有评论

共计 3683 个字符,预计需要花费 10 分钟才能阅读完成。

1 Oracle 启动选项;
Oracle 数据库在 startup 启动时,Oracle 将在默认位置 $ORACLE_HOME/dbs 中查找初始化参数文件;Oracle 以下面的顺序在其中寻找合适的初始化文件:

Spfile$ORACLE_SID.ora

Spfile.ora

Init$ORACLE_SID.ora
可以用几种方式启动 oracle 数据库,不同方式启动将影响启动数据库的程度,启动状态由 nomount(数据库未装载)——>mount(数据库完成装载)——>open(数据库打开)

1.1 STARTUP NOMOUNT;
SQL> startup nomount
ORACLE instance started.
 
Total System Global Area 1603411968 bytes
Fixed Size        2253664 bytes
Variable Size      1375734944 bytes
Database Buffers    218103808 bytes
Redo Buffers          7319552 bytes

Oracle 读参数文件,打开实例,启动 Oracle 后台进程, 给 Oracle 分配 SGA。此时数据库状态为未装载。

1.2 ALTER DATABASE MOUNT;
SQL> alter database mount;
 
Database altered.

Oracle 打开并读取控制文件,获取数据文件和重做日志文件的名称和位置。此时数据库完成装载。

1.3 ALTER DATABASE OPEN;
SQL> alter database open;
 
Database altered.

Oracle 打开数据文件和重做日志文件,至此 Oracle 可以对外提供服务。

2 通过 10046 事件查看内部启动过程
SQL> startup nomount;
 
Total System Global Area 1603411968 bytes
Fixed Size        2253664 bytes
Variable Size      1375734944 bytes
Database Buffers    218103808 bytes
Redo Buffers          7319552 bytes
SQL> oradebug setmypid
Statement processed.
SQL> oradebug tracefile_name
/oracle/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_3682.trc
SQL> alter session set events’10046 trace name context forever,level 12′;
 
Session altered.
SQL> alter database mount;
 
Database altered.
 
SQL> alter database open;
 
Database altered.

查看 udump 文件

[oracle@rhel6 ~]$ more /oracle/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_3682.trc

Trace file /oracle/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_3682.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /oracle/app/oracle/product/11.2.0
System name:    Linux
Node name:      rhel6
Release:        2.6.32-431.el6.x86_64
Version:        #1 SMP Sun Nov 10 22:19:54 EST 2013
Machine:        x86_64
VM name:        VMWare Version: 6
Instance name: orcl

Oracle 数据库 mount 启动读取控制文件,写日志文件


WAIT #140528657591192: nam=’control file sequential read’ ela= 8 file#=0 block#=1 blocks
=1 obj#=-1 tim=1502627703012561
WAIT #140528657591192: nam=’control file sequential read’ ela= 2 file#=1 block#=1 blocks
=1 obj#=-1 tim=1502627703012583
WAIT #140528657591192: nam=’control file sequential read’ ela= 47 file#=0 block#=3 block
s=8 obj#=-1 tim=1502627703012650
WAIT #140528657591192: nam=’control file sequential read’ ela= 13 file#=1 block#=3 block
s=8 obj#=-1 tim=1502627703012674

WAIT #140528657591192: nam=’ADR block file read’ ela= 847  =0  =0  =0 obj#=-1 tim=150262
7707123048
WAIT #140528657591192: nam=’ADR block file read’ ela= 576  =0  =0  =0 obj#=-1 tim=150262
7707124068
WAIT #140528657591192: nam=’ADR block file read’ ela= 562  =0  =0  =0 obj#=-1 tim=150262
7707125013
WAIT #140528657591192: nam=’ADR block file read’ ela= 473  =0  =0  =0 obj#=-1 tim=150262
7707125891

Oracle 数据库 open 过程读取控制文件信息,与读取磁盘数据文件头部进行对比
alter database open
END OF STMT
PARSE #140528657591192:c=0,e=274,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=1,plh=0,tim=1502627713
479605
WAIT #140528657591192: nam=’control file sequential read’ ela= 8 file#=0 block#=1 blocks
=1 obj#=-1 tim=1502627713479904
WAIT #140528657591192: nam=’control file sequential read’ ela= 4 file#=1 block#=1 blocks
=1 obj#=-1 tim=1502627713479922
WAIT #140528657591192: nam=’control file sequential read’ ela= 2 file#=0 block#=15 block
s=1 obj#=-1 tim=1502627713479931

WAIT #140528657591192: nam=’Disk file operations I/O’ ela= 11 FileOperation=2 fileno=1 f
iletype=2 obj#=-1 tim=1502627713481300
WAIT #140528657591192: nam=’Disk file operations I/O’ ela= 6 FileOperation=2 fileno=2 fi
letype=2 obj#=-1 tim=1502627713481317
WAIT #140528657591192: nam=’Disk file operations I/O’ ela= 4 FileOperation=2 fileno=3 fi
letype=2 obj#=-1 tim=1502627713481327
WAIT #140528657591192: nam=’Disk file operations I/O’ ela= 4 FileOperation=2 fileno=4 fi
letype=2 obj#=-1 tim=1502627713481338
WAIT #140528657591192: nam=’Disk file operations I/O’ ela= 5 FileOperation=2 fileno=201 
filetype=2 obj#=-1 tim=1502627713481351

更多 Oracle 相关信息见 Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-08/146250.htm

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计3683字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中