2

I've written a small app to periodically query, sanitize, and insert a legacy database's data into SqlServer. There are about 3M records and, if I make the polling widow pretty small, I can imagine the transaction log getting pretty big. How can I minimize its growth during these "copy" operations?

Dane O'Connor
  • 1,269
  • 2
  • 15
  • 20

3 Answers3

8

How are you inserting data?

Bulk-logged recovery model can be your friend here.

http://msdn.microsoft.com/en-us/library/aa173529(SQL.80).aspx

Massimo
  • 70,200
  • 57
  • 200
  • 323
2

Massimo is right. Specifically, you want to read this article - it lists the prerequisites for bulk logging to take place:

http://msdn.microsoft.com/en-us/library/ms190422.aspx

Aaron Alton
  • 1,138
  • 11
  • 10
0

Depends on the backup mode of the target database.

If simple, the transaction log space should be freed and reused as transactions are committed, limiting space used.

Otherwise you will need to perform transaction log back ups.

Richard
  • 5,324
  • 1
  • 23
  • 20