Databases Reference
In-Depth Information
To lock a database, you include in your code a unique identifier for the
Database
object
and identifier of the lock object. Analysis Services checks whether the user has the appro-
priate permissions to lock the database. (Only server or database administrators can lock a
database.) If the user does have permission, Analysis Services grants the lock or adds the
request to the queue to wait for a lock. Analysis Services supports two types of locks:
exclusive locks and shared locks:
.
An exclusive lock prevents other sessions from obtaining a lock of either type until
the current lock lifts. It prevents any command from another session from execut-
ing. You can obtain an exclusive lock by specifying
CommitExclusive
in the
lock_mode
element of the
Lock
command.
.
A shared lock prevents any transaction from obtaining an exclusive lock on a data-
base. However, requests coming to the database continue to execute and other ses-
sions can obtain a shared lock. You can obtain a shared lock by specifying
CommitShared
in the
lock_mode
of the
Lock
command.
NOTE
A
Lock
command doesn't stop execution of other commands even if they change data
or metadata objects. The
Lock
command affects the committing of transactions for
only a very short time; and more precisely, it affects only getting a commit lock.
Canceling a Command Execution
If a command is issued by mistake or takes a long time to complete, the user might want
to cancel it. To make this possible, Analysis Services provides the
Cancel
command. You
call this command asynchronously, from a different connection, because the connection
that executes the command is waiting for a response to be sent back to the client and
cannot execute other commands. You can cancel your own command that is currently
running on the server, or a server or database administrator can cancel sessions or connec-
tions when he notices that there are sessions or connections that are no longer in use.
To cancel your own command that is currently running on the server, you can create
another connection, as a
SessionID
specify the identifier of the session the command to
cancel runs on and issue a
Cancel
command. (For information about how to specify the
session you need to work with as part of an XML/A request, see Chapter 32.) In this case,
the
Cancel
command has the following syntax:
<Cancel/>.
To delete a session, a server administrator can use the
Cancel
command with the proper-
ties shown in Listing 26.7.
Search WWH ::
Custom Search