October 27, 2016 at 12:24 am
Hi guys
is it possible to retrieve queries which ran a week ago in a sql server database.
So far i'm only able to retrieve up to one day using the below query :
SELECT
deqs.last_execution_time AS [Time], dest.TEXT AS [Query] , total_elapsed_time as total_query_time
FROM
sys.dm_exec_query_stats AS deqs
CROSS
APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
ORDER BY deqs.last_execution_time DESC.
but I need to go back in history to earlier than that
October 27, 2016 at 3:06 am
sqlserverDBA2016 (10/27/2016)
Hi guysis it possible to retrieve queries which ran a week ago in a sql server database.
So far i'm only able to retrieve up to one day using the below query :
SELECT
deqs.last_execution_time AS [Time], dest.TEXT AS [Query] , total_elapsed_time as total_query_time
FROM
sys.dm_exec_query_stats AS deqs
CROSS
APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
ORDER BY deqs.last_execution_time DESC.
but I need to go back in history to earlier than that
Without specific auditing, no.
😎
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply