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)
关闭方式 A I T N
允许新的连接 N N N N
等待活动会话终止 N N N Y
等待活动事务终止 N N
强制进行checkpoint,关闭所有文件 N Y Y Y
分析第一个过程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