Database Reference
In-Depth Information
Cancelling a session
If you have managed SQL Server or other relational database systems, you should be
familiar with the unambiguous KILL command that disconnects the offending session
and terminates the query executed on that session. Analysis Services has a similar
statement, though it uses a somewhat milder term, CANCEL , perhaps more appropri-
ate for the type of operation it performs. After all, the impact of terminating the session
isn't always immediate, even in relational systems. If a user is running a large trans-
action affecting thousands or millions of records, it could take a long time to roll such
transactions back. The CANCEL command is also different from KILL in a sense that
it doesn't immediately terminate the session or query. Rather it tags the session to be
terminated. SSAS periodically checks sessions and takes action on those sessions
that have been tagged.
How to do it...
You can terminate a session using SSMS or ASCMD by performing the following
steps:
1. Query $system.DISCOVER_SESSIONS , as shown earlier in this chapter, to
find the server process identifier ( SPID ) of the session you wish to cancel.
2. Execute the XMLA command, similar to the following, to tag the session to be
cancelled (substitute the correct SPID value):
<Cancel xmlns =
"http://schemas.microsoft.com/
analysisservices/2003/engine">
<SPID>2790</SPID>
</Cancel>
Tip
Cancelling a large processing or synchronization operation can take a long
time because SSAS has to rollback the work it has done up to the second
when the CANCEL command was issued.
Search WWH ::




Custom Search