Solved

SQl Server 2005: SP to clear a T-Log (For Simple Recovery Model)

Posted on 2010-09-13
3
286 Views
Last Modified: 2012-05-10
In SQL Server 2005 (Simple Recovery Model), we have few SP's that do Bulk Inserts into the database. As these Bulk Inserts are consuming a lot of Log space, the T-Log gets full and the subsequent insertions fail as they do not find log space.

Our Prod DBA suggested the Developers to write an SP that would clear the T-Log as well have the bulk inserts broken into smaller inserts.

I need to write a SP that can be called either at the start of every SP that do Bulk Inserts so that that the SP finds the required space to perform the bulk inserts.
0
Comment
Question by:NitinLothumalla
3 Comments
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 50 total points
ID: 33663796
Even in simple recovery mode, the transaction log must be sufficiently large enough to handle the transactions occur between checkpoints.  If you are running an update statement that effects 100M records, then a 100MB transaction log will not be large enough.  The transaction log will attempt to grow, and if there is no space on disk to grow, it will fail.

0
 
LVL 69

Expert Comment

by:ScottPletcher
ID: 33664724
How, specifically, are you doing the BULK INSERT?  Some methods will allow you to specify a batch size within the load.  That would break it into smaller chunks w/o requiring you to adjust your app code or files.
0
 

Author Closing Comment

by:NitinLothumalla
ID: 33665122
The actual problem is different from what I have heard from my DBA. Though this answer is also a part of the Solution.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
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.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

743 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

12 Experts available now in Live!

Get 1:1 Help Now