Change Azure Devops Source Control Database

%3CLINGO-SUB%20id%3D%22lingo-sub-2463370%22%20slang%3D%22en-US%22%3EChange%20Azure%20Devops%20Source%20Control%20Database%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2463370%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20have%20two%20SQL%20Servers%2C%20Server%20A%20and%20Server%20B%20that%20are%20part%20of%20an%20Always%20On%20availability%20group.%20All%20of%20our%20Team%20Projects%20and%20Devops%20point%20directly%20to%20Server%20A.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EServer%20A%20is%20currently%20down.%20We%20want%20to%20change%20it%20so%20Devops%20points%20to%20our%20Listener%20connection%20ListenerAG%20as%20we%20can't%20even%20open%20up%20our%20projects%20in%20Visual%20Studio%20as%20it's%20trying%20to%20read%20from%20the%20database%20on%20Server%20A.%20ListenerAG%20automatically%20determines%20which%20server%2Fnode%20is%20Primary%20and%20will%20redirect%20to%20that.%20All%20of%20our%20configuration%20databases%20are%20synchronized%20between%20the%20two%20through%20Always%20On.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20have%203%20databases%20that%20are%20part%20of%20the%20AG%20used%20by%20DevOps%3A%20AzureDevOps_Configuration%2C%20AzureDevOps_Collection1%2C%20AzureDevOps_Collection2.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20an%20easy%20way%20while%20logged%20onto%20the%20host%20of%20Devops%20(Server%20C)%20to%20tell%20it%20to%20use%20ListenerAG%20instead%20of%20ServerA%20for%20these%20databases%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEDIT%3A%20I've%20tried%20replying%20with%20info%20that%20I've%20found%20but%20the%20replies%20aren't%20saving.%20From%20Server%20C%20that%20hosts%20Devops%2C%20can%20I%20run%20the%20following%20to%20accomplish%20this%3F%3CBR%20%2F%3E%3CBR%20%2F%3Etfsconfig%20registerDB%20%2FsqlInstance%3A%20ListenerAG%20%2FdatabaseName%3A%20TFS_Configuration%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

We have two SQL Servers, Server A and Server B that are part of an Always On availability group. All of our Team Projects and Devops point directly to Server A.

 

Server A is currently down. We want to change it so Devops points to our Listener connection ListenerAG as we can't even open up our projects in Visual Studio as it's trying to read from the database on Server A. ListenerAG automatically determines which server/node is Primary and will redirect to that. All of our configuration databases are synchronized between the two through Always On.

 

We have 3 databases that are part of the AG used by DevOps: AzureDevOps_Configuration, AzureDevOps_Collection1, AzureDevOps_Collection2.

 

Is there an easy way while logged onto the host of Devops (Server C) to tell it to use ListenerAG instead of ServerA for these databases?

 

EDIT: I've tried replying with info that I've found but the replies aren't saving. From Server C that hosts Devops, can I run the following to accomplish this?

tfsconfig registerDB /sqlInstance: ListenerAG /databaseName: AzureDevOps_Configuration

2 Replies

Found this link: https://docs.microsoft.com/en-us/azure/devops/server/admin/backup/restore-data-different-instance?vi...

Is this all we'd have to do is run this for our instance and TFS_Configuration ?
TfsConfig registerDB /SQLInstance: ListenerAG /DatabaseName: TFS_Configuration

 

Would that automatically update the collections or is that all just managed in the Configuration database?

To register the location of the databases:

On the application-tier server, open a Command Prompt window, and change directories to Drive:\%programfiles%\Azure DevOps Server 2019\Tools.

At the command prompt, enter the following command, where DatabaseName is the name of the configuration database (by default, TFS_Configuration):

TfsConfig registerDB /SQLInstance: ServerName /DatabaseName: DatabaseName

For more information, see RegisterDB command.

Based on the below section from the website https://docs.microsoft.com/en-us/azure/devops/server/admin/backup/restore-data-different-instance?vi... , all I may need to do is this.

TfsConfig registerDB /SQLInstance: ListenerAG /DatabaseName: TFS_Configuration

Can anyone confirm and is there a way to get the current value before I change this in case we need to revert for any reason?

From the link above:
To register the location of the databases:

On the application-tier server, open a Command Prompt window, and change directories to Drive:\%programfiles%\Azure DevOps Server 2019\Tools.

At the command prompt, enter the following command, where DatabaseName is the name of the configuration database (by default, TFS_Configuration):

TfsConfig registerDB /SQLInstance: ServerName /DatabaseName: DatabaseName

For more information, see RegisterDB command.