Oracle 12c 学习之启动关闭CDB&PDB

前端之家收集整理的这篇文章主要介绍了Oracle 12c 学习之启动关闭CDB&PDB前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
1、默认登陆到CDB
<roidb01:cdb:/home/oracle>$sqlplus / as sysdba

sql*Plus: Release 12.1.0.2.0 Production on Sat Jan 20 11:01:46 2018

Copyright (c) 1982,2014,Oracle.  All rights reserved.

Connected to an idle instance.

2、启动CDB
sql> startup
ORACLE instance started.

Total System Global Area 1560281088 bytes
Fixed Size                  2924784 bytes
Variable Size             956305168 bytes
Database Buffers          587202560 bytes
Redo Buffers               13848576 bytes
Database mounted.
Database opened.
3、查看容器名
sql> show con_name

CON_NAME
------------------------------
CDB$ROOT

4、查看pdb
默认会有一个PDB$SEED,PDB1是通过模版创建的。
sql> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           MOUNTED
    5、默认pdb未启动,手动启动pdb           
sql> alter pluggable database all open;

Pluggable database altered.

sql> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           READ WRITE NO
6、关闭pdb              
sql> alter pluggable database pdb1 close;

Pluggable database altered.

sql> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           MOUNTED
7、pdb只读打开                
sql> alter pluggable database pdb1 open read only;

Pluggable database altered.

8、切换到pdb1
sql> alter session set container=pdb1 ;

Session altered.

sql> show con_name

CON_NAME
------------------------------
PDB1
9、也可以这样启动pdb
sql> shutdown immediate;
Pluggable Database closed.
sql> startup
Pluggable Database opened.
sql> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         3 PDB1                           READ WRITE NO

10、切换到cdb,关闭cdb的同时,pdb也会跟着关闭
sql> alter session set container=CDB$ROOT;

Session altered.

sql> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
sql>

猜你在找的Oracle相关文章