FIND LAST QUERIES FIRED ON MY DATABASE

  • Hi All,

    Can you tell me the solution to find out the queries fired on SQL2005 database since 1 week/month. Can i get it from the .LDF files??

    Thanks & Regards,

    Sashikanta

  • Not without a trace running. (profiler/server-side)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hi Gila,

    But in Oracle there is a table which traces last 1000 queries fired on the same database. Can i get any kind of info from .LDF files

    Thanks & Regard,

    Sashikanta Mishra

  • sashikanta.mishra (12/23/2008)


    But in Oracle there is a table which traces last 1000 queries fired on the same database.

    That's Oracle.

    Can i get any kind of info from .LDF files

    You can get the data that was changed, not the exact queries that were run. Thing it, you're going to have to buy a log reader tool for that, and they're not cheap. Plus the tran log is not going to go back a month. Only to the last transaction log backup (in full or bulk logged recovery) or checkpoint (in simple)

    You can get some of the queries from the plan cache (look ujp sys.dm_exec_query_stats), but that will be by no means a complete list (entries are discarded when the plan is removed from cache) and it's not a straightforward history.

    Bottom line, if you want a log of queries run, use a server-side trace.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hello Gail,

    Nice to see your reply.

    Thanks anyway.

    Regards,

    Sashikanta Mishra!

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

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