Sql Server DMV --- log of object use?

DMVs have tons of great info but what I am looking for is simple -- how frequently is a table, query, proc touched or run?  When was the last time, first time, etc.  What DMV  (or any other tool) can show me this?  Seeing last time Exec plan was run is not accurate, because exec  plan can be refreshed.
Hec RamseyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott PletcherSenior DBACommented:
SQL doesn't capture that info.  You would need to set up something to capture that info if you need it.
0
lcohanDatabase AnalystCommented:
You can use dm_exec_query_stats to get info about any query executed since last plan was cached:
https://msdn.microsoft.com/en-us/library/ms189741.aspx

 SELECT pa.value AS dbid,
        COALESCE(DB_NAME(st.dbid),
                 DB_NAME(CAST(pa.value as int))+'*',
                 'Resource') AS DBNAME,
        SUBSTRING(text,
         -- starting value for substring
         CASE WHEN statement_start_offset = 0
              OR statement_start_offset IS NULL
                THEN 1
                ELSE statement_start_offset/2 + 1 END,
         -- ending value for substring
         CASE WHEN statement_end_offset = 0
           OR statement_end_offset = -1
           OR statement_end_offset IS NULL
                THEN LEN(text)
                ELSE statement_end_offset/2 END -
                CASE WHEN statement_start_offset = 0
                           OR statement_start_offset IS NULL
                                THEN 1
                                ELSE statement_start_offset/2  END + 1
         )  AS TSQL,
         *
 FROM sys.dm_exec_query_stats  
    CROSS APPLY sys.dm_exec_sql_text(sql_handle) st
    OUTER APPLY sys.dm_exec_plan_attributes(plan_handle) pa
     WHERE attribute = 'dbid'
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vitor MontalvãoMSSQL Senior EngineerCommented:
No way to have that information unless you create an audit system and store all captured data in a database for later use.
0
Hec RamseyAuthor Commented:
thanks!!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.