Shrinking the Log File in SQL Server 2005
Sometimes we need to delete the log file as quickly as possible. This is not the best way but is the most simple. Only in 6 steps:
1 - Detach DataBase
2 - Rename Log file or remove if tou are completely sure.
3 - Attach the database. You have to select the mdf file of the database.
4 - If you have deleted or renamed the log file tou will see an error "Not found" in the log file of the attached database.
5 - Select the log file with the error and click on "Remove"
6 - Click on "OK"
Now you have the same database without the large log file. Automatically SQL Server creates another file with minimum size and you can delete the file.
Use this method only to shrink database files without imprtance (development or test DB).
3 Comments:
it doesn't work. sql will not reattach the mdf (data file) without the corresponding ldf (log file).
Have you tried it? If you remove the file (step 5), SQL Server will create a new log file with the default size (2MB).
Obviously, you will lose the information in the log file. For that reason this menthod is only applicable in a development environment.
Hi, well be sensible, well-all described
Post a Comment
<< Home