In Oracle Multitenant architecture, a transaction cannot span multiple containers. If a transaction is started in one PDB and the session then issues ALTER SESSION SET CONTAINER to move to a different PDB, the original transaction is neither committed nor rolled back — it simply remains open and uncommitted in the container where it began. While that transaction is still active, Oracle blocks any DML, DDL, COMMIT, or ROLLBACK statements in the new container until the session switches back to the container where the transaction started. In this scenario, the two INSERT statements into USER1.EMP were never committed before the session switched to PDB2, so they remain uncommitted at that point. Because that uncommitted transaction is still active in the parent (originating) container PDB1, the subsequent INSERT INTO USER2.DEPT executed while connected to PDB2 fails.
Community Discussion