Friday, March 4, 2016

Dropping a pluggable database -12c

********************* *********************
Dropping a pluggable database :
********************* *********************

SQL> select name, open_mode from v$pdbs;

NAME       OPEN_MODE
------------------------------ ----------
PDB$SEED       READ ONLY
PDBORCL       READ WRITE
PDBORCL2       READ WRITE
PDBORCL1       READ WRITE
PDBORCL3       READ WRITE



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

You need to close the database before dropping.

SQL> alter pluggable database PDBORCL3 close;

Pluggable database altered.

SQL> select name, open_mode from v$pdbs;

NAME       OPEN_MODE
------------------------------ ----------
PDB$SEED       READ ONLY
PDBORCL       READ WRITE
PDBORCL2       READ WRITE
PDBORCL1       READ WRITE
PDBORCL3       MOUNTED

SQL> DROP PLUGGABLE DATABASE PDBORCL3 INCLUDING DATAFILES;

Pluggable database dropped.

SQL> select name, open_mode from v$pdbs;

NAME       OPEN_MODE
------------------------------ ----------
PDB$SEED       READ ONLY
PDBORCL       READ WRITE
PDBORCL2       READ WRITE
PDBORCL1       READ WRITE


Lets make sure by looking at datafile location

[oracle@Linux03 pdborcl3]$ pwd
/u01/app/oracle/oradata/orcl/pdborcl3

[oracle@Linux03 pdborcl3]$ ls -ll
total 0


[oracle@Linux03 pdborcl3]$ 


1 comment:

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

    SQL> ALTER PLUGGABLE DATABASE pdb close immediate instances=all;

    Pluggable database altered.

    SQL> DROP PLUGGABLE DATABASE pdb INCLUDING DATAFILES;

    Pluggable database dropped.

    SQL>

    ReplyDelete