Solved

How to truncate Log file - it is too large (10 GB)

Posted on 2006-07-23
7
243 Views
Last Modified: 2008-03-10
Hello,
 
      I am new to SQL Server.

      I have a small in-house developed package running on Microsoft SQL Server from last 1 year. I am using FIFO method for Material Management System in my code, which is deleting & adding desired rows in temporary tables based on conditions.

     My data file size is 308 MB, where as my log file size is continuously growing. (Currently it is 10GB). I am scared of file size growth, as I have few GBs left on hard disk. So please tell me what does log file contains? And how do I truncate the log file?

    Thanks in advance!
    ---Chitra
0
Comment
Question by:ChitraMarathe
  • 2
7 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
Comment Utility
0
 
LVL 35

Expert Comment

by:David Todd
Comment Utility
Hi,

If this is drastic, and things need to change NOW, then the quick patch is to detach the database, rename/move the log file, and reattach the database. SQL will create an empty logfile at the default (small) size.

This isn't a cure.

Its a trick to get on top of out-of-control log files.

Also use the Taskpad view in Enterprise Manager, as an easy way to see unused space.

Regards
  David
0
 
LVL 35

Expert Comment

by:David Todd
Comment Utility
Hi,

detach the database with sp_detach_db mydatabase
rename/move/delete the log file ...
attach the database with sp_attach_db 'mydatabase', 'mydatabasedatafile.mdf'

Regards
  David
0
 
LVL 30

Expert Comment

by:nmcdermaid
Comment Utility
... and then change your recovery model to 'simple'



but read the MS KB's for full info.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Move SQL 2005 Express to Server 2012R2 19 68
Need Counts 11 39
t-sql month question 8 40
Report Builder 9 24
I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

762 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

7 Experts available now in Live!

Get 1:1 Help Now