In most of my servers I have dbcc checkdb scheduled to run.
I can get the last known good DBCC Checkdb through DBCC DBINFO().
I can read the tracks left on the sql server log and I get something like the picture below:
Or I can run the following script:
IF OBJECT_ID('TEMPDB..#MAINT') IS NOT NULL DROP TABLE #maint CREATE TABLE #maint (Results varchar(255) NULL) INSERT INTO #maint(Results) EXEC('master..xp_cmdshell ''sqlcmd -E -Q"dbcc checkdb([my_database])"''') select * from #maint
I could also have a look at the default trace.
what am I after?
How to find out how long did it take to run dbcc checkdb the last time.