Oracle DB启动,一共有三个阶段,分别为nomount,mount,open。
1、启动Oracle DB 实例:NOMOUNT
在创建数据库期间、重新创建控制文件期间,或执行某些备份和恢复方案期间,通常只在NOMOUNT模式下启动实例。
启动实例过程包括执行以下任务:
• 按以下顺序搜索$ORACLE_HOME/dbs中具有特定名称的文件:
1. 搜索spfile<SID>.ora。
2. 如果未找到spfile<SID>.ora,则搜索spfile.ora。
3. 如果未找到spfile.ora,则搜索init<SID>.ora。
这是包含实例初始化参数的文件。使用STARTUP指定PFILE参数可覆盖默认行为。
• 分配SGA
• 启动后台进程
• 打开alert_<SID>.log文件和跟踪文件
注:SID是用于标识实例的系统ID(例如ORCL)。
命令:
sys@TEST0924> startup nomount;
ORACLE instance started.
Total System Global Area 2505338880 bytes
Fixed Size 2230952 bytes
Variable Size 620758360 bytes
Database Buffers 1862270976 bytes
Redo Buffers 20078592 bytes
alert_test0924.log日志查看:
Wed Oct 02 16:33:04 2013
Adjusting the default value of parameter parallel_max_servers
from 320 to 135 due to the value of parameter processes (150)
Starting ORACLE instance (normal)
****************** Large Pages Information *****************
Total Shared Global Region in Large Pages = 0 KB (0%)
Large Pages used by this instance: 0 (0 KB)
Large Pages unused system wide = 0 (0 KB) (alloc incr 16 MB)
Large Pages configured system wide = 0 (0 KB)
Large Page size = 2048 KB
RECOMMENDATION:
Total Shared Global Region size is 2402 MB. For optimal performance,
prior to the next instance restart increase the number
of unused Large Pages by atleast 1201 2048 KB Large Pages (2402 MB)
system wide to get 100% of the Shared
Global Region allocated with Large pages
***********************************************************
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
Picked latch-free SCN scheme 3
Using LOG_ARCHIVE_DEST_1 parameter default value as USE_DB_RECOVERY_FILE_DEST
Autotune of undo retention is turned on.
IMODE=BR
ILAT =27
LICENSE_MAX_USERS = 0
SYS auditing is disabled
Starting up:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options.
ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1
System name: Linux
Node name: rtest.localdomain
Release: 2.6.18-308.el5
Version: #1 SMP Fri Jan 27 17:17:51 EST 2012
Machine: x86_64
VM name: VMWare Version: 6
Using parameter settings in server-side spfile /u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfiletest0924.ora
System parameters with non-default values:
processes = 150
shared_pool_size = 496M
sga_target = 2400M
control_files = "/u01/app/oracle/oradata/test0924/control01.ctl"
control_files = "/u01/app/oracle/fast_recovery_area/test0924/control02.ctl"
db_block_size = 8192
db_keep_cache_size = 48M
compatible = "11.2.0.0.0"
db_recovery_file_dest = "/u01/app/oracle/fast_recovery_area"
db_recovery_file_dest_size= 4122M
undo_tablespace = "UNDOTBS2"
remote_login_passwordfile= "EXCLUSIVE"
db_domain = ""
dispatchers = "(PROTOCOL=TCP) (SERVICE=test0924XDB)"
audit_file_dest = "/u01/app/oracle/admin/test0924/adump"
audit_trail = "DB"
db_name = "test0924"
open_cursors = 300
pga_aggregate_target = 798M
sec_max_failed_login_attempts= 2
diagnostic_dest = "/u01/app/oracle"
Wed Oct 02 16:33:04 2013
PMON started with pid=2, OS id=14904
Wed Oct 02 16:33:04 2013
PSP0 started with pid=3, OS id=14906
Wed Oct 02 16:33:05 2013
VKTM started with pid=4, OS id=14908 at elevated priority
VKTM running at (1)millisec precision with DBRM quantum (100)ms
Wed Oct 02 16:33:05 2013
GEN0 started with pid=5, OS id=14912
Wed Oct 02 16:33:05 2013
DIAG started with pid=6, OS id=14914
Wed Oct 02 16:33:05 2013
DBRM started with pid=7, OS id=14916
Wed Oct 02 16:33:05 2013
DIA0 started with pid=8, OS id=14918
Wed Oct 02 16:33:05 2013
MMAN started with pid=9, OS id=14920
Wed Oct 02 16:33:06 2013
DBW0 started with pid=10, OS id=14922
Wed Oct 02 16:33:06 2013
LGWR started with pid=11, OS id=14924
Wed Oct 02 16:33:06 2013
CKPT started with pid=12, OS id=14926
Wed Oct 02 16:33:06 2013
SMON started with pid=13, OS id=14928
Wed Oct 02 16:33:06 2013
RECO started with pid=14, OS id=14930
Wed Oct 02 16:33:06 2013
MMON started with pid=15, OS id=14932
Wed Oct 02 16:33:06 2013
MMNL started with pid=16, OS id=14934
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
2、启动Oracle DB 实例:MOUNT
数据库装载过程包括执行以下任务:
• 将数据库与以前启动的实例关联
• 定位并打开参数文件中指定的控制文件
• 通过读取控制文件来获取数据文件和联机重做日志文件的名称和状态(但是,此时不会执行检查来验证是否存在数据文件和联机重做日志文件)。
要执行特定的维护操作,则启动实例,然后装载数据库,但不打开该数据库。
例如,在执行以下任务期间必须装载数据库,但不得打开数据库:
• 重命名数据文件(打开数据库时可重命名脱机表空间的数据文件)。
• 启用和禁用联机重做日志文件归档选项
• 执行完整的数据库恢复
注:即使发出了OPEN请求,数据库仍可能处于MOUNT模式下。这是因为可能需要以某种方式恢复数据库。如果在MOUNT状态下执行恢复,将打开重做日志进行读取,并打开数据文件读取需要恢复的块,以及在恢复期间根据需要写入块。
命令:
ys@TEST0924> alter database mount;
Database altered.
alert_test0924.log日志查看:
ed Oct 02 16:34:21 2013
alter database mount
Wed Oct 02 16:34:25 2013
Successful mount of redo thread 1, with mount id 2721621517
Database mounted in Exclusive Mode
Lost write protection disabled
Completed: alter database mount
3、启动Oracle DB 实例:OPEN
数据库操作正常意味着实例已启动、数据库已装载且已打开。在数据库操作正常时,任何有效用户都可连接到数据库,而且可执行典型数据访问操作。
打开数据库过程包括执行以下任务:
• 打开数据文件
• 打开联机重做日志文件
如果尝试打开数据库时任一数据文件或联机重做日志文件不存在,则Oracle 服务器返回错误。
在最后这个阶段,Oracle 服务器会验证是否可以打开所有数据文件和联机重做日志文件,还会检查数据库的一致性。如有必要,系统监视器(SMON) 后台进程将启动实例恢复。可以在受限模式下启动数据库实例,以便只让有管理权限的用户使用该实例。要在受限模式下启动实例,可在“Advanced Startup Options(高级启动选项)”页上选择“Restrict access to database(限制对数据库的访问)”选项。
或者在启动Open模式时,添加restrict关键字:startup restrict,
设置或取消受限状态:alter system enable\disable restricted session;
命令:
sys@TEST0924> alter database open;
Database altered.
alert_test0924.log日志查看:
Wed Oct 02 16:35:45 2013
alter database open
Wed Oct 02 16:35:45 2013
LGWR: STARTING ARCH PROCESSES
Wed Oct 02 16:35:45 2013
ARC0 started with pid=20, OS id=15283
ARC0: Archival started
LGWR: STARTING ARCH PROCESSES COMPLETE
ARC0: STARTING ARCH PROCESSES
Wed Oct 02 16:35:46 2013
ARC1 started with pid=21, OS id=15296
Wed Oct 02 16:35:46 2013
ARC2 started with pid=22, OS id=15298
Wed Oct 02 16:35:46 2013
ARC3 started with pid=23, OS id=15300
ARC1: Archival started
ARC2: Archival started
ARC2: Becoming the 'no FAL' ARCH
ARC2: Becoming the 'no SRL' ARCH
ARC1: Becoming the heartbeat ARCH
Thread 1 opened at log sequence 55
Current log# 1 seq# 55 mem# 0: /u01/app/oracle/oradata/test0924/redo01.log
Successful open of redo thread 1
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
Wed Oct 02 16:35:46 2013
SMON: enabling cache recovery
[14939] Successfully onlined Undo Tablespace 5.
Undo initialization finished serial:0 start:627239824 end:627239864 diff:40 (0 seconds)
Verifying file header compatibility for 11g tablespace encryption..
Verifying 11g file header compatibility for tablespace encryption completed
SMON: enabling tx recovery
Database Characterset is AL32UTF8
No Resource Manager plan active
Starting background process FBDA
Wed Oct 02 16:35:47 2013
FBDA started with pid=24, OS id=15302
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
Wed Oct 02 16:35:47 2013
QMNC started with pid=25, OS id=15304
Completed: alter database open
Wed Oct 02 16:35:47 2013
db_recovery_file_dest_size of 4122 MB is 48.29% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Wed Oct 02 16:35:47 2013
Starting background process CJQ0
Wed Oct 02 16:35:47 2013
CJQ0 started with pid=26, OS id=15318
ARC3: Archival started
ARC0: STARTING ARCH PROCESSES COMPLETE
4、启动选项:示例
此幻灯片显示用于启动数据库的SQL*Plus 语法。
1.startup:启动实例,将数据库文件与该实例关联,然后装载并打开数据库。
2alter database nomount:启动实例,但不装载数据库。
3.alter database mount:装载处于NOMOUNT状态的数据库。
4alter database open :打开处于MOUNT状态的数据库。
来源:http://blog.csdn.net/rlhua/article/details/12237245