Tuesday, November 18, 2008

Query to Find time remaining to complete database backup or restore in SQL 2005

USE master
GO

SELECT
          Percent_Complete,
          Start_Time ,
          Command,
          b.Name AS DatabaseName, --Sometimes this will be "Main" as the database will not be accesiable.
          DATEADD(ms,estimated_completion_time,GETDATE()) AS RemainTime,
          (estimated_completion_time/1000/60) AS MinutesToFinish
FROM sys.dm_exec_requests a
          INNER JOIN sys.databases b
          ON a.database_id = b.database_id
WHERE
          Command like '%Restore%'
          OR Command like '%Backup%'
          AND Estimated_Completion_Time > 0

17 comments:

  1. Hey This script is beautiful.. i tried alot to findout this script.. but finally i got here..

    Great work sandesh.. really appreciate it..

    ReplyDelete
  2. Awsome. It works perfectl

    Sen.

    ReplyDelete
  3. Query to Find time remaining to complete Rebuild Index for entire DB.

    ReplyDelete
  4. Hi, we can rewrite the command for Checking Backup and Restore estimated time.
    select percent_complete ,estimated_completion_time/60000 RemMin,* from sys.dm_exec_requests where command ='backup database'

    ReplyDelete
  5. Nice Article !

    Really this will help to people of SQL Server Community.
    I have also prepared small note on this, find estimated finish time of the restore SQL Server database.

    http://www.dbrnd.com/2015/11/sql-server-script-to-find-estimated-finish-time-of-the-restore-database-2/

    ReplyDelete
  6. Nice blog... This blog clearly shows the important of automatic backup of SQL server database. This help to secure data. Thanks for sharing

    ReplyDelete
  7. Amazingly helpful which you have shared here. I am impressed by the details and also it is a significant article for us. Continue imparting this sort of info, Thank you.dmca ignored streaming server

    ReplyDelete
  8. I liked your work and, as a result, the manner you presented this content about 10gbps Streaming Servers.It is a valuable paper for us. Thank you for sharing this blog with us.

    ReplyDelete
  9. I got best ideas to complete my university project. Our Click Here Exterior Painting Services in Johns Creek GA can provide you best solutions to complete your home.

    ReplyDelete
  10. Of course, even if an athlete takes steroids, if he doesn't take action or have the right mindset - he's not going to win. BEST LEGAL ANABOLIC STEROIDS FOR SALE

    ReplyDelete
  11. Good article , I am going to spend more time researching this topic UnitedFinances best 1500 loan direct lender

    ReplyDelete
  12. I’d need to consult you here. Which is not some thing I usually do! I love to reading an article that could make people believe. Also, thanks for permitting me to comment! MLS Players

    ReplyDelete
  13. Greetings I am so thrilled I found your webpage, I really found you by accident, while I was searching on Aol for something else, Nonetheless I am here now and would just like to say thanks a lot for a tremendous post and a all round thrilling blog (I also love the theme/design), I don’t have time to look over it all at the minute but I have saved it and also added your RSS feeds, so when I have time I will be back to read much more, Please do keep up the fantastic job. Geometric Sequence

    ReplyDelete
  14. Terrific post, plenty of great info. I wish to show my pal and ask them the things they think. My Towers

    ReplyDelete
  15. I think this is one of the most vital information for me. And i’m glad reading your article. But wanna remark on some general things, The web site style is wonderful, the articles is really nice : D. Good job, cheers el mejor tarot del amor gratis

    ReplyDelete