Database transaction and ACID properties

Database Transaction
A transaction is logical unit of work which has a complete status performed within a database management system. It should not be in an inconsistent status.Example :-
Assume a user has a savings account having 4000 unit of currency. He withdraws 100 unit of currency from an ATM and this withdrawal is referred as a transaction.1. User/Card/Account authentication.
2. Withdrawal request for 100 unit of currency.
3. Balance verification.
4. Dispenses the currency to user and update the balance to 3900.
5. Print receipt and exit.

Assume that a network error happened after Step 3. The transaction will not be completed.

ACID properties
A database transaction must follow ACID properties.

A – Atomic
C – Consistent
I –  Isolated
D – Durable

Atomic :-
This property ensures the transaction either in complete status or nothing has started. There must not be any scenario like user received some currency amount and balance remains same or balance updated and failed to dispense the amount.

Consistent:-
Every transaction must be consistent.

Isolated:-
Every transaction must be isolated to avoid the locks or deadlocks. Deadlock is a condition when two or more users or processes waiting for the other to release a resource.

Durable:-
A transaction which has committed or saved must be there for permanently.

Read more on how to install Oracle 11g on Ubuntu Linux here 

About these ads

About sqlandplsql

This blog is to help the community to learn more about the Oracle, PL/SQL, Ubuntu, MySQL etc and few general topics. An attempt to explain all topics in a simple and elegant manner. Suggestions, comments, feedbacks and referrals are highly appreciated.
This entry was posted in Concepts and tagged , , . Bookmark the permalink.

One Response to Database transaction and ACID properties

  1. koyadan says:

    Excellent article. very precise.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s