0

(SQL 2014 Ent Ed.) - do I need to break my Availability Group if I need to reduce the number of VLFs in a database that is participating in an AG? Does anyone have the process documented? I am thinking the process goes something like this:

  1. Remove secondary nodes from the AG
  2. Delete the database from the secondary nodes
  3. Remove the database from the primary node of AG
  4. Shrink the log file and regrow to proper size
  5. Add the database back to the AG
  6. Add the secondary nodes back to the AG and allow to sync

Thank you for any direction you can help me with!

1

2 Answers 2

2

I just tested this on a SQL Server 2012 database that is in an availability group, and the log shrink is replicated to the secondary node(s). Accordingly, you can simply shrink log files and then resize them as you would on a database that is not in an availability group.

1
  • Unfortunately I don't have a non-production AG to test this on (on my to-do list since joining a new team a couple months ago); thank you Tony!
    – Jim Vogler
    Nov 15, 2017 at 21:38
1

Since DBCC log shrinks are technically "writes" they will be synchronized over to the secondary server. So you only need to perform step #4, i.e. shrink your logs.

Since shrinking is generally not something you want to do all willy nilly, also take heed of the below if you haven't yet:

Your VLFs will eventually increase again:

  • If the file growth is up to 64MB the new portion of the log file will contain 4 VLFs
  • If the file growth is more than 64MB and up to 1GB the new portion of the log file will contain 8 VLFs
  • If the file growth larger than 1GB = 16VLFs

So make sure that you're not doing this in vain based on the projected VLF growth for your end goal log size. To make sure you're being sane about VLF counts, you can also consult Transaction Log VLFs - Too many or too few which has a great breakdown of information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.