Atikh's DBA blog
  • Home
  • Oracle
  • MySQL
  • MongoDB
  • PostgreSQL
  • Snowflake
  • About Me
  • Contact Us

Oracle : Drop Pluggable Database (PDB) in 12c/19c/21c/23c

 Atikh Shaikh     oracle, Oracle 12c     1 comment   

After learning creating pluggable database, we will discuss about dropping pluggable database(PDB) in 12c, 19c and above versions
  • Dropping pluggable database is similar to dropping any other regular database, you have two options while dropping pluggable database related to its datafiles
      • Dropping PDB including datafiles
      • Dropping PDB keeping datafiles
drop-pluggable-database, dropping pluggable database, drop pdb

Here we will drop pluggable database PDB_TECHNO, below are the steps for the same
  • Check status of pluggable database using v$containers you want to drop
SQL> select con_id, name,open_mode from v$containers;

    CON_ID NAME                           OPEN_MODE
---------- ------------------------------ ----------
         1 CDB$ROOT                       READ WRITE
         2 PDB$SEED                       READ ONLY
         3 PDB_1                          READ WRITE
         4 PDB_TECHNO                     READ WRITE
you can see this PDB exists and save is in READ WRITE mode
  • Close the database using alter database command before dropping database and check the status
SQL> alter pluggable database PDB_TECHNO close;

Pluggable database altered.

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

    CON_ID NAME                           OPEN_MODE
---------- ------------------------------ ----------
         1 CDB$ROOT                       READ WRITE
         2 PDB$SEED                       READ ONLY
         3 PDB_1                          READ WRITE
         4 PDB_TECHNO                     MOUNTED


Now drop the PDB using including datafiles


SQL> drop pluggable database PDB_TECHNO including datafiles;

Pluggable database dropped.

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

    CON_ID NAME                           OPEN_MODE
---------- ------------------------------ ----------
         1 CDB$ROOT                       READ WRITE
         2 PDB$SEED                       READ ONLY
         3 PDB_1                          READ WRITE

In this case we have dropped pluggable database including datafiles as we do not need these datafiles but in case if we need datafile even after dropping pluggable database, we can simply use drop command excluding option of "including datafiles", 
  • By default oracle drops pluggable database with keeping datafiles so below both commands are equivalent
drop pluggable database PDB_TECHNO keep datafiles;

drop pluggable database PDB_TECHNO;

In case we try to drop non closed (open) pluggable database using including datafiles, it will throw and error but same can be dropped with option keep datafiles

SQL> drop pluggable database PDB_TECHNO including datafiles;
drop pluggable database PDB_TECHNO including datafiles
*
ERROR at line 1:
ORA-65025: Pluggable database PDB_TECHNO is not closed on all instances.

SQL> drop pluggable database PDB_TECHNO keep datafiles;

Pluggable database dropped.

In this way we can drop any pluggable database, dropping container database is like dropping any other database but we have to be sure before dropping it as it will drop all pluggable databases including seed PDB present under it.
  • Share This:  
  •  Facebook
  •  Twitter
  •  Instagram
  •  Pin
  •  linkedin
  •  reddit
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

1 comment:

  1. Soma12 May 2020 at 20:02

    Thank you for such a wonderful article. I got a quick question,
    Can we convert a container database in Oracle12c R2 to non-container database by first dropping a container database and re-create a non-container database via DBCA

    ReplyDelete
    Replies
      Reply
Add comment
Load more...

Author

Atikh Shaikh
View my complete profile

Categories

  • MongoDB (18)
  • Oracle 12c (30)
  • Oracle12cR2 New Feature (3)
  • PostgreSQL (20)
  • RMAN (10)
  • Snowflake (8)
  • mysql (23)
  • oracle (74)

Blog Archive

  • ►  2018 (38)
    • ►  November (25)
    • ►  December (13)
  • ▼  2019 (33)
    • ▼  January (15)
      • Data Types in MongoDB
      • Oracle : RMAN Introduction
      • ORA-00265: instance recovery required, cannot set ...
      • Oracle : Starting with RMAN Commands
      • Oracle RMAN : Incremental Backups
      • MongoDB 4.0 New Features
      • Oracle RMAN : File Section for backup of large dat...
      • ORA-19804, ORA-19809: limit exceeded for recovery ...
      • Oracle RMAN: Fast Incremental Backups
      • The DUAL table in oracle
      • Oracle : Drop Pluggable Database (PDB) in 12c/19c/...
      • Oracle : The oerr Utility (Oracle Error)
      • Oracle RMAN : Incrementally Updated Backups
      • MySQL 8.0 New Features
      • Postgres spooling file and other command line options
    • ►  February (6)
    • ►  March (2)
    • ►  April (5)
    • ►  May (5)
  • ►  2020 (5)
    • ►  April (1)
    • ►  May (2)
    • ►  July (2)
  • ►  2021 (8)
    • ►  June (3)
    • ►  July (3)
    • ►  August (1)
    • ►  December (1)
  • ►  2022 (33)
    • ►  May (3)
    • ►  June (10)
    • ►  July (3)
    • ►  August (4)
    • ►  September (8)
    • ►  October (3)
    • ►  November (2)
  • ►  2023 (14)
    • ►  February (1)
    • ►  April (5)
    • ►  May (2)
    • ►  June (1)
    • ►  September (1)
    • ►  October (1)
    • ►  December (3)
  • ►  2024 (5)
    • ►  January (2)
    • ►  March (3)
  • ►  2025 (6)
    • ►  March (1)
    • ►  April (3)
    • ►  May (2)

Popular Posts

  • ORA-29283: invalid file operation: unexpected "LFI" error (1509)[29437]
    I was trying to export the schema in my windows PC, it got stuck with below error    C:\Users\shaik\Videos\technodba exp>expdp userid...
  • Oracle 23ai : Use of NOVALIDATE Constraints in IMPDP
    While performing impdp operations in the Oracle database, Oracle performs validation checks for every constraint on the imported table, that...
  • PostgreSQL : How to get data directory location for PostgreSQL instance
    Sometimes, you start working on a PostgreSQL instance but forget about the data directory, here we will discuss different methods to know th...
  • ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
    In previous articles, we have learned about user creation and grants  in MySQL in detail, but there are a few privileges called global priv...
  • Oracle Dataguard Broker Configuration (DGMGRL)
    Data Guard Broker is a command-line interface that makes managing primary and standby databases easy. DBA can use a single command to switch...

Labels

oracle Oracle 12c mysql PostgreSQL MongoDB oracle 19c Oracle23c oracle19c Orale PDB-CDB oracle12c python AWS Oracle ASM Virtualbox pluggable database storage engine

Pages

  • Disclaimer
  • Privacy Policy

Follow TechnoDBA

Copyright © Atikh's DBA blog | Powered by Blogger