Solved

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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 …
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.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

863 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

28 Experts available now in Live!

Get 1:1 Help Now