SonarQube Database Copy Tool

Must-share information (formatted with Markdown):

  • which versions are you using : 8.9
  • how is SonarQube deployed: zip
  • what are you trying to achieve Copy database from soon to be retired server to the newly built server then upgrade to 9.9LTS
  • what have you tried so far to achieve this:

Currently we have a Windows 2022 Server and a dedicated 2019 SQL server. Both servers have been configured and we have confirmed that SonarQube runs and both the server and SQL server report success.

The next step that I’m trying is to use the SonarQube DB Copy Tool to pull the data off old server onto the new server/db.

Following instructions from: SonarQube database copy tool (sonarsource.com)

I have unzipped the jar file as recommended and from the command prompt I have browsed to the directory that the jar file is saved to. I’ve run the command shown in the screen shot below (left out the other specifics).

We are copying data from Postgres (Old Server) to SQL (New Server).

image

After part of the day I’m unable to figure out why the jar file won’t run - I’ve downloaded a couple times and don’t believe it is corrupted.

Any help is appreciated.

Thanks

Hi,

Welcome to the community!

I’ve just downloaded the jar & run it, and it worked:

Tell us more about your Java install. What version are you running, and is it a JDK or simple JRE?

Could you expand on this? You don’t need to unzip the DB Copy jar.

 
Ann

Hello Ann,

Thank you for responding!

I’ve installed the JDK as shown:
image

Version on server:
image

Regarding unzipping, I might have misread but per instructions from
Install the server (sonarsource.com)

" Installing SonarQube from the ZIP file

First, check the requirements. Then download and unzip the distribution (do not unzip into a directory starting with a digit)."

Regards,

Erik

Hi Erik,

Okay. From your initial post, it wasn’t clear to me whether you might have unzipped the DB Copy jar file.

Regarding the error you get when you try to execute the jar… I’m wondering if there’s something “helpful” on your network that might have munged the jar on the way to you. It might be worth trying to download and execute from somewhere else to test and/or talking to your network folks.

Going back to your procedure (and just to make sure), the docs say:

DB Copy only copies data, not the schema. This is why the purpose of [the preparation phase] step is to populate target with an empty SonarQube schema.

So you need to have SonarQube create the empty schema in your DB before you try to run the copy tool. Now, this is not the right time to do your upgrade. Since the data you’ll be copying is from 8.9, you should have 8.9 do the schema creation. So, do not point 9.9 at your new DB. Instead:

  • use 8.9 to create the schema in your new DB
  • use the DB Copy Tool to copy your 8.9 data to the new DB
  • now point 9.9 at the new DB and have it upgrade your schema for you.

 
Ann

1 Like

Hi Anne,

You were spot on!! Work firewall appears to have been blocking or stripping out most of the Jar file as it was only 24kb. Was able to download on home system and copy to work and it now runs.

Really appreciate the assistance! Will run the command tomorrow and see how it goes.

Thanks again!

Erik

1 Like