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 |
melcraig
Starting Member
39 Posts |
Posted - 2006-07-11 : 17:20:08
|
I have a log file that is huge. I want to shrink the physical .ldf file. I have did a full backup.Is this the correct command and I will not lose any data:DBCC SHRINKFILE ('DBNAME', 'TRUNCATEONLY')Thanks for your help,Mel |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-07-11 : 17:21:08
|
What is your database recovery model set to? If FULL, are you performing regular transaction log backups? Do you require point in time recovery? Tara Kizeraka tduggan |
 |
|
melcraig
Starting Member
39 Posts |
Posted - 2006-07-11 : 17:23:05
|
It is set to full recovery and whomever set it up did not schedule dumps of the log files! Melinda |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-07-11 : 17:33:10
|
If you don't require point in time recovery, then change the recovery model to SIMPLE. If you do require point in time recovery, then you must start backing up the transaction log. It will just grow and grow otherwise. Once you've either change the recovery model or started running tlog backups, then you can run the DBCC command.Tara Kizeraka tduggan |
 |
|
melcraig
Starting Member
39 Posts |
Posted - 2006-07-11 : 18:14:41
|
OK, I ran the script and now I can't delete the old transaction file .trn backup.Any suggestions, it says it may be in use?Thanks,Mel |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-07-11 : 18:17:46
|
If a file is in use, then you can not delete it. So you either need to kill the process that is accessing the file or reboot. Hopefully you changed your recovery model to SIMPLE or are performing regular tlog backups now, otherwise this problem is going to occur again. We backup our transaction logs every 15 mintues due to the criticality of the data.Tara Kizeraka tduggan |
 |
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2006-07-11 : 20:53:36
|
i guess by now you've killed this already, but it is best to allow the job/task to finish to have a good backup before the truncate, otherwise ignore this post  quote: Originally posted by melcraig OK, I ran the script and now I can't delete the old transaction file .trn backup.Any suggestions, it says it may be in use?Thanks,Mel
--------------------keeping it simple... |
 |
|
|
|
|
|
|