Reading SQL ERror Lot Alerts Daily.

  • Hello Experts

    I am looking for a script/proc, to extract the error captured in a daily basic for the whole day and report to the DBA over email. Second part looks good as I can use sp_Sendemail to send the alerts to the DBA team but if anyone has any written script to capture error details, plz do share (for e.g, login failure, deadlock, and other critical alerts.)

    Thanks.....

    Thanks.

  • begin try

    drop table #errorLog

    end try

    begin catch

    end catch

    CREATE TABLE #ErrorLog (

    LogDate datetime,

    ProcessInfo nvarchar(100),

    LogText nvarchar(4000)

    )

    insert into #errorLog

    exec xp_readerrorlog 0, 1, null, null, '20150512 16:15', '20150512 16:55'

    /*

    Parameters:

    1 - Number of log file. 0 - current

    2 - Type : 1 - database engine log

    2 - agent log

    3 - ProcessInfo

    4 - Log text

    5 - from

    6 - to

    */

    select LogDate, LogText from #errorLog

    where ProcessInfo <> 'Backup'

    order by LogDate

  • SQL Guy's suggestion is good, only concern would be how the DBAs are going to react with all the verbosity unless you filter the result set.

    😎

  • SQL-DBA-01 (5/14/2015)


    Hello Experts

    I am looking for a script/proc, to extract the error captured in a daily basic for the whole day and report to the DBA over email. Second part looks good as I can use sp_Sendemail to send the alerts to the DBA team but if anyone has any written script to capture error details, plz do share (for e.g, login failure, deadlock, and other critical alerts.)

    Thanks.....

    try this

    http://www.wisesoft.co.uk/articles/dba_daily_checks_email_report.aspx

    solution of all your problem

    errors will be highlighted with RED

    WINNERS NEVER QUIT AND QUITTERS NEVER WIN

    sqlserversdba.wordpress.com

    WINNERS NEVER QUIT AND QUITTERS NEVER WIN

    sqlserversdba.wordpress.com

  • Thanks everyone. Now, yesterday I wrote one. I will upload that to the script section, please review and comment. Will do it in the coming week.

    Have a great weekend to all of you...!!!!!!

    Thanks.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply