?
Solved

How to get rid of .ldf files and create a new one

Posted on 2007-11-28
7
Medium Priority
?
541 Views
Last Modified: 2008-03-05
I am using SQL Server 2005. Since i do some development work so i create the replica of my live databases to run for trial. When i restore the data from the live one to the test one it increases the size of the log file very much which is occupying the space unnecessarily. I am trying to get rid of the log file and create a new one. What I have done so far is detach the database, delete the .ldf file and when i try to attach the database it says the .ldf file is not present. Could any body help me with this
0
Comment
Question by:shieldguy
[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
7 Comments
 
LVL 17

Accepted Solution

by:
Chris Mangus earned 2000 total points
ID: 20367126
Restore the database as usual.  Put the database in Simple recovery mode.  Then, run DBCC SHRINKFILE and shrink the .ldf.

You can't just get rid of it and create a new one.
0
 
LVL 5

Expert Comment

by:MrNetic
ID: 20367128
shieldguy,

Put the database in the developement stage in SIMPLE RECOVERY MODEL, This will truncate the Transaction Log everytime the engine do checkpoint.

Best Regards,
Paulo Condeça
0
 
LVL 5

Expert Comment

by:MrNetic
ID: 20367168
Don't forget to shrink the transaction log ( DBCC SHRINKFILE ('LOGICAL_NAME_OF_TRANSACTION_LOG') )

Best Regards,

Paulo Condeça
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 20367434
If you are going to use Full Recovery Model, than you need to get in the habit of backing up the Transaction Log as well as the database.
0
 
LVL 1

Author Comment

by:shieldguy
ID: 20372855
Could any body please explain me clearly what is 'Simple Recovery Model' and 'Full Recovery Model'. What option do I need to select for that.

Kind Regards
0
 
LVL 5

Expert Comment

by:MrNetic
ID: 20372905
shieldguy,

Don't have time to explain, but you can consult this site http://msdn2.microsoft.com/en-us/library/ms189275.aspx .

Hope it helps.
0
 
LVL 17

Expert Comment

by:Chris Mangus
ID: 20423218
Is there anything else we can do for you on this question?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Suggested Courses

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