Is it possible to read data in another session's temporary table?

后端 未结 2 547
春和景丽
春和景丽 2020-12-18 00:54

We\'re maintaining (and occasionally debugging) a large in-house system. The system has 20+ databases, and a number of servers interfacing to other systems, processing data,

2条回答
  •  有刺的猬
    2020-12-18 01:28

    Unwieldy but you can examine the tables pages from an admin logon.

    Get object id;

    select object_id from tempdb.sys.tables where name like '#mystuff%'
    

    Get a list of allocated pages;

    dbcc ind('tempdb', , -1)
    
    
    

    for each of the PageFID / PagePID (file/page IDs)

    dbcc traceon(3604);
    dbcc page(tempdb, , , 3) with tableresults
    

    If I create #mystuff from another session I can see in a dbcc page view from my own session:

    Slot 0 Offset 0x60 Length 18    Slot 0 Column 1 Offset 0xb Length 7 Length (physical) 7 myFieldName MyValue
    

    提交回复
    热议问题