Follow sqlserver-dba.com

Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions

SQLServer-DBA.com Links

Dba_db2_button

dba-ninja.com

SQL Server DBA Jobs

Estimate SQL Restore Database Estimated Finish Time

17 July,2012 by Tom Collins

Question: I’ve issued a  RESTORE DATABASE on a 700 GB database. It’s been taking awhile and business users are keen to know the estimate percent complete  and estimate 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 RESTORE is running – run the query below without the session_id.

Look for a record with RESTORE COMMAND in the command column.

I’ve included a sample query , which returns a percent complete and estimated completion. Use it for:  BACKUP \ RESTORE, DBCC CHECKDB , DBCC CHECKTABLE,DBCC SHRINKDB , dbcc SHRINKFILE,DBCC INDEXDEFRAG,ALTER INDEX REORGANIZE, ROLLBACK

 

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=57

 Restore_database

It's important to test your RESTORE strategy. Read more on Schrodinger’s backup - A warning for DBAs

 

 

Read More 

SQL Server faster restores with instant file initialisation

Display sql backup history for a single database

SQL Server - Display restore history for a single database

 


Author: Tom Collins (http://www.sqlserver-dba.com)


Share:

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 on Estimate SQL Restore Database Estimated Finish Time


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