Pages

Subscribe:

Ads 468x60px

Thursday, 30 July 2020

Transaction in Oracle Database

The transactions


Managing transactions is at the heart of database processing. To allow multiple users to access it simultaneously, the DBMS must manage transactions with the minimum of conflicts while ensuring the consistency of the database.

A transaction is a logical unit made up of one or more SQL statements.

DML command 1
DML command 2
................................
................................
................................
DML command n

A transaction begins implicitly with the execution of the first SQL command and ends with a COMMIT to commit or a ROLLBACK to roll back the transaction.

The transaction continues executing SQL commands one at a time until one of the following occurs:

    COMMIT: Transaction encounters an explicit COMMIT statement, all changes made to the database up to this point are committed.

    ROLLBACK: Transaction encounters an explicit ROLLBACK statement, all changes made to the database up to this point are rolled back.

  DML instruction: If an DDL instruction is encountered such as CREATE, DROP, RENAME, or ALTER, Oracle first commits the current DML instructions for the transaction and then executes and commits the DDL instruction in question. This is an implied commit.

    Normal end of the calling program: if the program ends without errors, the transaction is committed implicitly. This is the case when you use the sqlplus tool, then you enter a series of DML commands in interactive mode, then you exit the session normally via the sqlplus "EXIT" command. In this case an implicit commit is applied to your transaction.

    Abnormal program termination: Such as a network cut or a program kill, the transaction is implicitly rolled back.


Learning Oracle DBA is not too short and quick guide. You should need to read several books and Oracle documentation for understanding of depth of each topics. You can get more tips and tutorials for Oracle database administration from our other resources like this or this.