LESSON 11
How to drop a multitenant container CDB or a pluggable database PDB
You should login to the
CDB, shutdown the database then startup with the "mount restrict"
option. Now, you can drop the database.
Steps to drop CDB:
Please do not perform drop database!
# cd ~
# . ./.profile
# sqlplus /nolog
SQL> connect /
as sysdba
--Just
to make sure where you are
Get the container name
SQL> show
con_name
SQL> shutdown
immediate;
SQL> startup
mount restrict;
SQL> DROP
DATABASE; --
Please do not do this!
SQL> exit
Steps to drop PDB:
Get the list of all PDBs.
SQL> SELECT
con_id, name, open_mode, dbid FROM v$pdbs;
CON_ID |
NAME |
OPEN_MODE |
DBID |
2 |
PDB$SEED |
READ ONLY |
3654327692 |
3 |
MYPDB1 |
READ WRITE |
6783241652 |
4 |
MYPDB2 |
READ WRITE |
7549320153 |
5 |
MYPDB2_CLONE |
READ WRITE |
8734290212 |
6 |
PDB_MYDBS |
READ WRITE |
2378654330 |
7 |
OLD_MYPDB1 |
READ WRITE |
7865403211 |
8 |
OLD_MYPDB2 |
READ WRITE |
2213429876 |
Assuming you want to
drop the OLD_MYPDB1 and OLD_MYPDB2 pluggable databases. First, you need
to close the databases and then drop them.
Dropping OLD_MYPDB1
pluggable database
SQL> ALTER
PLUGGABLE DATABASE old_mypdb1 CLOSE IMMEDIATE;
SQL> DROP
PLUGGABLE DATABASE old_mypdb1 INCLUDING DATAFILES;
Dropping OLD_MYPDB2
pluggable database
SQL> ALTER
PLUGGABLE DATABASE old_mypdb2 CLOSE IMMEDIATE;
SQL> DROP
PLUGGABLE DATABASE old_mypdb2 INCLUDING DATAFILES;
Get the list of all PDBs
to check the PDBs were dropped.
SQL> SELECT
con_id, name, open_mode, dbid FROM v$pdbs;
CON_ID |
NAME |
OPEN_MODE |
DBID |
2 |
PDB$SEED |
READ ONLY |
3654327692 |
3 |
MYPDB1 |
READ WRITE |
6783241652 |
4 |
MYPDB2 |
READ WRITE |
7549320153 |
5 |
MYPDB2_CLONE |
READ WRITE |
8734290212 |
6 |
PDB_MYDBS |
READ WRITE |
2378654330 |
Good Luck!
|