1

I have a TFS 2018 running in a machine. My log files are huge so I am deciding how to deal with it. I found how I can use Management studio and use the shrink log files option.

(Log into Microsoft SQL Server Management Studio > Right click on your database > Right click on the database > Select Tasks > Shrink > Files.)

enter image description here

Then If I select File Type: "Log", It will shrink the log files for the selected database (Collection). But what kind of info does this delete? Does it delete sensible/important information?

Is there an option to delete this file(s) but leaving the log file for the last 15 days for example? So it would delete everything older than 15 days.

jarlh
  • 42,561
  • 8
  • 45
  • 63
fr0zt
  • 733
  • 4
  • 12
  • 30
  • Before shrinking the log, you need to develop a backup and recovery plan (unless you don't mind losing your TFS database permanently). Once you've done that, which may involve transaction log backups, transaction log sizes will be reasonable going forward. It may then be appropriate to shrink the log file to reduce the unwieldly space allocation due to lack of attention to DBA tasks. – Dan Guzman Mar 01 '19 at 12:07
  • How can I decvelop a backup and recovery plan? Can you point me in the right direction? – fr0zt Mar 01 '19 at 12:29
  • I would start by reading the [documentation](https://learn.microsoft.com/en-us/sql/relational-databases/backup-restore/back-up-and-restore-of-sql-server-databases) to understand the concepts. The short story is you need to determine the amount of data you are willing to lose after a system failure or user error. If one day is acceptable, you can set all the databases to the simple recovery and perform full backups daily. That way, you don't need to bother with log backups at all. For the implementation, consider [this solution](https://ola.hallengren.com/). – Dan Guzman Mar 01 '19 at 12:36
  • Ok. I'll check that. But Just a quick question: If I delete shrink de the files for the default collection as I told here, it will shrink the file Tfs_DefaultCollection_log.ldf right? This means it will only delete logs and nothing else? – fr0zt Mar 01 '19 at 15:04
  • Hello. I tried to shrink my log files but it is not shrinking anything. Do you have any idea why? – fr0zt Mar 04 '19 at 16:29

0 Answers0