分类: Oracle
2010-03-26 07:12:03
Oracle的启动过程共经历四个阶段:
shutdown→nomount→mount→open
shutdown→nomount过程:
读初始参数文件
分配物理内存
启动后台进程
定位到控制文件
打开/写alert文件
nomount过程可以访问的动态性能视图:v$parameter,v$sga,v$option,v$process,v$version,v$instance
nomount→mount过程:
打开控制文件
确认 database的结构信息
mount过程可以访问的动态性能视图: v$thread,v$controlfile,v$database,v$datafile,v$datafile_header,v$logfile
以下任务必须在mount状态下进行:
命名数据文件
启用和禁用重作日志归档选项
执行完全数据库恢复
mount→open过程:
打开数据文件
打开重做日志文件
最后阶段中,oracle服务器验证所有数据文件和重做日志文件是否可以打开,并检查数据库的一致性,如果需要,smon进程会启动例程恢复。
自上而下:
shutdown:
nomount:读取初始化参数,并且分配物理内存,通过初始化参数定位到control file,后台进程启动,写alter文件,如果alter文件不存在将创建它
SQL> startup nomount
ORACLE 例程已经启动。
Total System Global Area 167772160 bytes
Fixed Size 1247900 bytes
Variable Size 83887460 bytes
Database Buffers 79691776 bytes
Redo Buffers 2945024 bytes
altert文件中内容:
Fri Dec 28 11:34:06 2007
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
Picked latch-free SCN scheme 2
Using LOG_ARCHIVE_DEST_10 parameter default value as USE_DB_RECOVERY_FILE_DEST
Autotune of undo retention is turned on.
IMODE=BR
ILAT =18
LICENSE_MAX_USERS = 0
SYS auditing is disabled
ksdpec: called for event 13740 prior to event group initialization
Starting up ORACLE RDBMS Version: 10.2.0.1.0.
System parameters with non-default values:
processes = 150
__shared_pool_size = 75497472
__large_pool_size = 4194304
__java_pool_size = 4194304
__streams_pool_size = 0
spfile = E:\ORACLE\PRODUCT\10.2.0\DB_2\DBS\SPFILEORCL.ORA
sga_target = 167772160
control_files = E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL01.CTL, E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL02.CTL, E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL03.CTL
db_block_size = 8192
__db_cache_size = 79691776
compatible = 10.2.0.1.0
db_file_multiblock_read_count= 16
db_recovery_file_dest = E:\oracle\product\10.2.0/flash_recovery_area
db_recovery_file_dest_size= 2147483648
undo_management = AUTO
undo_tablespace = UNDOTBS1
remote_login_passwordfile= EXCLUSIVE
db_domain =
dispatchers = (PROTOCOL=TCP) (SERVICE=orclXDB)
job_queue_processes = 10
audit_file_dest = E:\ORACLE\PRODUCT\10.2.0\ADMIN\ORCL\ADUMP
background_dump_dest = E:\ORACLE\PRODUCT\10.2.0\ADMIN\ORCL\BDUMP
user_dump_dest = E:\ORACLE\PRODUCT\10.2.0\ADMIN\ORCL\UDUMP
core_dump_dest = E:\ORACLE\PRODUCT\10.2.0\ADMIN\ORCL\CDUMP
db_name = orcl
open_cursors = 300
pga_aggregate_target = 16777216
PMON started with pid=2, OS id=3280
PSP0 started with pid=3, OS id=2972
MMAN started with pid=4, OS id=2280
DBW0 started with pid=5, OS id=828
LGWR started with pid=6, OS id=1936
CKPT started with pid=7, OS id=3844
SMON started with pid=8, OS id=596
RECO started with pid=9, OS id=3252
CJQ0 started with pid=10, OS id=1932
MMON started with pid=11, OS id=3788
Fri Dec 28 11:34:17 2007
starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
MMNL started with pid=12, OS id=928
Fri Dec 28 11:34:17 2007
starting up 1 shared server(s) ...
在nomount状态:
可以访问到实例
SQL> select * from v$instance;
INSTANCE_NUMBER INSTANCE_NAME HOST_NAME
--------------- -------------------------------- -------------------------------
1 orcl ORACLE10G
可以访问到后台进程
select * from v$bgprocess;
可以访问到内存结构
SQL> select * from v$sga;
NAME VALUE
---------------------------------------- ----------
Fixed Size 1247900
Variable Size 83887460
Database Buffers 79691776
Redo Buffers 2945024
但不可以访问database结构
SQL> select * from v$database;
select * from v$database
*
第 1 行出现错误:
ORA-01507: ??????
mount:读并打开控制文件,并确认到database的结构信息
SQL> alter database mount
2 /
数据库已更改。
SQL> select * from v$database;
DBID NAME CREATED RESETLOGS_CHANGE# RESETLOGS_TIME PRIOR_RESETLOGS_CHANGE# PRIOR_RESE
---------- --------- -------------- ----------------- --------------
1170053590 ORCL 25-12? -07 534907 25-12? -07 1 30-8? -05 ARCHIVELOG
可以找到有什么样的表空间
SQL> select * from v$tablespace;
TS# NAME INC BIG
---------- ------------------------------ --- --- --- ---
0 SYSTEM YES NO YES
1 UNDOTBS1 YES NO YES
2 SYSAUX YES NO YES
4 USERS YES NO YES
3 TEMP NO NO YES
6 EXAMPLE YES NO YES
已选择6行。
有什么样的数据文件组成:
SQL> select * from v$datafile
2 /
FILE# CREATION_CHANGE# CREATION_TIME TS# RFILE# STATUS ENABLED CHECKPOINT_CHANGE# CHECK
------- ---------------- -------------- ---------- ---------- ------- ---------- ----------------
1 9 30-8? -05 0 1 SYSTEM READ WRITE 777989 28-12? -07
2 532340 30-8? -05 1 2 ONLINE READ WRITE 777989 28-12? -07
3 6100 30-8? -05 2 3 ONLINE READ WRITE 777989 28-12? -07
4 9769 30-8? -05 4 4 ONLINE READ WRITE 777989 28-12? -07
5 559801 25-12? -07 6 5 ONLINE READ WRITE 777989 28-12? -07
有什么样的日志文件组成:
SQL> select * from v$logfile;
行将被截断
GROUP# STATUS TYPE MEMBER
---------- ------- ------- ----------------------------------------------------------
3 ONLINE E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG
2 ONLINE E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG
1 ONLINE E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG
在这个状态用户表还不能打开
open:所有文件被打开,并确认database状态
SQL> alter database open;
数据库已更改。