views:

105

answers:

2

Hi,

Using Tsql, how can i know when DBCC checkdb was last run on SQL server (2000, 2005 or 2008)?

Regards

+1  A: 

From http://www.sqlskills.com/BLOGS/PAUL/post/CHECKDB-From-Every-Angle-When-did-DBCC-CHECKDB-last-run-successfully.aspx:

DBCC TRACEON (3604); 
GO

-- page 9 is the boot page
DBCC PAGE (dbname, 1, 9, 3);
GO

You need to look for the dbi_dbccLastKnownGood field. That was the last time that DBCC CHECKDB ran without finding any corruptions.

Paul Kearney - pk
thanks you very much
Manjot
+1  A: 

on 2005 and up you can run

DBCC DBINFO ('YourDatabaseName') WITH TABLERESULTS

look for dbi_dbccLastKnownGood

SQLMenace
Great. Just what I was looking for. Thanks
Manjot