AND resource_type <> 'DATABASE' ;
</source>
 
=== sys.dm_tran_locks ===
 
sys.dm_tran_locks wird benutzt um Informationen über die aktuellen Locks zu bekommen. Unten habe ich ein paar typische Felder aufgelistet. Da sind noch ein paar mehr, die Informationen können aber auch direkt in der [https://msdn.microsoft.com/de-de/library/ms190345.aspx MSDN] nachgelesen werden.
 
 
* '''request_mode''' – Mode of the request. For granted requests, this is the granted mode; for waiting requests, this is the mode being requested. Indicates whether the granted or requested lock is shared (S), exclusive (X), intent shared (IX), update (U), ... Key-range locks, used for SERIALIZABLE isolation, appear as RangeS-U, RangeS-S.
* '''request_type''' – Request type. The value is LOCK.
* '''request_status''' – Current status of this request. Possible values are GRANTED, CONVERT, WAIT, LOW_PRIORITY_CONVERT, LOW_PRIORITY_WAIT, or ABORT_BLOCKERS. For more information about low priority waits and abort blockers, see the low_priority_lock_wait section of ALTER INDEX (Transact-SQL).
* '''request_session_id''' – This value is the ID of the session that has requested the lock. The owning session ID can change for distributed (DTC) and bound transactions.
* '''request_reference_count''' – Returns an approximate number of times the same requestor has requested this resource.
* '''request_exec_context_id''' – Execution context ID of the process that currently owns this request.
* '''request_owner_type''' – Indicates the scope of the lock. The five possible values are: TRANSACTION, SHARED_TRANSACTION_WORKSPACE, EXCLUSIVE_TRANSACTION_WORKSPACE, CURSOR and SESSION.
* '''request_owner_id''' – This value is currently used only for requests with an owner of TRANSACTION, and the owner ID is the transaction ID. This column can be joined with the transaction_id column in the sys.dm_tran_active_transactions view.
* '''lock_owner_address''' – This value is the memory address of the internal data structure that is used to track this request. This column can be joined with the resource_address column in sys.dm_os_waiting_tasks if this request is in the WAIT or CONVERT state.
Änderungen – Software Entwicklung Projekte

Änderungen

MS-SQL display current locks in database

2.140 Byte hinzugefügt, 09:11, 4. Jul. 2015
/* Auslesen der Locks */
175
Bearbeitungen