Table of Contents

Class CompatibilitySchema.LockInfo

Namespace
LinqToDB.Tools.DataProvider.SqlServer.Schemas
Assembly
linq2db.Tools.dll

sys.syslockinfo (Transact-SQL)

Applies to: √ SQL Server (all supported versions)

Contains information about all granted, converting, and waiting lock requests.

important


This SQL Server 2000 system table is included as a view for backward compatibility. We recommend that you use the current SQL Server system views instead. To find the equivalent system view or views, see Mapping System Tables to System Views (Transact-SQL). This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.


important


This feature has changed from earlier versions of SQL Server. For more information, see Breaking Changes to Database Engine Features in SQL Server 2016.


See sys.syslockinfo.

[Table(Schema = "sys", Name = "syslockinfo", IsView = true)]
public class CompatibilitySchema.LockInfo
Inheritance
CompatibilitySchema.LockInfo
Extension Methods

Properties

ReqCryrefcnt

Reserved for future used. Always set to 0.

[Column("req_cryrefcnt")]
[NotNull]
public short ReqCryrefcnt { get; set; }

Property Value

short

ReqEcid

Execution context ID (ECID). Used to indicate which thread in a parallel operation owns a particular lock.

[Column("req_ecid")]
[NotNull]
public int ReqEcid { get; set; }

Property Value

int

ReqLifetime

Lock lifetime bitmap. During certain query processing strategies, locks must be maintained on resources until the query processor has completed a particular phase of the query. The lock lifetime bitmap is used by the query processor and transaction manager to indicate groups of locks that can be released when a certain phase of a query has finished running. Certain bits in the bitmap are used to indicate locks that are held until the end of a transaction, even if their reference count equals 0.

[Column("req_lifetime")]
[NotNull]
public int ReqLifetime { get; set; }

Property Value

int

ReqMode

Lock request mode. This column is the lock mode of the requester and represents either the granted mode, or the convert or waiting mode.

0 = NULL. No access is granted to the resource. Serves as a placeholder.

1 = Sch-S (Schema stability). Ensures that a schema element, such as a table or index, is not dropped while any session holds a schema stability lock on the schema element.

2 = Sch-M (Schema modification). Must be held by any session that wants to change the schema of the specified resource. Ensures that no other sessions are referencing the indicated object.

3 = S (Shared). The holding session is granted shared access to the resource.

4 = U (Update). Indicates an update lock acquired on resources that may eventually be updated. It is used to prevent a common form of deadlock that occurs when multiple sessions lock resources for potential update in the future.

5 = X (Exclusive). The holding session is granted exclusive access to the resource.

6 = IS (Intent Shared). Indicates the intention to place S locks on some subordinate resource in the lock hierarchy.

7 = IU (Intent Update). Indicates the intention to place U locks on some subordinate resource in the lock hierarchy.

8 = IX (Intent Exclusive). Indicates the intention to place X locks on some subordinate resource in the lock hierarchy.

9 = SIU (Shared Intent Update). Indicates shared access to a resource with the intent of acquiring update locks on subordinate resources in the lock hierarchy.

10 = SIX (Shared Intent Exclusive). Indicates shared access to a resource with the intent of acquiring exclusive locks on subordinate resources in the lock hierarchy.

11 = UIX (Update Intent Exclusive). Indicates an update lock hold on a resource with the intent of acquiring exclusive locks on subordinate resources in the lock hierarchy.

12 = BU. Used by bulk operations.

13 = RangeS_S (Shared Key-Range and Shared Resource lock). Indicates serializable range scan.

14 = RangeS_U (Shared Key-Range and Update Resource lock). Indicates serializable update scan.

15 = RangeI_N (Insert Key-Range and Null Resource lock). Used to test ranges before inserting a new key into an index.

16 = RangeI_S. Key-Range Conversion lock, created by an overlap of RangeI_N and S locks.

