Migrate H2 database for SonarQube version upgrade

Hi,

  • We are using SonarQube 7.9.2 community edition
  • Want to update SonarQube to 8.9.6 LTS in the same server
  • We’ve extracted the 8.9.6 zip files to another directory, updated the sonar.properties, wrapper.config files, stopped & uninstalled the windows service for previous version, installed & started the windows service for the new version, after that we didn’t find any existing projects, users, quality gates, etc. in the site, it started as a brand new site.

After some analysis came to know that the current 7.9.2 is using H2 database.
Tried copying the sonar.mv.db to 8.9.6 directory but it isn’t working, also localhost:9000/setup URL says migration not supported for embedded databases.

How can we get all the data from previous version to the new version’s H2 embedded database in the same server, we don’t have any customizations on the database, it has lot of data such as projects, quality gates, users, etc. all those should be cloned to newer directory or version.

Please suggest.

Hey there.

On every page, while using the embedded database, there is a big warning that it is not suitable for production use and not possible to migrate to a newer version. You will need to start from scratch.

1 Like

Hi,

Yes, I was just getting started with SonarQube, today I saw at some pages that it’s recommended to use our own DB such as SQL, Oracle, etc. but this environment was setup long back.

Any simple way to perform the migration?, like

  1. writing a one time job using code to migrate the data from H2 DB tables to new DB.
  2. use any free tools available which could aid the process.
  3. manually setup all the projects, quality gates from UI by using own DB. So, that next migrations would be easy by cloning this DB or writing scripts.

Could you please suggest.

@amateen Maybe in my reply you can get some insights Upgrade sonarqube to psql without data loss from h2 database