Solved

MSSQL Large Transaction Log

Posted on 2013-06-20
4
423 Views
Last Modified: 2013-06-20
Hi,

I'm dealing with a MSSQL server whose transaction log has grown to 20GB where as the actual database file is only 7MB!

Its really difficult to administer because it keep eating up the harddisk space.

Is there any way to prevent this from happening?
Whats the cause? Only one user is connected to this server.
How can I clear the transaction log?

Thanks
Dan
0
Comment
Question by:DanJourno
[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
4 Comments
 
LVL 5

Expert Comment

by:AbhishekJha
ID: 39261984
Truncate the transaction log.

Refer below link for more information about truncating transaction log

http://msdn.microsoft.com/en-us/library/aa174538(v=sql.80).aspx
0
 
LVL 9

Accepted Solution

by:
sarabhai earned 500 total points
ID: 39261986
Take a full backup and then backup for log only with truncate_only option

set database auto shrink on

Please read below link

http://www.techrepublic.com/blog/datacenter/help-my-sql-server-log-file-is-too-big/448
0
 
LVL 32

Expert Comment

by:Ephraim Wangoya
ID: 39262061
The first step is to shrink it to your desirable size.
Now to keep it manageable, there are two options

1. Change the database recovery model to SIMPLE
2. Schedule regular transaction log backups

These will ensure the log does not grow too large
Remember to avoid truncating your log, this breaks your log transaction sequence and sql server does need to grow the log file at times depending on how much data you edit.
0
 
LVL 8

Expert Comment

by:didnthaveaname
ID: 39262069
I really would advise against auto shrink...  I would, however, argue that if your transaction logs are that large with a db that small, you're probably in full recovery model and you don't need to be.  The article that sarabhai posted has directions in how to set your recovery model to simple an then you'll just want to set up a backup (full and/or differential in simple recovery model, the transaction logs are circular and only there for maintaining db consistency, acidity and integrity) schedule via sql server agent or maintenance plan.

Sql server agent - http://support.microsoft.com/kb/2019698

Maintenance plan - http://technet.microsoft.com/en-us/sqlserver/dd430301.aspx
0

Featured Post

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Convert rows to columns 5 34
Access PS SQLSERVER from powershell 1 30
SQL: get ride of blank rows 11 20
VM SQL server license. 1 65
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
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.

734 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