September 8, 2011 at 9:56 am
I am trying to restore database 120GB and 1 hour later still 0 progress,any idea why? SQL agent is not showing that I am restoring databases
Thank you
September 8, 2011 at 9:59 am
how are u measuring progress? hv you used stats clause in restore? or are you using dmvs?
September 8, 2011 at 10:04 am
That will show you the progress :
SELECT r.[session_id]
, c.[client_net_address]
, s.[host_name]
, c.[connect_time]
, [request_start_time] = s.[last_request_start_time]
, [current_time] = CURRENT_TIMESTAMP
, r.[percent_complete]
, [estimated_finish_time] = DATEADD(MILLISECOND, r.[estimated_completion_time], CURRENT_TIMESTAMP)
, [estimated_seconds_left] = DATEDIFF(s, CURRENT_TIMESTAMP, DATEADD(MILLISECOND, r.[estimated_completion_time], CURRENT_TIMESTAMP))
, current_command = SUBSTRING ( t.[text], r.[statement_start_offset]/2, COALESCE(NULLIF(r.[statement_end_offset], -1)/2, 2147483647) )
, module = COALESCE(QUOTENAME(OBJECT_SCHEMA_NAME(t.[objectid], t.[dbid])) + '.' + QUOTENAME(OBJECT_NAME(t.[objectid], t.[dbid])), '<ad hoc>')
FROM sys.dm_exec_requests AS r
INNER JOIN sys.dm_exec_connections AS c
ON r.[session_id] = c.[session_id]
INNER JOIN sys.dm_exec_sessions AS s
ON r.[session_id] = s.[session_id]
CROSS APPLY sys.dm_exec_sql_text(r.[sql_handle]) AS t
WHERE r.[percent_complete] <> 0;
September 8, 2011 at 10:07 am
are you are restoring a backup of the database as a new database?
I believe it can take time for the operating system to find 120 gig of as-contigous-as-possible space in order to put the backup in it.
Lowell
September 8, 2011 at 10:10 am
Lowell (9/8/2011)
are you are restoring a backup of the database as a new database?I believe it can take time for the operating system to find 120 gig of as-contigous-as-possible space in order to put the backup in it.
Agreed, but on a decent san this takes only seconds. Maybe minutes on a slower array.
Do you have instant file initialization on?
How big is the log file in the restored DB? That file needs to be 0 initialized and that takes time.
http://sqlskills.com/blogs/Kimberly/post/Instant-Initialization-What-Why-and-How.aspx
September 8, 2011 at 10:14 am
Ninja's_RGR'us (9/8/2011)
How big is the log file in the restored DB? That file needs to be 0 initialized and that takes time.http://sqlskills.com/blogs/Kimberly/post/Instant-Initialization-What-Why-and-How.aspx
ahh, yeah zeroing out the log file , that makes sense too. one more thing i knew once and forgot about.
Lowell
September 8, 2011 at 10:20 am
Lowell (9/8/2011)
Ninja's_RGR'us (9/8/2011)
How big is the log file in the restored DB? That file needs to be 0 initialized and that takes time.http://sqlskills.com/blogs/Kimberly/post/Instant-Initialization-What-Why-and-How.aspx
ahh, yeah zeroing out the log file , that makes sense too. one more thing i knew once and forgot about.
Don't feel bad. You forgot more than most people will ever know. Sad, but nice to know :-P.
September 8, 2011 at 10:21 am
Restoring over an existing database that is in use? If so, the restore can't even start until exclusive access is obtained on the DB.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 8, 2011 at 10:26 am
GilaMonster (9/8/2011)
Restoring over an existing database that is in use? If so, the restore can't even start until exclusive access is obtained on the DB.
Ya but doesn't that error out WAY before 60 minutes?
September 8, 2011 at 10:27 am
GilaMonster (9/8/2011)
Restoring over an existing database that is in use? If so, the restore can't even start until exclusive access is obtained on the DB.
SQL throws error message for the same. I hv not seen SQL server wait for an hour to throw this msg. May be the restore is in progress...
September 8, 2011 at 10:31 am
ps. (9/8/2011)
GilaMonster (9/8/2011)
Restoring over an existing database that is in use? If so, the restore can't even start until exclusive access is obtained on the DB.SQL throws error message for the same. I hv not seen SQL server wait for an hour to throw this msg. May be the restore is in progress...
The script I posted will answer that, but the op is nowhere to be found at this point!
September 8, 2011 at 10:34 am
ps. (9/8/2011)
GilaMonster (9/8/2011)
Restoring over an existing database that is in use? If so, the restore can't even start until exclusive access is obtained on the DB.SQL throws error message for the same. I hv not seen SQL server wait for an hour to throw this msg. May be the restore is in progress...
SQL doesn't throw errors in this case, because there's nothing actually wrong.
The Management Studio GUI restore dialog will throw errors (timeout errors), but if the restore is being done from a query window it will wait forever as the query windows by default have a query timeout of 0 (forever)
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 8, 2011 at 10:35 am
Thanks for the script Remi. I had written one but this is better. Copied and saved for future use 😉
September 8, 2011 at 10:37 am
ps. (9/8/2011)
Thanks for the script Remi. I had written one but this is better. Copied and saved for future use 😉
Don't forget to give references.
I did and now I don't know where I got it from :-D.
September 8, 2011 at 10:38 am
GilaMonster (9/8/2011)
ps. (9/8/2011)
GilaMonster (9/8/2011)
Restoring over an existing database that is in use? If so, the restore can't even start until exclusive access is obtained on the DB.SQL throws error message for the same. I hv not seen SQL server wait for an hour to throw this msg. May be the restore is in progress...
SQL doesn't throw errors in this case, because there's nothing actually wrong.
The Management Studio GUI restore dialog will throw errors (timeout errors), but if the restore is being done from a query window it will wait forever as the query windows by default have a query timeout of 0 (forever)
Gail, I've seen exclusive access cannot be obtained error in query window while restoring databases many times. And SSMS has default settings...
Viewing 15 posts - 1 through 15 (of 27 total)
You must be logged in to reply to this topic. Login to reply