在cdb中启动和关闭pdb

时间:2022-02-05 21:34:32
[root@db12cr2 ~]# su - oracle
[oracle@db12cr2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Tue Mar 14 12:43:39 2017

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

Connected to an idle instance.

SQL> startup pluggable database open;
SP2-1547: Can not startup Pluggable database - Consolidated Database down.
SQL> startup
ORACLE instance started.

Total System Global Area  587202560 bytes
Fixed Size		    8795424 bytes
Variable Size		  343935712 bytes
Database Buffers	  226492416 bytes
Redo Buffers		    7979008 bytes
Database mounted.
Database opened.
SQL>  startup pluggable database highgo2 open;
Pluggable Database opened.
SQL> startup pluggable database highgo3;
Pluggable Database opened.
SQL> 
SQL> alter pluggable database highgo2 close immediate;
---->>>上述命令是单实例级别的命令,rac的话,需要在其他节点也执行此命令.

Pluggable database altered.

SQL> set lines 300
SQL> SELECT NAME, OPEN_MODE FROM V$PDBS WHERE CON_ID > 2;

NAME																 OPEN_MODE
-------------------------------------------------------------------------------------------------------------------------------- ----------
HIGHGO1 															 READ WRITE
HIGHGO2 															 MOUNTED
HIGHGO3 															 READ WRITE

SQL> show pdbs    

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 HIGHGO1			  READ WRITE NO
	 4 HIGHGO2			  MOUNTED
	 5 HIGHGO3			  READ WRITE NO
SQL>