Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

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

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Saturday, September 13, 2014 1:50 PM
Points: 1, Visits: 19
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



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

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 5:21 PM
Points: 5,877, Visits: 13,005
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: Today @ 2:56 PM
Points: 835, Visits: 1,191
Also check if Instant file Initialization is enabled.
Post #1541757
Posted Friday, February 14, 2014 1:57 PM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Today @ 9:24 PM
Points: 17,807, Visits: 15,728
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
Post #1541761
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse