Lock resource type in sqlserver: RID key PAG ext tab dB fil

Source: Internet
Author: User
Lock resource type in sqlserver: RID key PAG ext tab dB fil

When Detecting deadlocks, The sp_lock stored procedure is used, which contains a column: type, that is, the lock resource type.

Which resources can be locked by sqlserver?

The resources that can be locked include the RID key PAG ext tab dB fil.

The following is an explanation of the meaning of different types of resources. Only by understanding what they mean can we really understand blocking.

RID: The identifier in the format of fileid: pagenumber: RID, where fileid identifies the file containing the page, pagenumber identifies the page containing the row, and rid identifies the specific row on the page.

The fileid matches the file_id column in the SYS. databases_files directory view.

For example, when running sp_lock, a row of resource columns shows that the RID is 1: 6681: 26, and the Status column shows wait,

It means locking resources on the 6,681st rows on the 26th page of the first data file.

To view the data on this page, you can use DBCC page ()

 

Key: the internal hexadecimal number used by the database engine.

This value corresponds to SYS. Partions. hobt_id, indicating that the lock is on an index. You can find this index by querying the corresponding object_id and index_id in the SYS. partitions view.

 

PAG: number in the format of fileid: pagenumber, where fileid identifies the file containing the page, pagenumbe identification page

Ext: the number on the first page of the identification area. The format of this number is fileid: pagenumber

Tab: No information is provided, because the table is identified in the objid column in sp_lock.

DB: No information is provided, because the database is identified in the dbid column in sp_lock.

FIL: the object identifier, which matches the file_id column in the SYS. database_files directory view.

With the names of these resources, you can find the resource on which the blocking occurs

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.