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> 

How to check pdb database name and dbid in oracle 19c ?

 check pdb database name and dbid in oracle



SQL> 

SQL> select dbid , name from v$pdbs;


      DBID NAME

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

3326623803 PDB


SQL> 

How to start pluggable database in oracle 19c ?

 Start pluggable database in oracle 


SQL> 

SQL> alter session set container=pdb$seed;


Session altered.


SQL> 

SQL> show con_name


CON_NAME

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

PDB$SEED

SQL> 

SQL> 

SQL> alter pluggable database pdb open read write;

alter pluggable database pdb open read write

*

ERROR at line 1:

ORA-65118: operation affecting a pluggable database cannot be performed from

another pluggable database



SQL> alter session set container=pdb;


Session altered.


SQL> show con_name


CON_NAME

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

PDB

SQL> 

SQL> alter pluggable database pdb open read write;


Pluggable database altered.


SQL> 



SQL> show pdbs


    CON_ID CON_NAME   OPEN MODE  RESTRICTED

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

3 PDB   READ WRITE NO

SQL> 



Tuesday, February 11, 2025

ACID properties

 

To maintain the integrity of the data, there are four properties described in the database management system, which are known as the ACID properties


ACID properties are a set of principles that ensure reliable transaction processing in a database. They stand for:

  1. Atomicity – A transaction is either fully completed or fully rolled back. If one part of the transaction fails, the entire transaction is undone to maintain database integrity.
    • Example: If you transfer money from one account to another, both debit and credit operations must succeed. If the debit succeeds but the credit fails, the entire transaction should be rolled back.

  1. Consistency – A transaction must ensure that the database remains in a valid state before and after execution, maintaining all defined rules and constraints.
    • Example: If a banking transaction deducts money from one account, it must ensure that the total balance across accounts remains consistent with predefined constraints.

  1. Isolation – Transactions should execute independently without interference. Intermediate states of a transaction should not be visible to other concurrent transactions.
    • Example: If two users try to book the last seat in a movie theater simultaneously, only one transaction should succeed to prevent overbooking.

  1. Durability – Once a transaction is committed, the changes should be permanent, even in the case of system failures.
    • Example: If a customer purchases an item online and the system crashes, the order details should remain intact in the database after recovery.


These ACID properties ensure database reliability, especially in multi-user and distributed environments.