Solved

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

Posted on 2010-09-13
3
322 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
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

737 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