DBCC CHECK
-------------------
-------------------
This DBCC command is used for checking the database consistency and it will send mail to recipients .This using in our production environment.
-- DBCC check
IF (DATEPART(DW ,GETDATE()) = 1)
BEGIN
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'ADMIN',
@recipients='krishna.sqlexpress@gmail.com',
@subject = 'DBCC OUTPUT : if any errors , contact ADMIN',
@query = 'DBCC CHECKDB (KRISHDB)',
@query_attachment_filename= 'DBCC_FULL_CHECK_output.txt',
@query_result_header = 0,
@query_result_width = 105,
@attach_query_result_as_file = 1
--PRINT 'SATURDAY'
END
No comments:
Post a Comment