DBCC CHECKDB()

  • Hell all,
    I run manually the command DBCC CHECKDB() 
    I would like to run this command via job but the problem is that i cannt see the out put from the DBCC CHECKDB() command.

    I beleive that i am not the first person that created a job like that.
    Sio my question is how do you get the historical output of this job?

    Thanks in advance!

  • 89netanel - Thursday, January 19, 2017 8:35 AM

    Hell all,
    I run manually the command DBCC CHECKDB() 
    I would like to run this command via job but the problem is that i cannt see the out put from the DBCC CHECKDB() command.

    I beleive that i am not the first person that created a job like that.
    Sio my question is how do you get the historical output of this job?

    Thanks in advance!

    The output from DBCC can be written to a table with the TABLERESULTS option:

    DBCC CHECKDB ([<Db name>]) WITH ALL_ERRORMSGS, TABLERESULTS

    Then you can look at the data later.

  • If you don't want to roll your own CHECKDB routine and results storage, Gianluca Sartori (SpaghettiDBA) has an excellent script that will create a stored procedure you can then call in an Agent job, which will record the output to a table if you want here: https://spaghettidba.com/2013/02/27/dba_runcheckdb-v2012/

    I like it and use it on all my servers.

  • 89netanel - Thursday, January 19, 2017 8:35 AM

    Hell all,
    I run manually the command DBCC CHECKDB() 
    I would like to run this command via job but the problem is that i cannt see the out put from the DBCC CHECKDB() command.

    I beleive that i am not the first person that created a job like that.
    Sio my question is how do you get the historical output of this job?

    Thanks in advance!

    Recommend that you use the Ola Hallengren's Maintenance Solutions for this task

    😎

  • Hello all,

    Thank you for your quite response.

    I didn't know that TABLERESULTS is an option.

    I will create a table with the proper column and use the TABLERESULTS option.

    Again thanks a lot!!!

  • To be honest, if CheckDB runs successfully, there won't be any interesting output, plus you probably should run it with the NO_INFOMSGS option (the number of rows and pages in each table is of little interest), and with that option it produces no output at all on a clean run.

    Any errors checkDB finds will be written to the errorlog.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 6 posts - 1 through 5 (of 5 total)

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