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
 Old Forums
 CLOSED - General SQL Server
 Delete LDF File Question

Author  Topic 

rpc86
Posting Yak Master

200 Posts

Posted - 2006-11-24 : 22:06:23
We would like to restore a database under SQL Server 7. But the problem is we have a file named TEMPLOG.LDF which consists of 17GB, so this is a very huge file.

Can we delete the LDF file just to free-up space?

Thanks

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-11-24 : 23:30:02
If you detach the database (the one using templog.ldf) using sp_detach_db you should be able to then reattach the database with sp_attach_db, without that LDF file. I'd recommend that after detaching, you just rename that file, don't delete it. Then reattach the database and if it attaches without problems, you can delete that file, but if you have problems then just rename the file back. This should work fine though.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-11-25 : 03:12:02
You will probably need the Single File Attach:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=single%20file%20attach,sp_attach_single_file_db

You should look into how your LDF got so big in the first place:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=Why%20is%20my%20LDF%20Log%20File%20so%20big

There is no guarantee that your file will Attach, so you need to have a backup as well, just in case. You could Shrink the original database, and then backup, and then restore the backup on the new server.

If you are meaning that you want to restore the database into the ORIGINAL database, and you have a Backup file then there is no way to shrink it (until after you have restored). If you delete the LDF file then SQL Server will make a new, 17GB, one in order to restore the BAK file - and it will take much longer to make a new one than to simply re-use the existing one.

Kristen
Go to Top of Page
   

- Advertisement -