What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to several SQL Server databases. You create a function that modifies customer records that are stored in multiple databases.
All updates for a given record are performed in a single transaction. You need to ensure that all transactions can be recovered. What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to several SQL Server databases. You create a function that modifies customer records that are stored in multiple databases.
All updates for a given record are performed in a single transaction. You need to ensure that all transactions can be recovered. What should you do?

A.
Call the RecoveryComplete method of the TransactionManager class.

B.
Call the EnlistDurable method of the Transaction class.

C.
Call the Reenlist method of the TransactionManager class.

D.
Call the EnlistVolatile method of the Transaction class.

Explanation:
Enlisting Resources as Participants in a Transaction
(http://msdn.microsoft.com/en-us/library/ms172153.aspx)

Implementing a Resource Manager
(http://msdn.microsoft.com/en-us/library/ms229975.aspx)

Committing a Transaction in Single-Phase and Multi-Phase
(http://msdn.microsoft.com/en-us/library/ckawh9ct.aspx)

—————————————————————————————————–
TransactionManager Class contains methods used for transaction management. This class cannot be inherited.
Transaction Class Represents a transaction.

EnlistDurable(Guid, IEnlistmentNotification, EnlistmentOptions) – Enlists a durable resource manager that supports two phase commit to participate in a transaction.
EnlistDurable(Guid, ISinglePhaseNotification, EnlistmentOptions) – Enlists a durable resource manager that supports single phase commit optimization to participate in a transaction.
EnlistVolatile(IEnlistmentNotification, EnlistmentOptions) – Enlists a volatile resource manager that supports two phase commit to participate in a transaction.
EnlistVolatile(ISinglePhaseNotification, EnlistmentOptions) – Enlists a volatile resource manager that supports single phase commit optimization to participate in a transaction.

TransactionManager.Reenlist() Reenlists a durable participant in a transaction. A resource manager facilitates resolution of durable enlistments in a transaction
by reenlisting the transaction participant after resource failure.
Transaction.EnlistVolatile() Enlists a volatile resource manager to participate in a transaction. Volatile resource managers cannot recovery from failure
to complete a transaction in which they were participating. For more information on volatile and durable resources,
as well as how to enlist a resource, see Implementing A Resource Manager.
Transaction.EnlistDurable() Enlists a durable resource manager to participate in a transaction.
TransactionManager.RecoveryComplete() Notifies the transaction manager that a resource manager recovering from failure has finished reenlisting in all unresolved transactions.
All durable resource managers should do recovery when they first start up by calling the Reenlist method for each outstanding transaction.
Only when all of the reenlistments are done should the resource manager call RecoveryComplete.

TransactionManager.Reenlist() Method
(http://msdn.microsoft.com/en-us/library/system.transactions.transactionmanager.reenlist.aspx)

Transaction.EnlistVolatile() Method
(http://msdn.microsoft.com/en-us/library/system.transactions.transaction.enlistvolatile.aspx)

Transaction.EnlistDurable()
(http://msdn.microsoft.com/en-us/library/system.transactions.transaction.enlistdurable.aspx)

TransactionManager.RecoveryComplete() Method
(http://msdn.microsoft.com/en-us/library/system.transactions.transactionmanager.recoverycomplete.aspx)

Volatile resource managers cannot recovery from failure to complete a transaction in which they were participating. To obtain a durable enlistment in a transaction, use the EnlistDurable method. For more information on volatile and durable resources, as well as how to enlist a resource, see Implementing A Resource Manager. For more information on how a resource manager responds to commit notification and prepare the commit, see Committing A Transaction In Single-Phase and Multi-Phase.

http://msdn.microsoft.com/en-us/library/ms149779.aspx



Leave a Reply 1

Your email address will not be published. Required fields are marked *


Jim BBQ

Jim BBQ

This is the same question as #121