Rotating Header Image

Waiting For A Pot To Boil… Restore Database Progress

BoilingPot

Ever kicked off a restore and didn’t set the STATS parameter?

Ever had a separate application handle a restore and not give you any feedback at all on how far along a restore is?

Well if your answer is no than this post / script is NOT for you  :)

BUT

If your answer is YES then this script should tickle your fancy:

SELECT	A.start_time as 'RestoreStartTime',
		A.percent_complete,
		DATEDIFF(minute, A.start_time, getdate()) as 'CurrentRestoreDurationInMinutes',
		((DATEDIFF(minute, A.start_time, getdate()) * 100) / A.percent_complete) as 'EstimatedTotalDurationInMinutes',
		ROUND(((DATEDIFF(minute, A.start_time, getdate()) * 100) / A.percent_complete) - (DATEDIFF(minute, A.start_time, getdate())), 2) as 'EstimatedTimeRemainingInMinutes',
		B.[text]
 FROM	sys.dm_exec_requests A CROSS APPLY 
		sys.dm_exec_sql_text(A.sql_handle) B
 WHERE	A.percent_complete != 0

Thanks!!

Enjoy!! (Follow me on Twitter: @ColinStasiuk)

Post to Twitter Post to Delicious Post to Digg Post to StumbleUpon

5 Comments

  1. Chris Wood says:

    Certainly helps us with many scripted big database restores to get an estimate of how much longer they will take.

    Thanks

    Chris

  2. Chris Wood says:

    Seems to work well on a backup process too!

    Chris

  3. I added the requirement that its design and/or material would prevent scratching. After doing some research and reading reviews on Amazon, I settled on i-Blason’s Halo Scratch Resistant Hybrid Clear Case.

  4. Early cases are often accurate and serve as a solid indicator of what an upcoming iOS device might look like, but on occasion, case makers get design details wrong..

  5. The Air Case is available via Indiegogo in three different colors options for the iPhone 6/6s and 6 Plus/6s Plus for the next week for $39 USD.

Leave a Reply

Twitter links powered by Tweet This v1.6.1, a WordPress plugin for Twitter.