Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Transaction Log file

Author  Topic 

dr223
Constraint Violating Yak Guru

444 Posts

Posted - 2009-06-23 : 07:36:39
Hallo,

I have a database which I need to download a large table to it. The problem is the space availabe is 49.9 GB. So when I start dowloading the table it creates a log file which is around 27 GB. This crashes the download.

Please could anyone advise me how I can minimise the size of the log file prior to the download, as the server can't handle it, am running out of space.

Thanks

acollins74
Yak Posting Veteran

82 Posts

Posted - 2009-06-23 : 07:53:00
There are many choices you have here depending on your circumstances and if you do some searches within the forum, you will find an endless supply of answers.
The bottom line is you need to control your log growth during this import. I am assuming this is a one time load.
Some things to try are dropping and recreating indexes if the size of them are part of your problem.
Batch load your import instead of wrapping into one transaction. Try importing X thousand at a time.
Make sure you have a recent backup of both Full and transaction log.
and lots of other things to try but this is an issue that will haunt you time and time again through your career so try to learn many ways to attack the problem and choose the best way for your objective.
Go to Top of Page

dr223
Constraint Violating Yak Guru

444 Posts

Posted - 2009-06-23 : 08:21:18

Please can you briefly tell me the process, I am new to sql..

Thanks
Go to Top of Page

acollins74
Yak Posting Veteran

82 Posts

Posted - 2009-06-23 : 08:34:29
..briefly, no.
How bout this, Is your recovery model set to Full?
If so, change recovery model to Simple.
Do your import.
Change back to Full and take and immediate Full backup.
This might get you out of your pinch but certainly not the best practice. Get passed this hurdle, and start researching and practicing different ways of approaching your problem on a Dev system.
Go to Top of Page

dr223
Constraint Violating Yak Guru

444 Posts

Posted - 2009-06-23 : 08:46:12
Thanks for the reply..

So if I set the recovery model - simple will it reduce the log file to lower levels i.e., less than 27 GB. I just need to import one table only which has 85,000,000 records..

Thanks
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-06-23 : 16:44:27
Switching the recovery model does not change the file size. You would still need to shrink it down with DBCC SHRINKFILE. You should search our forums for this issue as this has been discussed at length hundreds of times already.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -