Lock Element (XMLA)
Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).
Locks a specified object on a Microsoft SQL Server Analysis Services instance.
The Lock command locks an object, either for shared or exclusive use, within the context of the currently active transaction. Only database administrators or server administrators can explicitly issue a Lock command. A lock on an object prevents transactions from committing until the lock is removed. Analysis Services 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.
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.
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.