oracle数据库启动时,经历了三个过程:(用命名如下)startup nomount;alter database mount; alter database open;当然数据库关
oracle数据库启动时,经历了三个过程:(用命名如下)
startup nomount;
alter database mount; alter database open;
当然数据库关闭时也是经历了三个相反的过程:
alter database close;
alter database dismount;
shutdown;(shutdown 后面跟了四个参数:normal;immediate;transactional;abort)
四种方式关闭数据库的比较:
(no yes)
关闭方式aitn
允许新的连接nnnn
等待活动会话终止nnny
等待活动事务终止nn
yy强制进行checkpoint,关闭所有文件nyyy
分析第一个过程startup nomount:
这个过程数据库首先到参数文件(pfile/spfile)中读取数据库的设置,创建实例.
数据库所在的操作系统版本:
[oracle@localhost ~]$ lsb_release -a
lsb version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
distributor id: enterpriseenterpriseserver
description: enterprise linux enterprise linux server release 5.5 (carthage)
release: 5.5
codename: carthage
数据库版本:
sql> select * from v$version where rownum=1;
banner
--------------------------------------------------------------------------------
oracle database 11g enterprise edition release 11.2.0.1.0 - production
因为spfile是二进制文件,不能直接读取,在linux中,可以用命令string转储出来:
[oracle@localhost dbs]$ strings spfileorcl3939.ora
orcl3939.__db_cache_size=54525952
orcl3939.__java_pool_size=4194304
orcl3939.__large_pool_size=4194304
orcl3939.__oracle_base='/u01/app/oracle'#oracle_base set from environment
orcl3939.__pga_aggregate_target=171966464
orcl3939.__sga_target=251658240
orcl3939.__shared_io_pool_size=0
orcl3939.__shared_pool_size=176160768
orcl3939.__streams_pool_size=4194304
*.audit_file_dest='/u01/app/oracle/admin/orcl3939/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/o
racle/oradata/orcl3939/control01.ctl','/u01/app/oracle/flash_recovery_area/orcl3939/control02.ctl','/u01/app/oracle/oradata/orcl3939/control03.ctl'
*.db_block_size=8192
*.db_domain='localdomain'
*.db_name='orcl3939'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4039114752
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(protocol=tcp) (service=orcl3939xdb)'
*.instance_name='orcl3939'
*.local_listener='(address=(protocol=tcp)(host = local
host.localdomain)(port = 1521))'
*.memory_target=423624704
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='exclusive'
*.service_names='a,b,c,d'
*.trace_enabled=true
*.undo_tablespace='undotbs1'
spfile文件中你可以看到数据库在nomount时做了些什么,根据参数文件的内容,创建了instance,分配了相应的内存区域,启动了相应的后台进程。
我们再看告警日志文件(alert_.log):读取了参数文件,启动了实例
starting up:
oracle database 11g enterprise edition release 11.2.0.1.0 - production
with the partitioning, olap, data mining and real application testing options.
using parameter settings in server-side spfile /u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfileorcl3939.ora
system parameters with non-default values:
processes = 150
memory_target = 404m
control_files = /u01/app/oracle/oradata/orcl3939/control01.ctl
control_files = /u01/app/oracle/flash_recovery_area/orcl3939/control02.ctl
control_files = /u01/app/oracle/oradata/orcl3939/control03.ctl
db_block_size = 8192
compatible = 11.2.0.0.0
db_recovery_file_dest = /u01/app/oracle/flash_recovery_area
db_recovery_file_dest_size= 3852m
undo_tablespace = undotbs1
remote_login_passwordfile= exclusive
db_domain = localdomain
instance_name = orcl3939
service_names = a,b,c,d
dispatchers = (protocol=tcp) (service=orcl3939xdb)
local_listener = (address=(protocol=tcp)(host = localhost.localdomain)(port = 1521))
audit_file_dest = /u01/app/oracle/admin/orcl3939/adump
audit_trail = db
db_name = orcl3939
open_cursors = 300
diagnostic_dest = /u01/app/oracle
trace_enabled = true
thu apr 02 14:59:41 2015
pmon started with pid=2, os id=5989
thu apr 02 14:59:41 2015
vktm started with pid=3, os id=5991 at elevated priority
vktm running at (10)millisec precision with dbrm quantum (100)ms
thu apr 02 14:59:41 2015
gen0 started with pid=4, os id=5995
thu apr 02 14:59:41 2015
diag started with pid=5, os id=5997
thu apr 02 14:59:41 2015
dbrm started with pid=6, os id=5999
thu apr 02 14:59:41 2015
psp0 started with pid=7, os id=6001
thu apr 02 14:59:41 2015
dia0 started with pid=8, os id=6003
thu apr 02 14:59:41 2015
mman started with pid=9, os id=6005
thu apr 02 14:59:41 2015
dbw0 started with pid=10, os id=6007
thu apr 02 14:59:41 2015
lgwr started with pid=11, os id=6009
thu apr 02 14:59:41 2015
ckpt started with pid=12, os id=6011
thu apr 02 14:59:41 2015
smon started with pid=13, os id=6013
thu apr 02 14:59:41 2015
reco started with pid=14, os id=6015
thu apr 02 14:59:41 2015
mmon started with pid=15, os id=6017
thu apr 02 14:59:41 2015
mmnl started with pid=16, os id=6019
starting up 1 dispatcher(s) for network address '(address=(partial=yes)(protocol=tcp))'...
starting up 1 shared server(s) ...
oracle_base from environment = /u01/app/oracle