Tuesday, April 29, 2025

Oracle Error : ORA-65040: operation not allowed from within a pluggable database

 

ORA-65040: operation not allowed from within a pluggable database


SQL> drop pluggable database demo1 including datafiles;

drop pluggable database demo1 including datafiles

*

ERROR at line 1:

ORA-65040: operation not allowed from within a pluggable database



SQL> 



Solution :


=> connect to the container database 

=> close the pluggable database 

=> unplug the pluggable database (optional)

=> drop the pluggable database 

    .if we are using the command without including datafiles , this only remove pdb not underline datafiles etc .




SQL> alter session set container =cdb$root;


Session altered.


SQL> show pdbs


    CON_ID CON_NAME   OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

2 PDB$SEED   READ ONLY  NO

3 PDB   READ WRITE NO

4 DEMO1   READ WRITE NO

SQL> 

SQL> alter pluggable database demo1 close immediate;


Pluggable database altered.


SQL> show pdbs


    CON_ID CON_NAME   OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

2 PDB$SEED   READ ONLY  NO

3 PDB   READ WRITE NO

4 DEMO1   MOUNTED

SQL> drop pluggable database demo1 including datafiles;


Pluggable database dropped.


SQL> show pdbs


    CON_ID CON_NAME   OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

2 PDB$SEED   READ ONLY  NO

3 PDB   READ WRITE NO

SQL> 

No comments:

Post a Comment