Sunday, December 22, 2024

How to check the progress of the ‘Shrink Database’ task in SQL Server 2012

Abstract: Sometimes it might be needed to shrink an Skype for Business (SfB) SQL Database via the Microsoft SQL Management Studio GUI.The issue here is depending on the size, it might take some time and the GUI will now show the process. So how can the process be checked?

Normally such SQL tasks are done together with an Microsoft SQL Database Administrator (DBA), but if there is no DBA an SfB administrator (if he has the needed SQL rights) he can check the process with the following SQL statement:

SELECT percent_complete, start_time, status, command, estimated_completion_time, cpu_time, total_elapsed_time
FROM sys.dm_exec_requests
WHERE command = 'DbccFilesCompact'

It should output something like

percent_complete start_time status command estimated_completion_time cpu_time total_elapsed_time
---------------- ----------------------- ------------------------------ ---------------- ------------------------- ----------- ------------------
93.23543 2017-02-13 21:33:21.150 suspended DbccFilesCompact 2934 2632 64422

Here you can find the needed infos like the overall completion percent from the compact action.

Cross information:
https://blogs.msdn.microsoft.com/psssql/2008/03/28/how-it-works-sql-server-2005-dbcc-shrink-may-take-longer-than-sql-server-2000/

 

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Stay Connected

35FollowersFollow
- Advertisement -

Latest Articles