Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Slow speed while Restoring the Database Backup. Expand / Collapse
Posted Thursday, January 16, 2014 3:21 AM


Group: General Forum Members
Last Login: Thursday, October 20, 2016 4:03 AM
Points: 180, Visits: 200
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,

Post #1531470
Posted Thursday, January 16, 2014 5:07 AM


Group: General Forum Members
Last Login: Wednesday, November 16, 2016 9:57 AM
Points: 6,147, Visits: 13,680
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.


Post #1531505
Posted Friday, February 14, 2014 1:52 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Monday, November 21, 2016 9:50 AM
Points: 863, Visits: 1,318
Also check if Instant file Initialization is enabled.
Post #1541757
Posted Friday, February 14, 2014 1:57 PM



Group: General Forum Members
Last Login: Monday, November 21, 2016 11:03 AM
Points: 20,009, Visits: 18,255
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...


Posting Performance Based Questions - Gail Shaw
Post #1541761
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse