数据库关闭与启动: 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这一步,数据库做了什么?
读取控制文件,验证控制文件的一致性及db_name的一致性
(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
[[email protected] ~]$ 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
[[email protected] ~]# 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