单节点数据库启停
srvctl stop instance -d vmtoradb -i vmtoradb1
srvctl stop instance -d vmtoradb -i vmtoradb2
srvctl start instance -d vmtoradb -i vmtoradb1
srvctl start instance -d vmtoradb -i vmtoradb2
启动/停止所有实例及其启用的服务
srvctl start database -d vmtoradb
srvctl stop database -d vmtoradb
关闭所有PDB
SQL> alter session set container=CDB$ROOT;
SQL> alter pluggable database all close;
SQL> alter pluggable database all close;
停止/启动节点集群服务,须要以root用户
[grid@vmtrac1 bin]$ pwd
/u01/app/12.1.0/grid/bin
./crsctl stop cluster -all -----停止所有节点集群服务
./crsctl stop cluster -------停止本节点集群服务
oracle 12C与11G一样默认开机自启动集群服务
关闭顺序 :关闭PDB----->关闭数据库------>关闭集群服务 (
先关闭PDB 在关闭数据库实例,否则smon将有一个自动回复过程)
启动顺序:开机自启动集群服务查看集群服务器是否正常---------->打开数据库--------->启动PDB(默认是在mount状态下)
SQL> select name,open_mode from v$pdbs ;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
SSMIS1 MOUNTED
SSMIS2 MOUNTED
SSMIS3 MOUNTED
在CDB模式下启动PDB
SQL> alter pluggable database SSMIS1 open;
Pluggable database altered.
SQL> select name,open_mode from v$pdbs;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
SSMIS1 READ WRITE
SSMIS2 MOUNTED
SSMIS3 MOUNTED
在PDB模式下启动
SQL> alter session set container=ssmis2;
SQL> alter pluggable database open;
SQL> select name,open_mode from v$pdbs;
NAME OPEN_MODE
------------------------------ ----------
SSMIS2 READ WRITE
SQL> alter session set container=ssmis3;
SQL> alter pluggable database open read only;(read only 模式)
SQL> select name,open_mode from v$pdbs;
NAME OPEN_MODE
------------------------------ ----------
SSMIS3 READ ONLY
关闭PDB
SQL> alter session set container=ssmis3;
SQL> shutdown immediate;
Pluggable Database closed.
SQL> select name,open_mode from v$pdbs;
NAME OPEN_MODE
------------------------------ ----------
SSMIS3 MOUNTED
在CDB下以sys用户创建PDB开机自启动触发器
CREATE TRIGGER open_all_pdbs
AFTER STARTUP ON DATABASE
BEGIN
EXECUTE IMMEDIATE 'alter pluggable database all open';
END open_all_pdbs;