how to get sql queries of past??

  • hello expert,

    if i have not set up profiler, is there any way to get, what sql queries have run in past, mean is, does Sql sevrer store all the sql queries upto some time of span??

    thanks in advance

    regards

    Zeal!!!!

  • Without some form of logging that you setup (like triggers or traces) - no.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • On second thought - there is the procedure cache.

    Try this:

    http://sqlserverpedia.com/wiki/Queries_in_Procedure_Cache

    Keep in mind, that this is not a fool proof method to retrieve past queries.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • you're not likely to get anything of any real use from the procedure cache for what you're asking, also be aware of the size of your cache before running queries against it - most useful queries involve cross applies to functions and can be resource heavy.

    Historically the best you'll be able to see is how many times plans have been used - however it won't tell you the start time of the plan, any number of things may cause a plan to be dropped/recompiled.

    I have Idera diagnostic manager, this can store sql queries historically, I've never tried to run reports about what runs, I use it to check back on blocks or issues when I'm not here as all our apps run 7 x 24

    [font="Comic Sans MS"]The GrumpyOldDBA[/font]
    www.grumpyolddba.co.uk
    http://sqlblogcasts.com/blogs/grumpyolddba/

  • In many case I set up sql service broker to catch querys and log in a table, but it's a "hand job"

  • can u please let me know, how a service broker helps us to catch queries and how to set it up?

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

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