Saturday, 8 August 2020

Multitenant - Drop PDB database

Always close pdb before dropping otherwise it will through error ORA-65025

KEYWORDS:

  • DROP PLUGGABLE DATABASE PDB3 INCLUDING DATAFILES;
  • DROP PLUGGABLE DATABASE PDB3 KEEP DATAFILES;

EXAMPLE:

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           READ WRITE NO
         4 PDB2                           READ WRITE NO
         5 PDB3                           READ WRITE NO

SQL> DROP PLUGGABLE DATABASE PDB3 including datafiles;
DROP PLUGGABLE DATABASE PDB3 including datafiles
*
ERROR at line 1:
ORA-65025: Pluggable database PDB3 is not closed on all instances.


SQL> alter PLUGGABLE DATABASE PDB3 close immediate;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           READ WRITE NO
         4 PDB2                           READ WRITE NO
         5 PDB3                           MOUNTED
SQL> DROP PLUGGABLE DATABASE PDB3 including datafiles;

Pluggable database dropped.

SQL>

No comments:

Post a Comment