How Long DBCC Shrinkdatabase command took to run last week on SQL server ent 2008 R2?
Posted on 2013-05-09
i had a collegue run the command DBCC SHRINKDATABASE(dbname,10) last week on my SQL server 2008 R2 on saturday and my collegue told me it ran successfully but forgot to let me know how long it took to run. Today i'm back at work and its is thursday and i want to find out how long it took to run. I ran the following Query to try to find out how long DBCC SHRINKDATABASE took to run but i'm not able to find DBCC SHRINKDATABASE query anywhere, i also looked at SQL logs/error logs and there is nothing there. IS there anyway to find out how long it took? any help will be appreciated.
SELECT DISTINCT TOP 100
s.execution_count AS ExecutionCount,
s.max_elapsed_time AS MaxElapsedTime,
ISNULL(s.total_elapsed_time / s.execution_count, 0) AS AvgElapsedTime,
s.creation_time AS LogCreatedOn,
ISNULL(s.execution_count / DATEDIFF(s, s.creation_time, GETDATE()), 0) AS FrequencyPerSec
FROM sys.dm_exec_query_stats s
CROSS APPLY sys.dm_exec_sql_text( s.sql_handle ) t