Set database into single user mode

Today when I need to run DBCC CHECKDB on our customer’s Team Foundation data tier server to repair the affected databases. When I tried to repair the affected database, there is a message “Repair statement not processed. Database needs to be in single user mode.” Single-user mode specifies that only one user at a time can access the database and is generally used for maintenance actions.

To change a database into single user mode, perform the following steps:

Using SQL Server Management Studio.
1. Right click the related database then click Properties.
2. Choose Option page.
3. From Restrict Access option, select SINGLE_USER.
4. Click OK and Open Connections dialog will appear. Click Yes if you want to close all connection connected to the database and change the database on single user mode.

Error TF246017

Today I performed a trial migration upgrade on one of our Team Foundation Server 2005 servers. I encountered the following error message:

TF246017: Team Foundation Server could not connect to the database. Verify that the server that is hosting the database is operational, and that network problems are not blocking communication with the server.

My resolution to the error message is simple. I left out the TfsIntegration database. As part of the migration, we need to make sure that the following databases are backup and restore accordingly on the desination server.

– TfsIntegration
– TfsBuild
– TfsWarehouse
– TfsWorkItemTracking
– TfsWorkItemTrackingAttachments
– TfsVersionControl
– TfsActivityLogging

To be frank, I personally think that the error message is very misleading.

Retrieve the list of all workspaces from all users on all computers

Many times we need to retrieve the list of all workspaces from all users on all computers to remove unwanted workspaces. You can use the workspaces command to retrieve information about workspaces on the current computer, owned by a specified user, or for all workspaces associated with a specific Team Foundation Server.

Required Permissions
To use the workspaces command, you must have the Read permission set to Allow.

To undo all the changes in another user’s workspace, perform the following steps:

1.Click Start, click All Programs, click Microsoft Visual Studio 2010, point to Visual Studio Tools, and then click Visual Studio 10.0 Command Prompt.

2.Type the following command at the command prompt and replace the arguments with the appropriate parameter information for your needs:

tf workspaces /owner:* /computer:* /server:http://YourTeamFoundationServerComputer:8080/tfs

Example Output:

C:\Program Files\Microsoft Visual Studio 10.0\VC>tf workspaces /owner:* /computer:* /server:http://WIN-GS9GMUJITS8:8080/tfs

Collection: http://win-gs9gmujits8:8080/tfs
Workspace                                   Owner                                              Computer                             Comment
——————-                              ——————-                               —————                            ———————–
1_1_WIN-GS9GMUJITS8  NT AUTHORITY\SYSTEM   WIN-GS9GMUJITS8     Workspace Created by Te
WIN-GS9GMUJITS8             aprist                                                 WIN-GS9GMUJITS8
WIN-GS9GMUJITS8             abuobe                                             WIN-GS9GMUJITS8

Undo all changes in another user’s workspace

Recently, I migrated one of our in-house Team Foundation Server 2008 servers to Team Foundation Server 2010. After the migration, I noticed that there are several pending changes from a user that I need to remove. In this case, I need to use the tf undo command. If a team member is blocked from checking in a file that is locked by someone else, you can use the tf undo command to delete Team Foundation version control pending changes in another user’s workspace.

Required Permissions:
To undo pending changes in another user’s workspace, you must have the Administer workspaces permission set to Allow.

To undo all the changes in another user’s workspace, perform the following steps:

1.Click Start, click All Programs, click Microsoft Visual Studio 2010, point to Visual Studio Tools, and then click Visual Studio 10.0 Command Prompt.

2.Type the following command at the command prompt and replace the arguments with the appropriate parameter information for your needs:

tf undo /workspace:YourOtherUserWorkspace;YourOtherUser /recursive “$/YourTeamProject” /s:http://YourTeamFoundationServerComputer:8080/tfs

Example Output:

C:\Program Files\Microsoft Visual Studio 10.0\VC>tf undo /workspace:WIN-GS9GMUJITS8;aprist /s:http://win-gs9gmujits8:8080/tfs /recursive “$/Tailspin Toys”
The operation completed successfully.  Because you do not have Use permission on the workspace WIN-GS9GMUJITS8;aprist, you must perform a separate get operation in that workspace to update it with the changes that have been made on the server.

Change the port number for SharePoint 3.0 Central Administration

To change the port number for SharePoint 3.0 Central Administration, perform the following steps:

1. Open an elevated Command Prompt in Windows. (Tip: Click Start, point to All Programs and Accessories, then right click on Command Prompt and click on Run as administrator.)

2. Change directory to “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\Bin

2. Enter “Stsadm –o setadminport –port 17012

This command will change SharePoint Central Administration v3 to run on port 17012.

Recreate “Default Web Site” in Internet Information Services 7.0/7.5

Many a times during the installation of Team Foundation Server, typically application tier, I found that there are people who purposely delete the Default Web Site. I need to recreate the deleted Default Web Site so that I can proceed with the installation of Team Foundation Server, namely application tier.

You can recreate Default Web Site in Internet Information Services 7.0/7.5 by performing the following steps:

1. Right click on Sites folder and click Add Web Site….
2. Under Site name, type Default Web Site.
3. Under Application pool, select DefaultAppPool.
4. Under Physical path, type C:\Inetpub\wwwroot.
5. Click OK.
6. Verify that the Default Web Site is created with the ID 1. If the Default Web Site does not show ID 1 , then perform the following additional steps.
7. Open Command Prompt as an Administrator.
8. Go to C:\Windows\System32\inetsrv\config and type notepad applicationHost.config.
9. Find Default Web Site and change id=”x” to id=”1”.
10. Save applicationHost.config.
11. Now refresh IIS Manager and start the Web Site.

Delete a Team Project Collection

You can delete team project collections that are no longer being used in your deployment of Visual Studio Team Foundation Server. You can delete a team project collection at a command prompt by using the TFSConfig Collection command.

1. On your Team Foundation Server application tier, open a command window to [Team Foundation Server Installation Drive]:\Program Files\Microsoft Team Foundation Server 2010\Tools

2. Enter “TFSConfig Collection /delete /collectionName:[Collection Name]

3. Respond to the irreversible “Are you sure” prompt

Note: To perform the above procedures, you must be a member of the following groups:

1. a member of the Administrators security group on the server or servers that are running the administration console for Team Foundation

2. a member of the sysadmin group on the server or servers that are running the instance of SQL Server that hosts the databases for Team Foundation Server

3. a member of the Farm Administrators group for the farm from which you are deleting the site collection, if your deployment uses SharePoint Products