数据库关闭与启动: scn == system change number
数据库启动步骤
nomount----> mount---->open
(1)第一阶段
sql> startup nomount
ORACLE instance started.
Total System Global Area 7148580864 bytes
Fixed Size 2214216 bytes
Variable Size 3825206968 bytes
Database Buffers 3288334336 bytes
Redo Buffers 32825344 bytes
sql>
sql> select status from v$instance;
STATUS
------------
STARTED
sql> show parameter spfile;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATA/orcl/spfileorcl.ora
nomount这一步,数据库做了什么?
(2)第二阶段
sql> alter database mount;
Database altered.
sql>
sql> show parameter control
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string +DATA/orcl/controlfile/current
.260.943301383,+FRA/orcl/cont
rolfile/current.256.943301385
control_management_pack_access string DIAGNOSTIC+TUNING
sql> select status from v$instance;
STATUS
------------
MOUNTED
sql> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
+DATA/orcl/datafile/system.256.943301251
+DATA/orcl/datafile/sysaux.257.943301251
+DATA/orcl/datafile/undotbs1.258.943301251
+DATA/orcl/datafile/users.259.943301251
+DATA/orcl/datafile/example.265.943301433
sql> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
+DATA/orcl/onlinelog/group_3.263.943301403
+FRA/orcl/onlinelog/group_3.259.943301407
+DATA/orcl/onlinelog/group_2.262.943301397
+FRA/orcl/onlinelog/group_2.258.943301401
+DATA/orcl/onlinelog/group_1.261.943301389
+FRA/orcl/onlinelog/group_1.257.943301395
select name from v$tablespace;
select name from v$database;
sql> select name from v$database;
NAME
---------
ORCL
sql> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string orcl
db_unique_name string orcl
global_names boolean FALSE
instance_name string orcl
lock_name_space string
log_file_name_convert string
service_names string orcl
sql>
mount这一步,数据库做了什么?
(3)第三阶段
sql> alter database open;
Database altered.
sql> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
sql> select status from v$instance;
STATUS
------------
OPEN
open这一步,数据库做了什么?
验证数据文件和联机重做日志是否存在及控制文件、数据文件的一致性
sql> startup
ORACLE instance started.
Total System Global Area 7148580864 bytes
Fixed Size 2214216 bytes
Variable Size 3825206968 bytes
Database Buffers 3288334336 bytes
Redo Buffers 32825344 bytes
Database mounted.
Database opened.
###############
使用oracle Restart组件中的 SRVCTL 工具来启动数据库
srvctl start database -d orcl -o mount
srvctl start database -d orcl -o start
srvctl start database -d orcl -o open
不加 -o 默认是open
srvctl start database -d orcl 等价于
srvctl start database -d orcl -o open
[oracle@oel ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.DATA.dg ora....up.type ONLINE ONLINE oel
ora.FRA.dg ora....up.type ONLINE ONLINE oel
ora....ER.lsnr ora....er.type ONLINE ONLINE oel
ora.asm ora.asm.type ONLINE ONLINE oel
ora.cssd ora.cssd.type ONLINE ONLINE oel
ora.diskmon ora....on.type ONLINE ONLINE oel
ora.orcl.db ora....se.type ONLINE ONLINE oel
#############
其他:
查看oracle内存段:
ipcs -m | grep ora
[root@oel ~]# ipcs -m | grep ora
0xfa55c7d8 163841 oracle 660 4096 0
0x00000000 1736706 oracle 660 4096 0
0x00000000 1769475 oracle 660 4096 0
0xd3ac6c80 1802244 oracle 660 4096 0
ps - ef | grep ora