SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Duration of a Database Restore


Duration of a Database Restore

Author
Message
Key DBA
Key DBA
SSC Eights!
SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)

Group: General Forum Members
Points: 819 Visits: 655
I would like to be able to report on how long a database restore operation took.

The only information I have been able to find is in the msdb.dbo.restorehistory Table. The Column restore_date is only one value and I don't have a way to calculate the duration.

I could call getdate() before and after I executed a restore script, as a quick workaround. Has anyone else seen or done something similar to this?

"Key"
MCITP: DBA, MCSE, MCTS: SQL 2005, OCP
Vladan
Vladan
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2421 Visits: 754
Create a restore job and use it for every restore. Then you'll be able to see the duration in job history. In case you need to keep track of restores over a longer time (not just about the last few restores), copy the data into your table. Job history only saves a limited number of rows for each job.

Here is how you can get some info about job history (there are more columns, this is just an example - you may add failure messages and other, if you need it). The example works for both SQLS2000 and 2005.

SELECT job.[name] as JobName, his.step_id, his.step_name, his.run_status, his.run_date, his.run_duration, his.server, step.database_name
from msdb..sysjobs job
JOIN msdb..sysjobhistory his ON his.job_id = job.job_id
JOIN msdb..sysjobsteps step ON step.job_id =his.job_id AND step.step_id=his.step_id
ORDER BY job.[name], his.step_id



Key DBA
Key DBA
SSC Eights!
SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)

Group: General Forum Members
Points: 819 Visits: 655
Vladan,

Your technique is exactly what I was looking for. I will work on getting my restore job created, and will post back with results. Thanks for taking the time to reply to my posting!

"Key"
MCITP: DBA, MCSE, MCTS: SQL 2005, OCP
Key DBA
Key DBA
SSC Eights!
SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)

Group: General Forum Members
Points: 819 Visits: 655
Vladan,

I am happy to report that I am now getting the run_duration back in seconds, after scripting the Restore operation to a Job. Thanks again for the suggestion and the query.

"Key"
MCITP: DBA, MCSE, MCTS: SQL 2005, OCP
Vladan
Vladan
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2421 Visits: 754
Great! Thanks for the feedback, it is good to know that my suggestion helped.



LAW1143
LAW1143
SSC Veteran
SSC Veteran (204 reputation)SSC Veteran (204 reputation)SSC Veteran (204 reputation)SSC Veteran (204 reputation)SSC Veteran (204 reputation)SSC Veteran (204 reputation)SSC Veteran (204 reputation)SSC Veteran (204 reputation)

Group: General Forum Members
Points: 204 Visits: 403
was googling for ways to find the duration of a db restore and found this OLD post...

if you have your errorlog from the time the db was last restored still available you can compare the time in the msdb restorehistory table with the 'recovery complete' entry for that db in the ErrorLog...
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search