Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
newbie007
Starting Member
37 Posts |
Posted - 2009-04-01 : 10:39:10
|
| While executing queries, because of the huge size of *-log.ldf and *_data.mdf files my system is crashing / slowing down. How can this be rectified ? (without increasing hard disk space)- can these files be truncated/deleted/prevented ? |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2009-04-02 : 04:06:40
|
| No, these are your database files. If the ldf is getting too big, you need to do log backups more often. The mdf is your primary database file and if you delete it, you will lose everything.Sort out your backups and optimise your code to stop this behaviour. |
 |
|
|
darkdusky
Aged Yak Warrior
591 Posts |
Posted - 2009-04-02 : 05:21:40
|
| As Rick says log files will expand unless you do log backups. Once you start backups the size allocated to the log file will not shrink even it is not being used.To check the amount log file filled:DBCC SQLPERF (LOGSPACE) --gives % used of log files for each databaseAfter backup to reclaim space already allocated to log file:--shrink logfile:DBCC SHRINKFILE ( DBFILENAME_Log,2 )http://msdn.microsoft.com/en-us/library/aa258824(SQL.80).aspxThe file will not be shrunk below the maximum size it occupies. E.g. file size = 1GB, but using 5MB. If you run the above command it will not shrink to requested size of 2MB, but to the 5MB actually being used.- unless you use truncate |
 |
|
|
|
|
|