Author |
Topic |
chris_cs
Posting Yak Master
223 Posts |
Posted - 2011-12-15 : 05:23:47
|
If I run CHECK DB on a particular database is the fact that I have done this stored in a system table somewhere?Thanks in advance----------------------------Junior DBA learning the ropes |
|
chris_cs
Posting Yak Master
223 Posts |
Posted - 2011-12-15 : 05:36:36
|
I think I've actually just found a way to get this using:DBCC TRACEON (3604)GODBCC PAGE (DBName, 1, 9, 3)GO There is a value called dbi_dbccLastknownGoodUnless there is another way of course?----------------------------Junior DBA learning the ropes |
 |
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2011-12-15 : 07:53:17
|
It's stored in the database header and written to the error log every time the database is opened (which is usually at restore and restart). That's not the last time checkDB ran. It's the last time that CheckDB completed without errors.--Gail ShawSQL Server MVP |
 |
|
chris_cs
Posting Yak Master
223 Posts |
Posted - 2011-12-15 : 08:39:35
|
Ok, thanks for the clarification Gail.----------------------------Junior DBA learning the ropes |
 |
|
chris_cs
Posting Yak Master
223 Posts |
Posted - 2011-12-30 : 05:00:57
|
Just thought I'd point out you can also use this:DBCC DBINFO(DBNAME) WITH TABLERESULTS There is a field called dbi_dbccLastKnownGood in the output.----------------------------Junior DBA learning the ropes |
 |
|
Kristen
Test
22859 Posts |
Posted - 2011-12-30 : 05:48:07
|
Interesting, but that gives me "current time" when I ran DBCC DBINFO - or am I missing something? |
 |
|
chris_cs
Posting Yak Master
223 Posts |
Posted - 2011-12-30 : 06:02:52
|
Current time in the dbi_dbccLastKnownGood field?----------------------------Junior DBA learning the ropes |
 |
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2011-12-30 : 06:12:27
|
quote: Originally posted by chris_cs Just thought I'd point out you can also use this:DBCC DBINFO(DBNAME) WITH TABLERESULTS There is a field called dbi_dbccLastKnownGood in the output.
Yup, and it's exactly the same thing that the DBCC Page would have shown, just a different command to read it (DBInfo reads and displays values from the DB's header page)--Gail ShawSQL Server MVP |
 |
|
Kristen
Test
22859 Posts |
Posted - 2011-12-30 : 06:30:17
|
quote: Originally posted by chris_cs Current time in the dbi_dbccLastKnownGood field?
Hmmm ... no. The time I ran it earlier. How bizarre, I'm sure I didn't run CHECKDB at that time.Can't seem to reproduce that effect now. |
 |
|
chris_cs
Posting Yak Master
223 Posts |
Posted - 2011-12-30 : 06:32:46
|
This command is another one of the undocumented ones isn't it?If so, why aren't they properly documented? This command is really helpful for an issue I have at the moment.----------------------------Junior DBA learning the ropes |
 |
|
Kristen
Test
22859 Posts |
Posted - 2011-12-30 : 06:33:52
|
Hahaha ... well I checked the ERRORLOG:2011-12-30 10:45:25.34 spid61 DBCC CHECKDB (MyDatabase) WITH no_infomsgs, data_purity executed by KRISTEN found 0 errors and repaired 0 errors.Looks like I ran it without realising it. Ho Hum .... |
 |
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2011-12-30 : 08:31:23
|
Yes, this is undocumented. Why it is so, only MS knows. The downside of it being undocumented is that the command can change syntax or output or even disappear with no warning.--Gail ShawSQL Server MVP |
 |
|
|