How to track when/what scripts are executed against SQL

  • Is there a way to track when and what script was ran against SQL? A few days back I had a situation where there was a major update ran against a large production table and none of the developers have admitted responsibility. I believe this was done via EM or Query Analyzer.

    Being that it took place 2 or 3 days ago, there was not much to see via SQL. I tried the event viewer on the SQL server and did not see anything related.

    I think for now (unless someone can tell me otherwise) finding who ran what is a worthless point. But going forward, is there anything that I can setup via SQL or Windows that would allow me to log sql scripts and other related info?

    Any ideas? Thanks!

  • I'd use Profiler. You can trap all kinds of info. Be aware of potential performance degradation if you're running it on a lot of events for an extended period of time.

    -- You can't be late until you show up.

  • If you would like to focus scripts running against your server, do not forget to set filters and columns in the Profiler.

  • Other than profiler, I think your other option would be to use software that is capable of analyzing transaction logs. That software is rather expensive.

  • Going forward, any database auditing solution can help track changes. There are many ways of implementing auditing, although most involve using triggers.

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

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