how to get table-name from the given PageID

  • Is there a way of getting table-name from the given PageID?

    For example, "SELECT waitresource FROM sysprocesses" gives the result

    "PAG:

    7:1:3630", and 3630 is the PageID. I need to determine the corresponding

    the

    table-name.

    Prakash

    Prakash Heda
    Lead DBA Team - www.sqlfeatures.com
    Video sessions on Performance Tuning and SQL 2012 HA

  • What SQL Server version are you using?

    Thomas Rushton
    blog: https://thelonedba.wordpress.com

  • SQL 2K WITH SP2 ON W2K ADVANCED SERVER

    Prakash

    Prakash Heda
    Lead DBA Team - www.sqlfeatures.com
    Video sessions on Performance Tuning and SQL 2012 HA

  • I would usually use DBCC PAGE to view the page in question; the page header indicates what object the page belongs to. For example, given the information you provided, I would execute:

    DBCC TRACEON(3604)

    GO

    DBCC PAGE (7, 1, 3630)

    GO

    DBCC TRACEOFF(3604)

    GO

    The result set will be divided into several sections. Look for the "Page Header" section, and in that section look for "m_objId"; the value following that is the object id of the object that owns the particular page. Use:

    SELECT OBJECT_NAME(object_id)

    replacing object_id with the object id you got from "m_objId" to get the name of the object that owns the page in question.

    Matthew Burr

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply