Migrate SonarQube to another environment

Dear all,

we are using SonarQube Developer edition and trying to migrate a running instance to another environment.Therefore, we want to migrate all the data in SonarQube (including the metadata) to another SonarQube instance in another environment with a new database.

As I understood, the DB Copy Tool is not the correct approach, but we would suggest to try it. Does anybody has other approaches how to move all the data and rules from one SonarQube instance to another one?

Best regards,

Hi Andreas,

Welcome to the community!

It’s not clear to me what you’re doing. You want to both migrate your SonarQube data to a new database, and move SonarQube to a new environment?

For the former, it should just be a question of taking a DB backup and restoring it in the new environment. Unless you’re changing DB flavors? Either way, this move will likely result in a new server ID, so you’ll have to get with your sales contact to get a new license key issued.

For the latter, it’s simply a question of installing SonarQube in the new environment and pointing it at the active DB.


Hi Ann,

thank you for your answer. I want to specify my requirements:

Currently we are moving our datacenter to another service provider. Therefore, we have a running SonarQube instance running in production in DC1. Now, we installed a parallel environment in DC2. So, we have to running SonarQube instance, a production one in DC1 and a new one in DC2. Both instances have their own database.

The question is now: How do we get all the old data from the instance in DC1 to the instance in DC2? Following approaches were discussed:

  • DB Copy Tool
    We can copy the data from DC 1 database to DC 2 database by using the DB Copy Tool. Unfortunately, we are now allowed to use this tool.

  • Moving the data from DC 1 database to DC2 database by a DB dump
    This option was tested last week. We found out, that this option is not working. The instance in DC 2 didn’t display the project data of instance 1. So this is not working

Do you have additional approaches?


The DB Copy tool is for migrating from one DB engine to another. If you were switching from E.G. Postgres to Oracle, then it would be appropriate.

Assuming you’re staying on the same DB engine, then what you want to do is back up your DB from the first environment and restore the backup in the second environment.

Ehm… I think it’s pretty broad strokes to say this doesn’t work. It didn’t work for you, in that situation.

The question is what that situation was. Had you previously started up your Env2 instance? If so, it created Elasticsearch indices of your - presumably empty - initial DB. Unless you deleted any such indices ($SONARQUBE-HOME/data/es7) before you started the instance back up, then it’s quite natural you wouldn’t see your instance1 projects, since the projects and issues lists come from Elasticsearch indices, which would have been empty.

You probably want to treat this as a fresh install in Env2, with the one caveat of the DB restore, so that your “new” instance comes up the first time pointing to an already-populated DB.

As a side note, unless your Env2 DB has the same URL as your Env1 DB, you’re going to end up with a new server id, which will require a new license key. Your sales contact can help you with that.