Solved

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

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Insert parts by customer 12 33
SQL - Copy data from one database to another 6 19
Create snapshot on MSSQL 2012 3 18
SQL Server Error 21 8 24
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…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

773 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