SQLServer-DBA.com Links

Subscribe to newsletter

Dba_db2_button

Powered by TypePad
SQL Server – How to Predict the DBCC SHRINKDATABASE finish time

17 November,2012 by Jack Vamvas

Question: I’ve issued a  DBCC SHRINKDATABASE on a 1.1 TB database. It’s been running awhile and business users are keen to know the estimated percent complete  and estimated finish time . How can I find out this information?

Answer: Using the SQL Server DMV sys.dm_exec_requests  , assists in estimating the finish time. The percent_complete and estimated_completion columns are useful.

While the DBCC SHRINKDATABASE is running – run the query below without the session_id.

Look for a record with  DbccSpaceReclaim , DbccFilesCompact or DbccLOBCompact in the command column.

 

SELECT session_id,percent_complete,DATEADD(MILLISECOND,estimated_completion_time,CURRENT_TIMESTAMP) Estimated_finish_time,
(total_elapsed_time/1000)/60 Total_Elapsed_Time_MINS ,
DB_NAME(Database_id) Database_Name ,command,sql_handle
FROM sys.dm_exec_requests WHERE session_id=59

 Related topics to How to Predict the DBCC SHRINKDATABASE  finish time

Shrink tempdb without sql server restart

SQL Server - Monitoring a Rollback and sys.dm_exec_requests ...

SQL Server - dm_exec_sql_text and Display text of SQL batch


Author: Jack Vamvas (http://www.sqlserver-dba.com)

******** *******

Subscribe to SQLServer-DBA.com

Latest posts delivered to you daily

Delivered by FeedBurner

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer