Solved

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

Posted on 2006-07-23
7
251 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 143

Accepted Solution

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

Expert Comment

by:David Todd
ID: 17165497
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
ID: 17165506
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
ID: 17166046
... and then change your recovery model to 'simple'



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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

685 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