Search This Blog

Total Pageviews

Sunday, 23 July 2017

How to Drop a Pluggable Database ...

How to Drop a Pluggable Database...



Drop a Pluggable Database



set linesize 200 
col NAME for a30
COLUMN "RESTRICTED" FORMAT A10
select
d.PDB_ID,
v.name,
v.open_mode,
nvl(v.restricted, 'n/a') "RESTRICTED",
d.status from v$pdbs v , dba_pdbs d
where 1=1
and v.guid=d.guid
order by v.create_scn;


    PDB_ID NAME                           OPEN_MODE  RESTRICTED STATUS
---------- ------------------------------ ---------- ---------- ----------
         2 PDB$SEED                       READ ONLY  NO         NORMAL
         3 ANUJ                           MOUNTED    n/a        NORMAL
         4 ANUJ1                          MOUNTED    NO         NORMAL

 alter pluggable database ANUJ1 open;


    PDB_ID NAME                           OPEN_MODE  RESTRICTED STATUS
---------- ------------------------------ ---------- ---------- ----------
         2 PDB$SEED                       READ ONLY  NO         NORMAL
         3 ANUJ                           MOUNTED    n/a        NORMAL
         4 ANUJ1                          READ WRITE NO         NORMAL



set linesize 200 
col NAME for a30
select con_id,name,open_mode,open_time from v$pdbs;

    CON_ID NAME                           OPEN_MODE  OPEN_TIME
---------- ------------------------------ ---------- ---------------------------------------------------------------------------
         2 PDB$SEED                       READ ONLY  23-JUL-17 07.12.37.823 AM +01:00
         3 ANUJ                           MOUNTED
         4 ANUJ1                          READ WRITE 23-JUL-17 07.20.06.798 AM +01:00



alter pluggable database ANUJ1 close immediate;   ------ <<<<< First close the database 


set linesize 200 
col NAME for a30
select con_id,name,open_mode,open_time from v$pdbs;

     CON_ID NAME                           OPEN_MODE  OPEN_TIME
---------- ------------------------------ ---------- ---------------------------------------------------------------------------
         2 PDB$SEED                       READ ONLY  23-JUL-17 07.12.37.823 AM +01:00
         3 ANUJ                           MOUNTED
         4 ANUJ1                          MOUNTED    23-JUL-17 07.32.54.795 AM +01:00



SQL> drop pluggable database ANUJ1 including datafiles;

Pluggable database dropped.


set linesize 200 
col NAME for a30
select con_id,name,open_mode,open_time from v$pdbs;

   CON_ID NAME                           OPEN_MODE  OPEN_TIME
---------- ------------------------------ ---------- ---------------------------------------------------------------------------
         2 PDB$SEED                       READ ONLY  23-JUL-17 07.12.37.823 AM +01:00
         3 ANUJ                           MOUNTED

No comments:

Oracle DBA

anuj blog Archive