Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


SQL Transaction Log

Posted on 1999-07-14
Medium Priority
Last Modified: 2008-03-10
I have a database where the transaction log keeps filling up. I'm not sure this particular database really needs a transaction log. So I'm thinking of either deleting it or having it roll off automatically after two weeks.

How do I delete a transaction log and stop the logging? Also, is there a way of making a transaction roll off (drop prior logs) after two weeks automatically?

Question by:flfmdll
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

Accepted Solution

MFK earned 400 total points
ID: 1096424
Every database must have at least one transaction log which can be used by the SQL Server for automatic recovery. You can set the "truncate log on checkpoint" to true for the database so that every time SQL server writes committed transactions to the database these are deleted from the log.
You can enforce a checkpoint by using the DBCC Checkpoint for a particular database.
You can also truncate the log manually whenever required.
Whenever you truncate the log make sure you backup your database. Whenever a full backup is taken the transaction log can be truncated.
If you are copying large amounts of data into the database using Bulk Copy (bcp or Bulk insert) make sure that you have the option "Bulk copy/insert into.." set to true. That way the transactions are not logged, except for extent allocations which are logged by default.
You should not delete the transaction log files or you will get an error.

Author Comment

ID: 1096425
Thanks. That makes sense and helped me to get past the problem I was experiencing.

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

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 ?
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

715 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