Sql 2012 log file huge

casit
casit used Ask the Experts™
on
Hello,
I'm running a SQL 2012 Always-On Group with a DB inside.
The DB is set to Full logging.  However after doing a full backup the log file is not going down in size.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Steve WalesSenior Database Administrator
Commented:
Full backups aren't what cause a log file to be able to be shrunk.

You need to do a transaction log backup in order to flag it for reuse.

Have a read of these two blog entries from Kimberly Tripp:

http://www.sqlskills.com/blogs/kimberly/post/8-steps-to-better-transaction-log-throughput.aspx
http://www.sqlskills.com/blogs/kimberly/post/transaction-log-vlfs-too-many-or-too-few.aspx

Oh, and here's the relevant piece from SQL Server 2012 Books Online:
http://msdn.microsoft.com/en-us/library/ms190925.aspx
Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015

Commented:
Exactly. Full Recovery Mode requires to perform DB and Transaction Log backups. Usually you perform the log backup more often (say once every 4 hours), while the DB backup is once a day or even less often. It doesn't matter whether the DB backup is differential or full.

Author

Commented:
I did both a full backup and also a trans log backup and the size is still the same.
Steve WalesSenior Database Administrator

Commented:
The transaction log backup in and of itself won't shrink the log file - it just enables the space to be reused.  If you had never done a log backup before and the log file had grown large, extra steps need to be taken to shrink the logfile and then regrow in a controlled manner to a better size.

The two blog posts I listed above cover this in great detail and I don't want to steal Kimberly's work by replicating it here.   Have a read of those two posts and come back here with any other questions.

It's important to understand the impact of large numbers of VLF's brought about by incorrect sizing of your transaction log through autogrow, the impact autogrow can have on performance as well as the proper steps to shrink the transaction log back to a reasonable size.
Commented:
you are probably have active transaction there
run this query to see it:

select name, database_id, log_reuse_wait, log_reuse_wait_desc from sys.databases

more:

Unable to shrink the transaction log of SQL Server database

http://zarez.net/?p=913

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial