February 5, 2018 at 7:06 am
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
February 5, 2018 at 7:10 am
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
February 5, 2018 at 7:14 am
Thanks John,did you do so
February 5, 2018 at 7:22 am
Can i not create an alert?
February 5, 2018 at 7:34 am
tmmutsetse - Monday, February 5, 2018 7:22 AMCan 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.
February 6, 2018 at 2:09 am
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
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply