Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-09-13
3
Medium Priority
?
338 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 150 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 70

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
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.

886 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