Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / T-SQL

Find progress of a database restore using sys.dm_exec_requests

5.00/5 (2 votes)
15 Jan 2015CPOL 7K  
Find progress of a database restore using sys.dm_exec_requests

Introduction

Many times as a developer, I struggled to find the progress of my database restore process. Finally one of my colleague helped me to find a way to see the DB restore process progress.

Returns information about each request that is executing within SQL Server.

Executing sys.dm_exec_requests in master DB rreturns information about each request that is executing within SQL Server.

sys.dm_exec_requests

Using the code

A brief description of how to use the article or code. The class names, the methods and properties, any tricks or tips.

Blocks of code should be set as style "Formatted" like this:


USE Master

GO

SELECT percent_complete FROM sys.dm_exec_requests;

SELECT percent_complete FROM sys.dm_exec_requests

OR

SELECT percent_complete FROM sys.dm_exec_requests WHERE session_id = 80 // if you know the session Id

For more details

http://msdn.microsoft.com/en-us/library/ms177648.aspx. 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)