17 = RangeI_U. Key-Range Conversion lock, created by an overlap of RangeI_N and U locks.

18 = RangeI_X. Key-Range Conversion lock, created by an overlap of RangeI_N and X locks.

19 = RangeX_S. Key-Range Conversion lock, created by an overlap of RangeI_N and RangeS_S. locks.

20 = RangeX_U. Key-Range Conversion lock, created by an overlap of RangeI_N and RangeS_U locks.

21 = RangeX_X (Exclusive Key-Range and Exclusive Resource lock). This is a conversion lock used when updating a key in a range.

[Column("req_mode")]
[NotNull]
public byte ReqMode { get; set; }

Property Value

byte

ReqOwnertype

Type of object associated with the lock:

1 = Transaction

2 = Cursor

3 = Session

4 = ExSession

Note that 3 and 4 represent a special version of session locks, tracking database and file group locks, respectively.

[Column("req_ownertype")]
[NotNull]
public short ReqOwnertype { get; set; }

Property Value

short

ReqRefcnt

Lock reference count. Every time a transaction asks for a lock on a particular resource, a reference count is incremented. The lock cannot be released until the reference count equals 0.

[Column("req_refcnt")]
[NotNull]
public short ReqRefcnt { get; set; }

Property Value

short

ReqSpid

Internal Microsoft SQL Server Database Engine process ID of the session requesting the lock.

[Column("req_spid")]
[NotNull]
public int ReqSpid { get; set; }

Property Value

int

ReqStatus

Status of the lock request:

1 = Granted

2 = Converting

3 = Waiting

[Column("req_status")]
[NotNull]
public byte ReqStatus { get; set; }

Property Value

byte

ReqTransactionID

Unique transaction ID used in syslockinfo and in profiler event

[Column("req_transactionID")]
[Nullable]
public long? ReqTransactionID { get; set; }

Property Value

long?

ReqTransactionUOW

Identifies the Unit of Work ID (UOW) of the DTC transaction. For non-MS DTC transactions, UOW is set to 0.

[Column("req_transactionUOW")]
[Nullable]
public Guid? ReqTransactionUOW { get; set; }

Property Value

Guid?

RscBin

Binary lock resource. Contains the actual lock resource that is contained in the lock manager. This column is included for tools that know about the lock resource format for generating their own formatted lock resource, and for performing self joins on syslockinfo.

[Column("rsc_bin")]
[NotNull]
public byte[] RscBin { get; set; }

Property Value

byte[]

RscDbID

Database ID associated with the resource.

[Column("rsc_dbid")]
[NotNull]
public short RscDbID { get; set; }

Property Value

short

RscFlag

Internal resource flags.

[Column("rsc_flag")]
[NotNull]
public byte RscFlag { get; set; }

Property Value

byte

RscIndid

Index ID associated with the resource, if appropriate.

[Column("rsc_indid")]
[NotNull]
public short RscIndid { get; set; }

Property Value

short

RscObjID

Object ID associated with the resource, if appropriate.

[Column("rsc_objid")]
[NotNull]
public int RscObjID { get; set; }

Property Value

int

RscText

Textual description of a lock resource. Contains a part of the resource name.

[Column("rsc_text")]
[NotNull]
public string RscText { get; set; }

Property Value

string

RscType

Resource type:

1 = NULL Resource (not used)

2 = Database

3 = File

4 = Index

5 = Table

6 = Page

7 = Key

8 = Extent

9 = RID (Row ID)

10 = Application

[Column("rsc_type")]
[NotNull]
public byte RscType { get; set; }

Property Value

byte

RscValblk

Lock value block. Some resource types may include additional data in the lock resource that is not hashed by the lock manager to determine ownership of a particular lock resource. For example, page locks are not owned by a particular object ID. For lock escalation and other purposes. However, the object ID of a page lock may be included in the lock value block.

[Column("rsc_valblk")]
[NotNull]
public byte[] RscValblk { get; set; }

Property Value

byte[]