Upgrade from 8.2 to 8.5 failed

Template for a good bug report, formatted with Markdown:

  • versions used (SonarQube, Scanner, Plugin, and any relevant extension)
  • error observed (wrap logs/code around triple quote ``` for proper formatting)
  • steps to reproduce
  • potential workaround

P.S.: use the #bug:fault sub-category if you’re hitting a specific crash/error , or the #bug:fp sub-category for rules-related behaviour
Hi,
I’m attempting to upgrade SonarQube 8.2 to 8.5. Running the ‘setup’ produces the following error on the ‘properties’ table ->

 web[][DbMigrations] #3593 'Add 'uuid' column for 'PROPERTIES''...
2020.10.20 13:42:38 INFO  web[][DbMigrations] #3593 'Add 'uuid' column for 'PROPERTIES'': success | time=48ms
2020.10.20 13:42:38 INFO  web[][DbMigrations] #3594 'Populate 'uuid' for 'PROPERTIES''...
2020.10.20 13:42:38 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 120 rows processed (2 items/sec)
2020.10.20 13:42:38 INFO  web[][DbMigrations] #3594 'Populate 'uuid' for 'PROPERTIES'': success | time=35ms
2020.10.20 13:42:38 INFO  web[][DbMigrations] #3595 'Make 'uuid' column not nullable for 'PROPERTIES''...
2020.10.20 13:42:38 INFO  web[][DbMigrations] #3595 'Make 'uuid' column not nullable for 'PROPERTIES'': success | time=35ms
2020.10.20 13:42:38 INFO  web[][DbMigrations] #3596 'Drop primary key on 'ID' column of 'PROPERTIES' table'...
2020.10.20 13:42:42 INFO  web[][DbMigrations] #3596 'Drop primary key on 'ID' column of 'PROPERTIES' table': success | time=4565ms
2020.10.20 13:42:42 INFO  web[][DbMigrations] #3597 'Add primary key on 'UUID' column of 'PROPERTIES' table'...
2020.10.20 13:42:42 ERROR web[][DbMigrations] #3597 'Add primary key on 'UUID' column of 'PROPERTIES' table': failure | time=20ms
2020.10.20 13:42:42 ERROR web[][DbMigrations] Executed DB migrations: failure | time=190863ms
2020.10.20 13:42:42 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=190935ms
2020.10.20 13:42:42 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration ended with an exception
org.sonar.server.platform.db.migration.step.MigrationStepExecutionException: Execution of migration step #3597 'Add primary key on 'UUID' column of 'PROPERTIES' table' failed
        at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:79)
        at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:67)
        at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:405)
        at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:52)
        at org.sonar.server.platform.db.migration.engine.MigrationEngineImpl.execute(MigrationEngineImpl.java:68)
        at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doUpgradeDb(DatabaseMigrationImpl.java:105)
        at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doDatabaseMigration(DatabaseMigrationImpl.java:80)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:835)
Caused by: java.lang.IllegalStateException: Fail to execute ALTER TABLE properties ADD CONSTRAINT pk_properties PRIMARY KEY (uuid)
        at org.sonar.server.platform.db.migration.step.DdlChange$ContextImpl.execute(DdlChange.java:106)
        at org.sonar.server.platform.db.migration.step.DdlChange$ContextImpl.execute(DdlChange.java:86)
        at org.sonar.server.platform.db.migration.version.v84.properties.AddPrimaryKeyOnUuidColumnOfPropertiesTable.execute(AddPrimaryKeyOnUuidColumnOfPropertiesTable.java:35)
        at org.sonar.server.platform.db.migration.step.DdlChange.execute(DdlChange.java:45)
        at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:75)
        ... 9 common frames omitted
Caused by: java.sql.SQLSyntaxErrorException: ORA-00955: name is already used by an existing object

        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399)
        at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1059)
        at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:522)
        at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:257)
        at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:587)
        at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:210)
        at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:30)
        at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:932)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1150)
        at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1792)
        at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1745)

Hi,

It looks like you’ve hit

SONAR-13985 - Migration is failing on Oracle when schema is copied/refreshed

which is fixed in 8.5.1 and should be available for download on Monday.

 
HTH,
Ann