Send Alert Email On Disabling DDL Trigger

  • Is there anyway to send alert email if someone disable the DDL trigger?

    Alert notification should include detail like who did disable the trigger, when it was done, Trigger name etc

    Please send me the script if possible

  • Thanks but this is more related to create DDL trigger and send alert for any DB OBJECT CHANGE events like Create/Alter/Drop etc

    I am looking to alert if someone disable the DDL trigger itself.

  • You can run a scheduled job to look for it w/ something like the following:

    declare @recipientCSV varchar(8000)='recipients@yourcompany.com';
    declare @subject varchar(1000)='ALERT - Trigger Missing or Disabled';
    declare @text varchar(max)='Trigger ALERT on  Server ' + @@servername;

    if not exists (select * from sys.server_triggers where name='TriggerName' and is_disabled=0)

    begin
    exec msdb.dbo.sp_send_dbmail
    @recipients = @recipientCSV,
    @body = @html,
    @body_format = 'text',
    @subject = @subject;
    end
  • We have such a system in place.  It won't stand up in court, though because, me being a DBA with SysAdmin privs (or anyone else with SysAdmin privs) could turn off the monitoring, have our way with things, and then turn it back on.

    IMHO, there would need to be some sort of external monitoring that would write to a file that virtually no one had access to but I'm not sure even that would stand up in court because someone always has access to anything.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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