Often the log file, ".ldf", can be quite large. If it's a production database you need it, but for databases you are using for dev and testing, you can remove it carefully to save space.
Here's the steps:
- In Sql Enterprise Manager "detach" the database - this won't hurt it, don't worry. This will bring up another window and just select "OK".
- Then in File Explorer append ".bak" the ldf filename - just in case we need it. Location may vary, on my box it's in "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA"
- Attach the database This will bring up a window. In the upper panel select "Add" and give the location of your .mdf file. Now comes the tricky part, in the lower panel select the log file and then select "Remove". Then select "attach", and voila, your old boat-anchor of a log file is now gone from your database!
- If all goes well, delete the renamed ".ldf" file.
No comments:
Post a Comment