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


Slow speed while Restoring the Database Backup.


Slow speed while Restoring the Database Backup.

Author
Message
satnam.singh 44358
satnam.singh 44358
Old Hand
Old Hand (338 reputation)Old Hand (338 reputation)Old Hand (338 reputation)Old Hand (338 reputation)Old Hand (338 reputation)Old Hand (338 reputation)Old Hand (338 reputation)Old Hand (338 reputation)

Group: General Forum Members
Points: 338 Visits: 204
Hello Everyone,

I am facing a slowness issue while restoring a database backup worth 6 GB on a SQL 2005 instance. It is taking around 1 hr and 50 minutes for the backup to get restored properly.

Initial investigation done by me found that it would be due to RAID 5 due to which we moved our Data and Log file to RAID 10 drives after which the speed improved but by 30%. On Further investigation by doing through the Transactional Log file, I noticed that the VLF count was pretty high i.e. around 1000 which looked pretty high to me. Although this database was a part of log shipping but still the size of the transactional log file of the database was pretty high. On further analysis, I noticed that as soon as the LSBackup job of LogShipping executed and then if I execute the DBCC ShrinkFile command as the next step of the LSBackup job the size of the ldf file of the database came down drastically. Also the VLF count came down to a mere 6 instead of 1000 and then if I take the Full Backup of the database and try to restore it on the same drive whose RAID level is RAID 10 it gets restored within 59 seconds which looks pretty OK.

The important question and the challenge here is that I have read many times across n number of articles published till date written by renowned authors that shrinking the log file is bad, it can impact the fragmentation level of the indexes in the database thereby impacting performance, and therefore I decided to ask this question to the SQL community on SSC.

I look forward hearing a positive feedback from you all on this case.

With Thanks,
Satnam
george sibbald
george sibbald
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24520 Visits: 13698
shrinking of the log file does not affect index fragmentation, only data file shrinking does that.

Shrinking of the log file is usually bad as it then has to grow again to handle normal activity, which is a waste of resources.

However, shrinking of the log file as a one off operation to reduce the number of VLFs is not a bad thing. Shrink the log as much as you can (it will never shrink to less than 2 VLFs) then immediately grow it in sensible sized chunks to the size it actually needs to be.

---------------------------------------------------------------------
Neeraj Dwivedi
Neeraj Dwivedi
SSCrazy
SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)

Group: General Forum Members
Points: 2015 Visits: 1341
Also check if Instant file Initialization is enabled.
SQLRNNR
SQLRNNR
SSC Guru
SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)

Group: General Forum Members
Points: 66393 Visits: 18570
Like George said, shrinking as a 1 off is not such a bad thing.

High vlf will adversely affect restores and operations that touch the transaction log.

While instant file initialization will help with the data file, it has no impact on the transaction log. The transaction log still needs to be 0'd out for each growth or during the restore.

If you have a large log file, that process will take longer (compounded by too many vlfs). This is probably why the database backup with the smaller log restored faster.



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

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