Traditional startup/shutdown methods prior to 12c
Traditional startup/shutdown command prior to 12c as as shown below.
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 on Tue Oct 15 21:42:53 2013 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 ---------------- ora12c 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
As you can see from the output above, SHUTDOWN IMMEDIATE at the CDB level will close the CDB and all other PDBs.
How to shutdown individual PDB?
Use the below queries to shutdown an individual PDB.
$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.1.0 Production on Tue Oct 15 21:42:53 2013 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 on Tue Oct 15 21:42:53 2013 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;
once we execute shutdown command, pdb will always stay in mount status.
How can we startup just a single PDB if needed?
There are 4 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
How to 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
How to 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
How to open PDB with upgrade option?
SQL> alter pluggable database PDB1 open UPGRADE;
Note: This post is also applicable to RAC and replace view as gv$ instead of v$