• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Startup/Shutdown PDB’s in Oracle Database 12c

By admin

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$

Filed Under: oracle, oracle 12c

Some more articles you might also be interested in …

  1. How to Define PDB Listeners With Different Ports In a Oracle database Multitenant Setup
  2. Oracle Database – Configuring Secure Application Roles
  3. Unable to export realm protected table using data pump
  4. How to Modify Static Parameter value in spfile
  5. Oracle Database Environment Variables and Their Functions
  6. RMAN Pluggable Database Backup and Recovery in a Multitenant Environment
  7. How to Enable a Database Trigger
  8. Oracle Database 12c : Creating a Scheduler Job in a Multitenant Database
  9. RMAN: SET NEWNAME Command Using SQL
  10. DNS and DHCP Setup Example for Oracle Grid Infrastructure GNS

You May Also Like

Primary Sidebar

Recent Posts

  • How to disable ICMP redirects on CentOS/RHEL
  • What are Oracle Key Vault Roles
  • What Is Oracle Key Vault
  • Auditing with Oracle Database Vault Reports
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary