I am reading this article: Inside the Storage Engine: Anatomy of a page.
I have a database
MyDB, and there is a table
MyTable in the database.
I have the following questions:
If I do as follows:
(1) use the following query to find the object ID for a table:
Use MyDB; select sys.objects.name, sys.objects.object_id from sys.objects where (name = 'MyTable');
(2) then use the following command to find all pages allocated to
dbcc ind(MyDB, 'MyTable', -1);
(3) then in the result table, I choose one of the data pages (page type = 1), and use the following command:
DBCC TRACEON(3604); DBCC PAGE (MyDB, 1, 17386, 3);
Then in the dumped content (page header) of step (3), the
AllocUnitId.idObj) field should equal to the object ID obtained in step (1). Is that correct?
And whether that works for both user tables and system base tables, such as
Based on my test, the above two conclusion are both correct.
What is the meaning of Metadata: ObjectId? In article, the ‘metadata: objectId’ <>
m_objId. But from my own tests, the ‘metadata: objectId’ always equals to
m_objId. Why? The original article does not explain the metadata clearly.
I am using SQL Server 2005, 2008, 2008 R2, 2012 and 2014