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.Can you post the errors from the production server? Also, which version of SQL Server is this?|||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.|||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|||I fixed the problem, the server name was incorrect.
Thanks.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment