Locking and Unlocking Databases (XMLA)
You can lock and unlock databases using, respectively, the Lock and Unlock commands in XML for Analysis (XMLA). Typically, other XMLA commands automatically lock and unlock objects as needed to complete the command during execution. You can explicitly lock or unlock a database to perform multiple commands within a single transaction, such as a Batch command, while preventing other applications from committing a write transaction to the database.
Locking Databases
The Lock command locks an object, either for shared or exclusive use, within the context of the currently active transaction. A lock on an object prevents transactions from committing until the lock is removed. Microsoft SQL Server 2005 Analysis Services (SSAS) supports two types of locks, shared locks and exclusive locks. For more information about the lock types supported by Analysis Services, see Mode Element (XMLA).
Analysis Services allows only databases to be locked. The Object element must contain an object reference to an Analysis Services database. If the Object element is not specified or if the Object element refers to an object other than a database, an error occurs.
Sicherheitshinweis: |
---|
Only database administrators or server administrators can explicitly issue a Lock command. |
Other commands implicitly issue a Lock command on an Analysis Services database. Any operation that reads data or metadata from a database, such as any Discover method or an Execute method running a Statement command, implicitly issues a shared lock on the database. Any transaction that commits changes in data or metadata to an object on an Analysis Services database, such as an Execute method running an Alter command, implicitly issues an exclusive lock on the database.
Unlocking Objects
The Unlock command removes a lock established within the context of the currently active transaction.
Sicherheitshinweis: |
---|
Only database administrators or server administrators can explicitly issue an Unlock command. |
All locks are held in the context of the current transaction. When the current transaction is committed or rolled back, all locks defined within the transaction are automatically released.
Siehe auch
Verweis
Lock Element (XMLA)
Unlock Element (XMLA)
Konzepte
Using XML for Analysis in Analysis Services (XMLA)