Solved

MSSQL Large Transaction Log

Posted on 2013-06-20
4
415 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
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:ewangoya
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 Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

914 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now