We are currently upgrading our SQ server (enterprise) from version 9.9 to 2025.1 as zip installation on RHEL8.
We use Oracle 19c as the database server.
The upgrade failed at the following step and we had to revert to 9.9 version by restoring the backup.
Any idea what caused DB to throw this error and how we fix this?
Error thrown in web.log:
2025.08.21 08:40:33 INFO web[o.s.s.p.d.m.s.MassUpdate] 0 rows processed (0 items/sec)
2025.08.21 08:40:33 INFO web[o.s.s.p.d.m.s.MassUpdate] 709 rows processed (11 items/sec)
2025.08.21 08:40:33 INFO web[o.s.s.p.d.m.s.MassUpdate] 0 rows processed (0 items/sec)
2025.08.21 08:40:33 INFO web[DbMigrations] 4/37 #108006 ‘Migrate the content of ‘live_measures’ to ‘measures’ for portfolios’: success | time=197ms
2025.08.21 08:40:33 INFO web[DbMigrations] 5/37 #108007 ‘Create primary key on ‘measures’ table’…
2025.08.21 08:41:37 ERROR web[DbMigrations] 5/37 #108007 ‘Create primary key on ‘measures’ table’: failure | time=64594ms
2025.08.21 08:41:37 ERROR web[DbMigrations] Executed 4/37 DB migrations: failure | time=874169ms
2025.08.21 08:41:37 ERROR web[o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=874237ms
2025.08.21 08:41:37 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 #108007 ‘Create primary key on ‘measures’ table’ failed
at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:105)
at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:89)
at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:66)
at org.sonar.server.platform.db.migration.engine.MigrationEngineImpl.execute(MigrationEngineImpl.java:55)
at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doUpgradeDb(DatabaseMigrationImpl.java:106)
at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doDatabaseMigration(DatabaseMigrationImpl.java:81)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalStateException: Fail to execute ALTER TABLE measures ADD CONSTRAINT pk_measures PRIMARY KEY (component_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.v108.CreatePrimaryKeyOnMeasuresTable.createPrimaryKey(CreatePrimaryKeyOnMeasuresTable.java:45)
at org.sonar.server.platform.db.migration.version.v108.CreatePrimaryKeyOnMeasuresTable.execute(CreatePrimaryKeyOnMeasuresTable.java:39)
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:101)
... 8 common frames omitted
Caused by: java.sql.SQLException: ORA-02437: cannot validate (SQ_OWNER.PK_MEASURES) - primary key violated
.....
Caused by: oracle.jdbc.OracleDatabaseException: ORA-02437: cannot validate (SQ_OWNER.PK_MEASURES) - primary key violated
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:636)
... 28 common frames omitted
2025.08.21 08:49:51 INFO web[o.s.p.ProcessEntryPoint] Gracefully stopping process
2025.08.21 08:49:52 INFO web[c.z.h.HikariDataSource] HikariPool-1 - Shutdown initiated…
2025.08.21 08:49:52 INFO web[c.z.h.HikariDataSource] HikariPool-1 - Shutdown completed.
2025.08.21 08:49:52 INFO web[o.s.s.app.WebServer] Web Server stopped
2025.08.21 08:50:11 INFO web[o.s.p.ProcessEntryPoint] Starting Web Server