Monday, May 21, 2007 9:42 AM
The disk space of my Team Foundation Server becomes saturated because of the SQL log files. For example, here are the sizes of several TFS database files :
- TfsVersionControl.mdf : 5.3 GB - TfsVersionControl_log.ldf : 23.9 GB
- TfsIntegration.mdf : 26.8 MB - TfsIntegration_log.ldf : 1.8 GB
- TfsWareHouse.mdf : 124 MB - TfsWareHouse_log.ldf : 61.8 GB !
I have several questions about this :
- Is it possible to reduce the size of the log files without risk for the integrity of the TFS data ?
- The log files have the following restricted growth at the installation of TFS : 10% and 2,097,152 MB. Isn't this size an installation bug ? This seems really huge...
- How can I limit the size of the log files ? When I try to modify the limit size of the log files, this has no effect.
Thank you for your help.
Monday, May 28, 2007 2:15 AM
You may back up the data -tier and shrink the data base.
Here is how to back up the data – tier:
Shrinking data bases should not affect the integrity of the TFS data. All the data are stored in the tables.
Here are brief introductions about using shrink data bases:
Monday, May 28, 2007 6:08 AM
I have been able to shrink the log files of all the databases except TFSWarehouse which is alas the biggest one: it is now 120 GB (compared to 62 GB from my previous post one week earlier...) When I try to do a transaction log backup, I have an error stating that the database is is use.
I have tried to do this backup during the week-end with the TFSServerScheduler service shut down. The backup then stayed hanged at 60% for 40 hours and I have been forced to cancel it.
We are now Monday in the morning with the server running out of space. This afternoon or tomorrow, it will stop working and nearly 30 people won't be able to work anymore. So if you have any solution to shrink that file, please give it to me!
Monday, May 28, 2007 6:40 AM
You do not need to back the log file individually. You only need to back the data - tier according to the admin book.
You do not need these log any more. You may try to shrink it to a very small piece. Almost you can shrink it to about 1 GB.
You may search the shrink topic in the SQL Server Help book which should be installed with the SQL Server Engine.
I am not sure about the detail steps and configurations about shrink.
You can feel free to reduce these log files.
Can you run the back up steps according to the TFS admin book now?
If you have any questions you can post it freely.
Monday, May 28, 2007 6:56 AM
From the admin book you may do a full back up. This type does not back up the log file. It just backs up the Databases
To complete a full backup, select Back Up Database (Full).
When you finish the full back up you can shrink log file freely
If you can not run this full back up because of the huge log file
you may shrink log files first and immediately do a full back up.
Monday, May 28, 2007 7:31 AM
The problem is that the log file can be shrinked only after a transaction log backup (as explained in the link you have posted). When I execute a shrink operation on the log file after a full backup of the database, only the free part of the latest allocated part of the file can be freed (with an automatic growth of 10%, that means less than these 10%). To purge and shrink the log file, a transaction log backup is needed. For instance, I have done the test on the database TfsVersionControl :
- I do a full backup of the database.
- 5.8 MB of the log file can be freed on a total of 80.5 MB (i.e. 7%)
- I then do a transaction log backup of the database.
- 71.2 MB of the log file can be freed (i.e. 88%)
My problem is that I am able to do a full backup of the TFSWarehouse database, but the transaction log backup of this database fails by hanging at 60% during the backup. Thus, I cannot do an efficient shrink of the log file. Furthermore, if I delete this database and recreate it from the full backup, the log file is recreated with its original size of 120 GB, so I have no idea how I can solve this problem.
Monday, May 28, 2007 9:31 AM
For your scenario:
You may truncate the transaction log first.
Here is the SQL Query Text:
BACKUP LOG …. WITH TRUNCATE_ONLY
DBCC SHRINKFILE(logfile_name, 7)
After this, you may do the shrink operation effectively.
After this operation, fully backup the database.
Monday, May 28, 2007 12:33 PM
Yes! It works.
Thank you very much, Hua. You saved the situation.
Wednesday, June 06, 2007 5:10 AM
I have the same problem,, My transaction Log generated a second file: Database_Log2 (but no extension Type: File) ... how can I shrink it or remove it ?
Wednesday, September 09, 2009 2:28 PMThe correct action is to set the Recovery model to "Simple" for all databases where you are not performing transaction log backup. "Full" recovery will not truncate log files until they are backed up. "Simple" recovery will truncate logs when a full backup is performed. If you are not backing up transaction logs separately there is no use for the "Full" recovery model.
Thursday, October 20, 2011 11:21 PM
Rcently experienced the same huge transaction log issue in TFS 2010 and SQL 2008.
Summarized how to truncate transaction log in UI with SQL Server Management Studio :
Hope it helps people who experience the same problem.