Moving the SonarQube database from Postgres 9.2 to 9.6 fails

I am attempting to move the SQ database from Postgres 9.2 to 9.6 and it does not work correctly. Assistance will be greatly appreciated.

Initial state
SQ 7.1 and Postgres 9.2.24 running on the same CentOS 7.6 box

Desired state
SQ 7.1 on one box, using Postgres 9.6.12 on another box, both CentOS 7.6

Steps taken

  1. Stop sonar
  2. Dump database with pg_dump --host=/tmp sonar | bzip2 > sonar.psql.bz2
  3. Copy dump to Postgres box
  4. Create the sonar database on the Postgres box
    create user sonar with encrypted password 'md5…';
    drop database sonar;
    create database sonar owner sonar encoding 'UTF8';
    grant all privileges on database sonar to sonar;
  5. Recreate the sonar database on the dedicated Postgres box
    bzcat sonar.psql.bz2 | psql --host=/tmp --user=sonar --password
  6. Update with the new connection string
  7. Restart sonar

SonarQube knows how many projects it has, but does not display any of them. It does display information about rules and bugs, etc. Overall, it is not usable. Visiting the /setup endpoint does not accomplish anything.

Other thoughts
Once I get this working, I will upgrade SQ from 7.1 to 7.7. If anything in the database upgrade process affects the SQ upgrade process, please share that information also.

Thanks in advance,


Try stopping your instance, completely removing the /data/es5 folder from your SonarQube installation and starting again.

Don’t panic if it takes a little longer to startup — it’s reindexing!

Thank you very much!

You’re welcome! Good luck with the 7.7 upgrade (and make sure to read the upgrade notes carefully. It’s been an eventful 7.x series!)

1 Like