Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

Managing Transactions (XMLA)

Every XML for Analysis (XMLA) command sent to an instance of Microsoft SQL Server 2005 Analysis Services (SSAS) runs within the context of a transaction on the current implicit or explicit session. To manage each of these transactions, you use the BeginTransaction, CommitTransaction, and RollbackTransaction commands. By using these commands, you can create implicit or explicit transactions, change the transaction reference count, as well as start, commit, or roll back transactions.

A transaction is either implicit or explicit:

Implicit transaction

Analysis Services creates an implicit transaction for an XMLA command if the BeginTransaction command does not specify the start of a transaction. Analysis Services always commits an implicit transaction if the command succeeds, and rolls back an implicit transaction if the command fails.

Explicit transaction

Analysis Services creates an explicit transaction if the BeginTransaction command starts of a transaction. However, Analysis Services only commits an explicit transaction if a CommitTransaction command is sent, and rolls back an explicit transaction if a RollbackTransaction command is sent.

In addition, Analysis Services rolls back both implicit and explicit transactions if the current session ends before the active transaction completes.

Analysis Services maintains a transaction reference count for each session. However, Analysis Services does not support nested transactions in that only one active transaction is maintained per session. If the current session does not have an active transaction, the transaction reference count is set to zero.

In other words, each BeginTransaction command increments the reference count by one, while each CommitTransaction command decrements the reference count by one. If a CommitTransaction command sets the transaction count to zero, Analysis Services commits the transaction.

However, the RollbackTransaction command rolls back the active transaction regardless of the current value of the transaction reference count. In other words, a single RollbackTransaction command rolls back the active transaction, no matter how many BeginTransaction commands or CommitTransaction commands were sent, and sets the transaction reference count to zero.

The BeginTransaction command begins an explicit transaction on the current session and increments the transaction reference count for the current session by one. All subsequent commands are considered to be within the active transaction, until either enough CommitTransaction commands are sent to commit the active transaction or a single RollbackTransaction command is sent to roll back the active transaction.

The CommitTransaction command commits the results of commands that are run after the BeginTransaction command was run on the current session. Each CommitTransaction command decrements the reference count for active transactions on a session. If a CommitTransaction command sets the reference count to zero, Analysis Services commits the active transaction. If there is no active transaction (in other words, the transaction reference count for the current session is already set to zero), a CommitTransaction command results in an error.

The RollbackTransaction command rolls back the results of commands that are run after the BeginTransaction command was run on the current session. The RollbackTransaction command rolls back the active transaction, regardless of the current transaction reference count, and sets the transaction reference count to zero. If there is no active transaction (in other words, the transaction reference count for the current session is already set to zero), a RollbackTransaction command results in an error.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.