Category Archives: 2499

Stop SQL Server transaction log (.LDF) files from growing indefinitely

SQL Server .LDF files are growing and growing and growing... Symptoms


You notice that in your SQL databases directory the .LDF files are growing permanently.


Solution


Set the recovery mode of your SQL Server databases to ‘simple’.


Step-by-step instructions


  1. Perform a full-backup of your SQL Server databases.
    Note: This is very important since switching from the full or bulk-logged recovery model to the simple recovery model breaks the backup log chain. Therefore, it is strongly recommend to back up the log immediately before switching, which allows you to recover the database up to that point. After switching, you need to take periodic data backups to protect your data and to truncate the inactive portion of the transaction log. [Source]
  2. Switch recovery mode of SQL databases to SIMPLE.
    (See also: What is simple recovery mode?)

    Important Note:
  3. “The Simple recovery model lets you restore the database to the point from which it was last backed up. However, this recovery model does not enable you to restore the database to the point of failure or to a particular time.”  [Source]


    For each database...


    ... set recovery mode to SIMPLE.

  4. Shrink the transaction log (.LDF) files.


    Don't forget to Shrink...

    ... the log files after changing the recovery mode. 
  5. Perform a full-backup of your SQL Server databases.

 


 


 


 


 


 


Optionally you can use a script for the steps described above:



SqlScript


See and possibly unlock files checked out by other team members

Ed Hintz points out that this is easily done with TFS Power Tools and wrote about it in 2007.

  1. In the Source Control Explorer, right click on a parent folder that contains the pending change and choose, “Find in Source Control”.
  2. Choose "Status…".

    Find in Source Control command from TFS power tools
  3. Press the Find button. (optionally you can type in a user and\or wildcards if you want to narrow the search)

    Optionally filter for user and/or wildcards
  4. You will be presented a “Find in Source Control” window.
  5. Select the pending change and press the undo button OR right click Undo…

    Can easily undo changes of other users
  6. Done.

Customizing the folders and file extensions automatically excluded

When adding items to source control a list of excluded folders as well as file extensions is shown. You can customize those defaults in the registry.

image

Matthew Mitrik has the details:

If the add operation is successfully completed, the list will be saved to the registry.

Order of finding masks to filter:

  1. HKCU\Software\Microsoft\VisualStudio\[Version]\TeamFoundation\SourceControl\AddOptions\ExcludeMasks
  2. HKLM\Software\Microsoft\VisualStudio\[Version]\TeamFoundation\SourceControl\AddOptions\ExcludeMasks

(Thanks to Rich and Matt)

Setting Remaining Work to Zero when closing a work item in TFS

Question:

How can I make sure that the "Remaining Work" field is set to 0 when the work item is closed (for example when associating a work item during checking-in)?

Short Answer:

You can achieve this using the <COPY> rule on the transition to the "Closed" state.

Step-by-Step instructions:

  1. For the desired transition (in this example from "Active" to "Closed").

    Edit the Workflow Transition with Process Template Editor (part of TFS Power Tools)

  2. Add a field reference to "Microsoft.VSTS.Scheduling.RemainingWork"

    Choose the desired field 
  3. Add a new rule of type "COPY"

    You can use the copy rule to set values
  4. Choose From = "value" and enter value = "0"

    The copy rule sets a value to a field
  5. The resulting XML should look something like

     XML under the covers defines our new rule
  6. Verification: After transitioning a task work item from "Active" to the "Closed" state "Remaining Work" is set to zero.

    Work Item History shows the new rule in beeing applied on the state transition. 

Disable auto-connect to TFS on VS startup

When starting Visual Studio it automatically tries to connect to your TFS, which can be very annoying if you work offline. You will probably see:

TF30331: Team Explorer could not connect to the Team Foundation server …

You can turn this auto-connect behavior off by setting the following files in the registry:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\TeamFoundation
"AutoLoadServer" = 0

Zero means do not reconnect automatically. 

Source: http://blogs.msdn.com/hippietim/archive/2006/03/14/551320.aspx

Downside: you now always have to manually connect (from Team Explorer’s toolbar)

Download .REG file: NoAutoLoadServer.zip

P.S. The Team Foundation Power Tools (TFPT) include a feature called Tweak UI which offers a checkbox to set this registry key – however in the October 2008 version it has a bug (creaing a string value instead of DWORD) and therefore will not work.

Setup up an e-mail notification on other user’s check-ins

  1. Open Alerts Editor (required TFS Power Tools to be installed locally).

    Alerts is part of TFS Power Tools by Microsoft

  2. Create new alert.

    Create a new alert to be notified by e-mail when something happens on the server.

  3. Choose “Check-In of a specific file happens”:

     A check-in alert gets fired when someone check-ins. 

  4. Enter a name for the alert subscription, the destination e-mail address, desired team project name ($/Teamproject), if applicable, as well as your account name (to be excluded).

    The Alert Definition Editor

  5. The “Filter Expression” (2nd tab) looks now similar to:

    ‘Artifacts/Artifact[starts-with(translate(@ServerItem, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"), "$/playground")]‘ <> null AND "Committer" <> ‘TFS\neno

Tool for creating direct links to TSWA

Buck Hodges from Microsoft blogged about all the possible links you can construct to point to TSWA pages.

For example the following URL opens the Work Item Editor:

Open the existing work item with ID 1234: http://mytfs:8090/wi.aspx?id=1234

To make it simple I created a small tool that helps you construct those URLs in an easy way:

Team System Web Access Link Creator

You can download the source from here:

File Attachement: WebAccessLinkCreator.zip

Discover users without Visual Studio SP1 installed

Far too often people install Visual Studio SP1 before Team Explorer 2008 and therefore TE remains unpatched in the RTM state.

Luckily the ambitious TFS Admin can use the TFS Server Manager from the Power Tools package (TfsServerManager.exe in the Power Tools folder) to find those users without SP1:

Check for VS 2008 SP1 from the server

Open "Completed Requests" in TFS server manager.

Open Completed Requests

Choose "devenv.exe, 9.0.21022.8" (= RTM), devenv.exe, 9.0.30729.1 stands for SP1.

Choose devenv.exe as application

Click "Run Query" and look at the User and Client IP columns to identity your colleagues:

Run Query 

Done!

 

Visual Studio (devenv.exe) Version Numbers:

  • devenv.exe 9.0.30729.1 – Visual Studio 2008 SP1
  • devenv.exe 9.0.21022.8 – Visual Studio 2008
  • devenv.exe 8.0.50727.762 – Visual Studio 2005 SP1 (?)
  • devenv.exe 8.0.?? – Visual Studio 2005