微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

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>startupnomount
ORACLEinstancestarted.

TotalSystemGlobalArea1603411968bytes
FixedSize		2253664bytes
VariableSize		1375734944bytes
DatabaseBuffers	218103808bytes
Redobuffers		7319552bytes

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


1.2 ALTER DATABASE MOUNT;

sql>alterdatabasemount;

Databasealtered.

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


1.3 ALTER DATABASE OPEN;

sql>alterdatabaSEOpen;

Databasealtered.

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


2 通过10046事件查看内部启动过程

sql>startupnomount;

TotalSystemGlobalArea1603411968bytes
FixedSize		2253664bytes
VariableSize		1375734944bytes
DatabaseBuffers	218103808bytes
Redobuffers		7319552bytes
sql>oradebugsetmypid
Statementprocessed.
sql>oradebugtracefile_name
/oracle/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_3682.trc
sql>altersessionsetevents'10046tracenamecontextforever,level12';

Sessionaltered.
sql>alterdatabasemount;

Databasealtered.

sql>alterdatabaSEOpen;

Databasealtered.

查看udump文件

[oracle@rhel6~]$more/oracle/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_3682.trc
Tracefile/oracle/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_3682.trc
OracleDatabase11gEnterpriseEditionRelease11.2.0.4.0-64bitProduction
WiththePartitioning,OLAP,DataMiningandRealApplicationTestingoptions
ORACLE_HOME=/oracle/app/oracle/product/11.2.0
Systemname:Linux
Nodename:rhel6
Release:2.6.32-431.el6.x86_64
Version:#1SMPSunNov1022:19:54EST2013
Machine:x86_64
VMname:VMWareversion:6
Instancename:orcl

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

...
WAIT#140528657591192:nam='controlfilesequentialread'ela=8file#=0block#=1blocks
=1obj#=-1tim=1502627703012561
WAIT#140528657591192:nam='controlfilesequentialread'ela=2file#=1block#=1blocks
=1obj#=-1tim=1502627703012583
WAIT#140528657591192:nam='controlfilesequentialread'ela=47file#=0block#=3block
s=8obj#=-1tim=1502627703012650
WAIT#140528657591192:nam='controlfilesequentialread'ela=13file#=1block#=3block
s=8obj#=-1tim=1502627703012674
...
WAIT#140528657591192:nam='ADRblockfileread'ela=847=0=0=0obj#=-1tim=150262
7707123048
WAIT#140528657591192:nam='ADRblockfileread'ela=576=0=0=0obj#=-1tim=150262
7707124068
WAIT#140528657591192:nam='ADRblockfileread'ela=562=0=0=0obj#=-1tim=150262
7707125013
WAIT#140528657591192:nam='ADRblockfileread'ela=473=0=0=0obj#=-1tim=150262
7707125891
...

Oracle数据库open过程读取控制文件信息,与读取磁盘数据文件头部进行对比

alterdatabaSEOpen
ENDOFSTMT
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='controlfilesequentialread'ela=8file#=0block#=1blocks
=1obj#=-1tim=1502627713479904
WAIT#140528657591192:nam='controlfilesequentialread'ela=4file#=1block#=1blocks
=1obj#=-1tim=1502627713479922
WAIT#140528657591192:nam='controlfilesequentialread'ela=2file#=0block#=15block
s=1obj#=-1tim=1502627713479931
...
WAIT#140528657591192:nam='diskfileoperationsI/O'ela=11FileOperation=2fileno=1f
iletype=2obj#=-1tim=1502627713481300
WAIT#140528657591192:nam='diskfileoperationsI/O'ela=6FileOperation=2fileno=2fi
letype=2obj#=-1tim=1502627713481317
WAIT#140528657591192:nam='diskfileoperationsI/O'ela=4FileOperation=2fileno=3fi
letype=2obj#=-1tim=1502627713481327
WAIT#140528657591192:nam='diskfileoperationsI/O'ela=4FileOperation=2fileno=4fi
letype=2obj#=-1tim=1502627713481338
WAIT#140528657591192:nam='diskfileoperationsI/O'ela=5FileOperation=2fileno=201
filetype=2obj#=-1tim=1502627713481351

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