SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


DatabaseIntegrity CheckDB Job


DatabaseIntegrity CheckDB Job

Author
Message
tmmutsetse
tmmutsetse
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1572 Visits: 470
Hi, i am using the ola's script for checkDB integrity,its all working well and i set the job to send me the email when the job succeeds.Is it possible to get the results in the mail?
eg. CHECKDB found 0 allocation errors and 0 consistency errors in database 'TSQL2012'.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

Thank you
John Mitchell-245523
John Mitchell-245523
SSC Guru
SSC Guru (110K reputation)SSC Guru (110K reputation)SSC Guru (110K reputation)SSC Guru (110K reputation)SSC Guru (110K reputation)SSC Guru (110K reputation)SSC Guru (110K reputation)SSC Guru (110K reputation)

Group: General Forum Members
Points: 110009 Visits: 18620
I tried something like this myself. I think you need to create a table for the results and then modify the stored procedure to run DBCC CHECKDB with the (undocumented) TABLERESULTS parameter.

John
tmmutsetse
tmmutsetse
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1572 Visits: 470
Thanks John,did you do so
tmmutsetse
tmmutsetse
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1572 Visits: 470
Can i not create an alert?
John Mitchell-245523
John Mitchell-245523
SSC Guru
SSC Guru (110K reputation)SSC Guru (110K reputation)SSC Guru (110K reputation)SSC Guru (110K reputation)SSC Guru (110K reputation)SSC Guru (110K reputation)SSC Guru (110K reputation)SSC Guru (110K reputation)

Group: General Forum Members
Points: 110009 Visits: 18620
tmmutsetse - Monday, February 5, 2018 7:22 AM
Can i not create an alert?

What kind of alert? You can use the TABLERESULTS option and query the ensuing table, you can read the errorlog, or you can attempt to capture the message output of the DBCC command. Only you know what your exact requirements are, and only you know what infrastructure you have in place to satisfy those requirements. I would recommend that you read the Understanding DBCC Error Messages and Error Reporting sections of this page.

John


Sean Pearce
Sean Pearce
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12305 Visits: 3512
DECLARE
@Email SYSNAME = 'me@domain.co.xx',
@Query NVARCHAR(MAX) = N'DBCC CHECKDB(' + QUOTENAME(DB_NAME()) + ') WITH ALL_ERRORMSGS, NO_INFOMSGS';

EXEC msdb..sp_send_dbmail
@profile_name = 'ProfileName',
@recipients = @Email,
@subject = 'Subject',
@query = @Query




The SQL Guy @ blogspot

@SeanPearceSQL

About Me
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search