Solved

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

Posted on 2010-09-13
3
303 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSRS 2013 - Creating a summarized report 19 35
SQL Server 2012 r2 - Sum totals 2 25
optimize stored procedure 6 25
Increment column based of a FK 8 21
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

770 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