Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Transaction Log for database XXX is full

Posted on 2016-08-31
5
Medium Priority
?
361 Views
Last Modified: 2016-09-12
Hi Experts,

I am working with SQL 2008 and have an issue with the transaction log for the database being full. I ran a check on the log_reuse_wait_desc and the error was LogBackup and the log_reuse_wait=2.

How do I resolve this issue?

Thanks
0
Comment
Question by:Member_2_7964761
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 40

Expert Comment

by:lcohan
ID: 41778714
USE testdb
GO
CHECKPOINT
GO
DBCC SHRINKFILE (N'testdb_log' , 0, TRUNCATEONLY)
GO
-- or:
BACKUP LOG testdb TO DISK='NUL:'

But you need to have a FULL backup prior to this just in case.
0
 
LVL 14

Expert Comment

by:Nakul Vachhrajani
ID: 41778715
Please check the recovery mode of the database. If it is the full recovery model, the only way to free up space in the log is to take a log backup.

Is this a production database, or a database that is primarily used only for ad-hoc development and testing? If it is used only for ad-hoc purposes, you can evaluate setting the recovery model to "Simple". Do keep in mind though that setting the recovery model to "simple" will impact your ability to recover the database in case of a failure.
1
 
LVL 40

Expert Comment

by:lcohan
ID: 41778718
Also you need to check the recovery model and if that is FULL you must perform regular FULL + T-Log backups to reclaim T-log space otherwise it will get full again.
0
 
LVL 70

Accepted Solution

by:
Scott Pletcher earned 1000 total points
ID: 41778814
You have two choices.

1) Take a log backup.  Depending on the log size, this could take a long time.  While you're doing that the db will remain unuseable.  But it keeps the backup/log chain intact.  If you would really ever want to apply an overgrown log to recover the db, you need to use this method.

2) Put the db into SIMPLE recovery model and shrink the log file.  Then, if you need to, set recovery back to FULL and immediately (or asap) take a full db backup.

USE [XXX]
ALTER DATABASE [XXX]  SET RECOVERY SIMPLE;
CHECKPOINT;
DBCC SHRINKFILE (2, 4096);
EXEC sp_helpfile /*verify that the log file is really smaller*/

Btw, learn to use SQL commands such as those above to work on the log.  Do not use the SSMS gui for this, as it can be flaky.  Besides, it's easier to repeat if you use commands, and you'll have a record of exactly what was done, which you won't get from a gui.
0
 
LVL 4

Assisted Solution

by:Daniel Jones
Daniel Jones earned 1000 total points
ID: 41779260
First change Recovery Model to Simple
  • Database Propertise > Options > Recovery Model > Simple

Then Shrink Files Log
  • Database > Shrink > Files > Log

Then check your db log file size at
  • Database Propertise > Files > Database Files > Path

To check full sql server log: open Log File Viewer at
  • SSMS > Database > Management > SQL Server Logs > Current

Do you have Enable Autogrowth and Unrestricted File Growth for the log file. You can edit these via
  • SSMS > Database Properties > Files
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question