A technical troubleshooting blog about Oracle with other Databases & Cloud Technologies.

How to Startup/Shutdown PDB’s ??

3 min read
Traditional startup/shutdown command prior to 12c.

Shutdown Command

SHUTDOWN NORMAL
SHUTDOWN IMMEDIATE
SHUTDOWN ABORT
Startup Command

STARTUP
STARTUP NOMOUNT
STARTUP MOUNT
What happen when we execute shutdown immediate at CDB?

If we use one of these traditional shutdown methods at the container database (CDB) layer, we will bring down the CDB and the associated PDBs under it.
$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production 
Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
asrblg

SQL> show con_name;

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

SQL> shutdown immediate;

Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> alter session set container=PDB1;
alter session set container=PDB1
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
How to shutdown individual PDB?
$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production 
Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> SELECT NAME,OPEN_MODE from v$PDBS;

NAME        OPEN_MODE
--------------- ---------------
PDB$SEED    READ ONLY
PDB1        READ WRITE

SQL> ALTER SESSION SET CONTAINER=PDB1;
Session altered.

SQL> SHUTDOWN IMMEDIATE;
Pluggable Database closed.

SQL> SELECT NAME,OPEN_MODE from v$PDBS;

NAME        OPEN_MODE
--------------- ---------------
PDB$SEED    READ ONLY
PDB1        MOUNT

Or,

$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production
Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> SELECT NAME,OPEN_MODE from v$PDBS;

NAME        OPEN_MODE
--------------- ---------------
PDB$SEED    READ ONLY
PDB1        READ WRITE

SQL> alter pluggable database PDB1 close;
Pluggable database altered.

SQL> SELECT NAME,OPEN_MODE from v$PDBS;

NAME        OPEN_MODE
--------------- ---------------
PDB$SEED    READ ONLY
PDB1        MOUNT
We can also use close immediate clause as below:
SQL> alter pluggable database PDB1 close IMMEDIATE;
How can we startup a single PDB if needed? 

There are two different ways to startup PDB.
SQL> select con_id, name, open_mode from v$pdbs;

CON_ID     NAME                           OPEN_MODE
---------- ------------------------------ ----------
 2         PDB$SEED                       READ ONLY
 3         PDB1                           MOUNTED
 
How do we bring PDB online in READ WRITE mode?

SQL> alter pluggable database PDB1 open;
Pluggable database altered.

SQL> select con_id, name, open_mode from v$pdbs;

CON_ID     NAME                           OPEN_MODE
---------- ------------------------------ ----------
 2         PDB$SEED                       READ ONLY
 3         PDB1                           READ WRITE  =>>>>>
Open PDB in restricted mode
SQL> alter pluggable database PDB1 open restricted;
Pluggable database altered.

SQL> SELECT NAME,OPEN_MODE,RESTRICTED from v$PDBS;

NAME                           OPEN_MODE  RES
------------------------------ ---------- ---
PDB1                        READ WRITE YES
Open PDB with force option
SQL> alter pluggable database PDB1 open FORCE;
Pluggable database altered.

SQL> SELECT NAME,OPEN_MODE,RESTRICTED from v$PDBS;

NAME                           OPEN_MODE  RES
------------------------------ ---------- ---
PDB1                        READ WRITE NO
We can also open PDB in upgrade mode
SQL> alter pluggable database PDB1 open UPGRADE;
Note :- This document is also applicable to RAC and replace view as gv$ instead of v$