Validate SQL Server 2005 Changes

Is there a built-in way in SQL Server 2005 to test things like dropping a stored procedure? Is there a history table that I can query? We have a sproc secret that has disappeared several times.

+1


source to share


6 answers


You can create this with DDL triggers:



http://msdn.microsoft.com/en-us/library/ms190989.aspx

+3


source


Only if you are using DDL triggers or use a profiler to track the text "% DROP% PROC% procname%"



+2


source


Note that in SQL Server 2008 they also have AUDIT to replace Profiler traces for audit activities. It is similar but has its own UI and UI for viewing results

+1


source


You can set up a profiler trace to capture the Audit Object Management event and filter based on the name of the database you care about. Every time an object in the schema is created, dropped, edited, it fires an event in the profiler that includes the person who made the change and the name of the stored procedure.

You will need at least these profiler columns: ApplicationName - the username of the application started when the DatabaseName changed - the Databse containing the object changed by EventSubClass - The action type shows Alter, Modify, Drop, Create, etc. LoginName - Change User ObjectName - Affected Object

0


source


[last but adds details on how to see who made changes even before the audit system is implemented]

Others have already looked at various ways to run data audits to track future changes, but if you didn't have any kind of auditing system in the first place, then it is very difficult to figure out who did what and when historically.

The only option is to try to read the transaction log, assuming the database is in full recovery mode. The problem is that this is not supported by default. Possible options:

See these sections for details:

Viewing the Transaction Log in SQL Server 2008

SQL Server Transaction Explorer / Analyzer

How to view query history in SQL Server Management Studio

0


source


I agree. This could be a SQL Server Profiler with filters. DDL triggers existed in SQL Server. You can create something like this:

 CREATE TRIGGER ddl_drop_procedure 
    ON DATABASE 
    FOR DROP_PROCEDURE
   AS 
     RAISERROR ('You deleted a stored procedure',10, 1)

   GO

      

Another option is to use third party tools like Auto Audit from codeplex or apexSQL trigger.

0


source







All Articles