Solved

MSSQL Large Transaction Log

Posted on 2013-06-20
4
413 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

743 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