Finding the last run of DBCC CHECKDB

  • I'm looking for a way to find and store the last run of DBCC CHECKDB to a table.  I can see it in job history but I don't always run it from a job.  I also can see it by running xp_readerrorlog.  However, I can't seem to get that to select into a table.  Has anyone done something like this before?  I think if I can get xp_readerrorlog to insert into a table, I can easily search the table for DBCC CHECKDB.

    Thanks!


    Darren

  • YOu can create a user table to hold the status of DBCC process. If you run this in QA, start with a getdate() and end with the same function.

    create table DBCC_status (id int identity, status varchar(10), crn_date datetime default getdate())

    Right before DBCC starts:

    insert into DBCC_status values ('start') 

    After DBCC finishes:

    insert into DBCC_status values ('finish') 

    But why do you want to do it this way? The other methods you've mentioned are more common.

  • I guess I'm looking for a remote way to monitor when DBCC CHECKDB was last run.  This would be a part of a tool so I wouldn't know how the user originally submitted the command.  That's why I'm trying to read the error logs.  I may just have to parse it outside sql using vbscript.

    Thanks


    Darren

  • Run DBCC Checkdb on schedule or check database integrity as part of the maintenace plan. Do you still need to query  after you do that?

    Regards,Yelena Varsha

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply