Results 1 to 5 of 5

Thread: Dbcc Checkdb

  1. #1
    Join Date
    Jul 2004
    Posts
    268

    Unanswered: Dbcc Checkdb

    Hi All,

    I have a job set up that runs the dbcc checkdb and puts the results into a table. Then I run a query against this table to check the results of dbcc checkdb. If there are errors, I get a page that lets me know that there are some problems. When I ran this job on my production server, the job failed stating that there are problems with data integrity. So I copied this db to a dev server and recreated the job just like I have in prod. The job completed successfully withou any errors. Can anybody tell me what to look at to figure out why it failed on the prod server?

    Thanks.

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    Can you post the errors from the production server? Also, which version of SQL Server is this?

  3. #3
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    right click on the job. go to view job history. hit the checkbox for show job details. go to the step that is failing and get the error message.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  4. #4
    Join Date
    Jul 2004
    Posts
    268
    There are no error messages. When I run dbcc checkdb, I also put results in the text file. The text file was created but it was empty. I checked view job history and each step in this job was successfull. I am on SQL 2k.

    This is a script that does the steps I mentioned before:

    DECLARE @checkdbcmd varchar(255)
    DECLARE @bcpcmd varchar(255)


    CREATE TABLE ##Result (Check_Log VARCHAR(1000))

    SET @checkdbcmd = 'osql -S server -d TestDB -U user -P password
    -Q "DBCC CHECKDB"'
    SET @bcpcmd = 'bcp "Select * from ##Result" queryout "S:\Test\IntegrityForTestDB.txt" -S server -U user -P password
    -c'

    INSERT ##Result(Check_Log)
    EXEC master..xp_cmdshell @checkdbcmd

    EXEC master..xp_cmdshell @bcpcmd

    IF EXISTS (SELECT * FROM ##Result
    WHERE Check_Log = 'CHECKDB found 0 allocation errors and 0 consistency errors in database')
    RETURN
    ELSE
    EXEC master..xp_cmdshell 'mailsend -f test@test.com -d test -smtp test -t test@test.com -sub "DBCC CheckDB Error For TestDB" -m C:\Scripts\TestStuff\BkupMsg.txt ', no_output

    drop table ##Result

  5. #5
    Join Date
    Jul 2004
    Posts
    268
    I fixed the problem, the server name was incorrect.

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •