Change Azure Devops Source Control Database

Copper 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.