SQL Server Database Information Query – using DBCC DBINFO & DBCC PAGE

Hi Friends,

Today, I am focusing on the use of an undocumented command DBCC DBINFO. By using this command you can get some more interesting information about SQL Server Database Information Query. Actually, DBCC DBINFO gives you the information about metadata of the database which you provide as parameter. To see the output you have to turn on the trace flag 3604.

DBCC TRACEON (3604)
GO
DBCC DBINFO (SQLGEEKS)

1_SQL_Server_Database_Information_using_DBCC_DBINFO_&_DBCC_PAGE

2_SQL_Server_Database_Information_using_DBCC_DBINFO_&_DBCC_PAGE

From the above output you can get the information about database id, create date, compatibility level, Last log backup time etc. Here most useful information is db_dbccLastKnownGood. Which tells us the time when dbcc checkdb command last run successfully? This information will be very useful when you want to overcome from corruption problem.

   

Now another interesting thing is you can get all this information by using DBCC PAGE command. We know that Page of id 9 is the database boot page means it contain all the metadata information about that database.

DBCC TRACEON (3604)
GO
DBCC PAGE ('SQLGEEKS',1,9,3)

3_SQL_Server_Database_Information_using_DBCC_DBINFO_&_DBCC_PAGE

So you can use DBCC DBINFO or DBCC PAGE to get such type of information.

 

Regards

Prince Rastogi

Like us on FaceBook Follow us on Twitter | Join the fastest growing SQL Server group on FaceBook

Follow me on Twitter  |  Follow me on FaceBook

   

About Prince Rastogi

Prince Rastogi is working as Database Administrator at Elephant Insurance, Richmond. He is having more than 8 years of experience and worked in ERP Domain, Wealth Management Domain. Currently he is working in Insurance domain. In the starting of his career he was working on SQL Server, Internet Information Server and Visual Source Safe. He is post graduate in Computer Science. Prince is ITIL certified professional. Prince likes to explore technical things for Database World and Writing Blogs. He is Technical Editor and Blogger at SQLServerGeeks.com. He is a regular speaker at DataPlatformDay events in Delhi NCR. He has also presented some in depth sessions about SQL Server in SQL Server Conferences in Bangalore.

View all posts by Prince Rastogi →

One Comment on “SQL Server Database Information Query – using DBCC DBINFO & DBCC PAGE”

  1. db_dbccLastKnownGood value is NOT 100% updated correctly every time DBA runs/schedule DBCC CHECKDB command.

    It works only with PHYSICAL_ONLY clause. Perhaps you want to give a try.

Leave a Reply

Your email address will not be published.