Archive for the ‘MS SQL’ Category
Microsoft SQL 2005 large ldf file size
If you happen to run out of disk space in your database server, you might want to check how much your database log files occupy.In order to avoid it I normally set Recovery model to Simple, but when I forget to do so, on the creation of database by default Recovery Model is set to Full and log file (ldf) grows quickly and it can take huge amount of disk space.
Solution:
1. Set Recover Model to Simple
Here is the overview of Recovery Models
http://msdn.microsoft.com/en-us/library/ms189275.aspx
2. Execute:
USE my_db;
BACKUP LOG my_db WITH TRUNCATE_ONLY
DBCC SHRINKFILE('my_db_log',1)
Note: I recommend reading about database shrinking and how it affects your database here:
http://msdn.microsoft.com/en-us/library/aa258824(SQL.80).aspx