共用方式為


ChangeServerID Command

The ChangeServerID command changes the global universal identifications (GUIDs) that are associated with the databases for Visual Studio Team Foundation Server (TFS). GUIDs must be unique within a deployment of TFS. If more than one database has the same GUID, your deployment can become unstable or unusable. You can change the GUID for the configuration database, the GUIDs for all team project collection databases in the deployment, or both. Although you would not typically use this command in daily operations, you might use this command in the following circumstances:

  • You restored your deployment to new hardware, the old deployment is still operational, and you want to utilize both deployments. This scenario is sometimes referred to as cloning the server.

  • You want to test a software update or a hardware configuration on a duplicate deployment so that you do not risk disrupting your production environment.

  • You want to fully test the restoration of databases to new hardware in a test lab or separate environment, to ensure that your deployment can be restored.

  • You must reset the GUID for a collection database after moving it to another deployment for which that GUID is already reserved.

    Note

    The ChangeServerID command is not reversible. After a GUID has been changed, you cannot undo that change except by restoring a previous version of that database.

Required Permissions

To use the ChangeServerID command, you must be a member of the Team Foundation Administrators security group and a member of the sysadmin security group for any SQL Server databases that Team Foundation Server uses. For more information, see Permission reference for Team Foundation Server.

Note

Even if you log on with administrative credentials, you must open an elevated Command Prompt window to perform this function.

TFSConfig ChangeServerID /SQLInstance:ServerName] /DatabaseName:ConfigurationDatabaseName [/ProjectCollectionsOnly] [/ConfigDBOnly] [/usesqlalwayson]

Parameters

Placeholder

Description

ServerName

Specifies the name of the server that hosts the configuration database for TFS and the name of the instance if you want to use an instance other than the default instance. If you specify an instance, you must use the following format:

ServerName\InstanceName

DatabaseName

Specifies the name of the configuration database. By default, the name of this database is TFS_ConfigurationDB.

Option

Description

/SQLInstance:ServerName

Required. Specifies the name of the server that is running SQL Server and the name of the instance if you want to use an instance other than the default instance. If you specify an instance, you must use the following format:

ServerName\InstanceName

/DatabaseName:DatabaseName

Required. Specifies the name of the configuration database for TFS.

/ProjectCollectionsOnly

Specifies that only the GUIDs for collections will be changed.

/ConfigDBOnly

Specifies that only the GUID for the configuration database will be changed.

/usesqlalwayson

Specifies that the databases are part of an AlwaysOn Availability Group in SQL Server. If configured, this option sets MultiSubnetFailover in the connection string.

For more information, see AlwaysOn Availability Groups (SQL Server).

Remarks

You use the ChangeServerID command to create a discrete duplicate of a deployment of Team Foundation Server for testing or cloning purposes. After you use the ChangeServerID command, you must direct clients to create a connection to the changed server before it can be used.

Example

The following example shows how to change the GUIDs of all databases in the Contoso1 deployment of TFS, where the configuration database is hosted on the server that is named "ContosoMain" on the named instance "TeamDatabases" in SQL Server.

Note

The examples are for illustration only and are fictitious. No real association is intended or inferred.

TFSConfig ChangeServerID /SQLInstance:ContosoMain\TeamDatabases /DatabaseName:TFS_ConfigurationDB

See Also

Concepts

Back up and restore TFS

Other Resources

TFSConfig: Manage TFS server configuration

Move a team project collection

Split a team project collection