Upgrade sonarqube to psql without data loss from h2 database

Hi i want upgrade sonarqube db to psql from existing h2 db without any data loss how should i get my h2 data into psql db please need correct way to chnage db withou any data loss from h2 db.

Thereā€™s no supported way to migrate the data from the h2 database.

2 Likes

So We have a huge data in existing sonarqube h2 db is any alternative way to get that data backup migration possible

I donĀ“t know if it is works for all versions but I have managed to migrate from H2 to PostgreSQL using 8.9.10 LTS CE version.

What I did was to use Squirrel SQL client and use the Embedded H2 and PostgreSQL drivers and copy the data from one database to the other.

The ā€œtrickā€ for connecting to the Embedded H2 database from Squirrel SQL was to start Sonarqube and connect as follows with the URL

jdbc:h2:tcp://localhost:9092/sonar

H2_Embedded

After copying the data, make sure you delete the content under data\es7 (or es8) folder so the indices from ElasticSearch are regenerated