October 10, 2006 at 8:58 am
How can I know when an application or user executes an speciic query?, I need to monitor this special query because is using a lot of resources.
I've ready asked users and developers and no one knows who creates that query.
Thanks for any sugesstion.
October 10, 2006 at 3:54 pm
If it is a storedprocedure being called then you can modify it to quietly insert a line into a log table with the login/user/machine/datetime info. If the query involves updates, inserts to, or deletes from a rarely used table you can add a trigger to do something similar. If performance is not an issue, you can temporarily use the SQL Profiler or some third-party auditing tool to monitor the server (though that is probably how you know which "specific" query to look for in the first place). You can log that activity to a file you can parse or a table you can query, intermittently off a running script or via a scheduler. Other than that, I recommend that you reevaluate your permissions.
October 11, 2006 at 3:42 am
What is the query that is being run?
October 11, 2006 at 7:47 am
To set up Profiler, you can track the SP:starting event.
You want Profiler to report the object_id column., To determine the object_id, run this query:
select object_id('<name of SP>') in the database containing the sp.
You can then set a filter in Profiler to only show executions of the stored procedure you want to track.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply