Поделиться через


Farewell DBCC PRTIPAGE

Recently discovered that this DBCC (along with some other less commonly known undocumented/unsupported DBCC commands) has been removed from SQL Server 2012.

Part of the functionality you could exploit with DBCC PRTIPAGE still is available with DBCC PAGE.

In order to use it, you must specify 1) the WITH TABLERESULTS clause, 2) either 3 or 5 for printOption (fourth parameter passed to DBCC PAGE), and 3) an index page. Notice that 5 is a valid value for printOption as long as you have specified WITH TABLERESULTS, and the page whose Id you are passing as a parameter is an index page. Otherwise error 2560 (DBCC_INCORRECT_PARAMETER) is raised for fourth parameter.

If all previous conditions are met, DBCC PAGE ends up calling the same internal function DBCC PRTIPAGE used to call, after having parsed the parameters it received and after having looked into the metadata for the root page of the index.

DBCC PRTIPAGE finds the root page for you, while with DBCC PAGE you have to find that number before invoking it.

Another difference is that you can pass DBCC PRTIPAGE the level of the index pages in which you are interested; it will find the root and navigate down the tree until it finds the level you are interested in. Once at that level, it will iterate through all pages at that level and will therefore produce one resulset per index page at that level. With DBCC PAGE you cannot specify a level at all. Instead, whatever index page id you pass it as a parameter will be used to print out the contents of that page, and will stop at that point. It won’t walk the linked chain at that level of the index.