Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 547
  • Last Modified:

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

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
shieldguy
Asked:
shieldguy
1 Solution
 
Chris MangusDatabase AdministratorCommented:
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
 
MrNeticCommented:
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
 
MrNeticCommented:
Don't forget to shrink the transaction log ( DBCC SHRINKFILE ('LOGICAL_NAME_OF_TRANSACTION_LOG') )

Best Regards,

Paulo Condeça
0
A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

 
Anthony PerkinsCommented:
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
 
shieldguyAuthor Commented:
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
 
MrNeticCommented:
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
 
Chris MangusDatabase AdministratorCommented:
Is there anything else we can do for you on this question?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now