Script run history

  • Morning all

    Is there any way I can retrieve details about a script that was a run outside of a scheduled job?

    Looking for duration times etc.

    Are these recorded anywhere ?

  • Only if you are running a detailed trace.

    In most environments capturing every script/query is a massive overhead simple because of the TPS.

  • You can get aggregate information about queries from the dynamic management objects (DMO), specifically by querying sys.dm_exec_query_stats. But, that assumes that the query is still in cache. If it's aged out of cache or recompiled since the time you were interested in, the information won't be there. But, it's not a history of all times that the query ran, just an aggregate.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 3 posts - 1 through 2 (of 2 total)

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