Slow speed while Restoring the Database Backup.

  • 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

  • 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.

    ---------------------------------------------------------------------

  • Also check if Instant file Initialization is enabled.

  • 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[/url]
    Learn Extended Events

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply