Sonarqube db copy tool

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) - Sonarqube version is 8.4.1 and postgresql version is 14.3
  • what are you trying to achieve - postgresql database migration from one database to other postgresql database.
  • what have you tried so far to achieve this - Able to connect the source and target databases from local machines.

Hi Team,

I have gone through the sonarqube db copy tool docs and have couple of questions while executing the jar file.

In the DB copy preparation phase, there’s a point stating that “Configure your SonarQube copy to connect to the target database. (If you’ve placed your SonarQube copy on the same server that runs your primary SonarQube instance, you’ll also need to configure non-default ports for your copy SonarQube instance.)”
Which means do i need to take a copy of primary sonarqube database and connect to the target database?

How to pass below parameters in the jar file?
driverSrc : null
urlSrc : null
userSrc : null
pwdSrc : null
urlDest : null
driverDest : null
userDest : null
pwdDest : null
commitSize : 5000

Jagan Siram

Hey there.

If you’re moving between database instances of the same database platform (postgres → postgres), there’s no need to use the DB Copy Tool (and you shouldn’t). A simple pg_dump and pg_restore will work fine.

Okay… Thank you Colin

Hi Colin,

I have a query with regards to the migration process,

→ I’m going to migrate azure postgresql database from one server to different server( azure postgresql) exists on different organization.

→ Will pg_dump & pg_restore commands will include complete meta data of sonarqube as well to restore in new different azure postgresql server exists on different organization?

Thanks in advance!


The DB backup and restore will move (copy) everything in the DB, including the SQ metadata.

If you’re using a commercial version, you should be aware that when you change your DB URL, you’ll need to contact our business office to have a new license key generated.


Okay… Thanks for the information!

Basically, They have segregated in to two entities with in our company. So, we would like to migrate same postgresql database from company 1 to company 2 and both companies are using sonarqube enterprise edition and same version of postregsql database & sonarqube application. We would like to migrate entire database using pg_dumpall & pg_restore commands after the database restoration in company 2, I would expect data should be accessible without any issues.

In this case company 2 already using sonarqube enterprise edition which means company 2 have a new license key generated. How the DB URL will change? Please correct if my understanding is wrong?


Hi Jagan,

If both entities already have Enterprise Edition($$), then project move may be your best bet, depending on how many projects we’re talking about.

That’s going to be the only clean way to integrate projects from one instance into another, existing instance.

Like this:

Won’t that change the DB URL?


Yes, It will change the JDBC DB URL but we’re exporting & importing the data using postgresql commands so the data will be merged/overwritten in the new database right? Please advise if my understanding is correct? If we need to change the DB URL, where we need to update?

Thanks for your assistance!
Jagan Siram

Hi Jagan,

I don’t advise using raw database manipulation to add projects/issues to an existing instance’s database. Maybe the DB has evolved beyond it now, but we’ve seen problems in the past from this sort of thing. Ideally you’re going to:

  • Migrate to a clean / empty DB
  • Use the project export/import functionality to move projects from one instance to another

Anything else, and you’re likely to end up with an unstable instance. At a minimum, I would make sure you have good backups before you try what you’ve described.

You don’t need to change it. It sounded to me like a JDBC URL change was inherent in what you were proposing. And if that’s the case, you’ll need to contact the business side to get an updated license key since the key is tied to your JDBC URL.