Solved

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

Posted on 2010-09-13
3
296 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:Scott Pletcher
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

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…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
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
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

23 Experts available now in Live!

Get 1:1 Help Now