|
SQL Server transactions - October 24, 2008 at 18:10 pm by Rajmeet
Ghai
Explain the characteristics of a transaction. i.e. Atomicity, Consistency,
Isolation, Durability.
Characteristics of a transaction:-
Atomicity
This characteristic of a transaction means that a transaction is performed
completely not performed at all. I.e. all the tasks in a transaction are
completed or none are completed. E.g. transferring money from one account to
another involves credit from one account and debit to another.
Consistency
This characteristic means that the database should be consistent
before and after the transaction. For a successful transaction database can
move from one state to another. Both the states should abide by the same rules.
For an unsuccessful transaction, if the transaction fails to abide by the rule
and leads to an inconsistent state, the transaction should be rolled back.
Isolation
A transaction should be isolated. This means that that no other operation
should be allowed to access or see the intermediate state data.
Durability
A transaction on completion must persist. It should withstand system failures
and should not be undone.
Explain various types of SQL Server transactions. I.e. Explicit, Autocommit and
Implicit Transactions.
Explicit transaction
A transaction which has START and END defined explicitly. The explicit
transaction mode lasts until the transaction is over. When the transaction is
over, the transaction is reverted back to the mode in which it started. This
mode could either be implicit or autocommit.
Autocommit transactions
This is the default mode of transaction. In this mode, if the
transaction is completed successfully, it is committed. If the transaction
faces any error, it is rolled back.
Implicit transactions
In this mode, a new transaction is started when the current is committed or
rolled back. Nothing is done to begin a transaction. One only needs to commit
or roll back a transaction. Implicit transactions have a chain of continuous
transactions.
What is distributed transactions in SQL Server? When are they used?
Distributed transactions involve two or more databases within a SQL server. The
management of such transactions is done by a component called as transaction
manager. Distributed transactions must be used when real time updates are
required simultaneously on multiple databases.
The answers to following questions will be made available soon.
Keep visiting.
Describe the characteristics of transactions i.e. atomicity, consistency,
isolation.
Explain the types of transaction i.e. explicit, autocommit and implicit
Explain the phases a transaction has to undergo.- already have ans
What is Distributed transaction?
What is nested transaction? Explain with an example.
|