Ad

Audit Trigger That Doesn't Fire For Alter Table, But Only For Dba Users

- 1 answer

Hi i'm in this situation, i'm a DBA and every time i alter a table with a not null field adding a default value, the audit trigger writes my username all over the place (of course, poor guy's just doing his job). Problem is that our developers don't like having my name on the audit tables so i need to find a way to work around this situation...maybe changing the trigger with an if condition? create a second one that i activate everytime i do that kind of operation? Better ideas???

Ad

Answer

The first response is to change the trigger with an if condition. If the powers-that-be don't care about NULL-ability changes on columns, then they shouldn't be audited.

However, I don't really like that solution. The audit history tables exist for a reason. Perhaps there is something else going on, such as a notification going out when changes are made. If so, the logic for the notification should change rather than the audit tables.

This is something akin to warnings versus errors when compiling code. Changing NULL-ability would still be in the audit tables so DBAs can see the full history of changes when they want to. That doesn't mean that they should be notified for every such change.

Note: this might require changing the trigger and adding a "priority level" or something similar to the audit table. This level can be used to set notifications.

Ad
source: stackoverflow.com
Ad