Hello, I am running a version upgrade from SonarQube from version 7.2 to version 8.7 and an error occurred while performing the database migration. I would like a help, I will try to detail the information below.
According to the documentation to update from version 7.2 to version 8.7, I must first update from version 7.2 to version 7.9.5 LTS and then finally to the most current version, 8.7.
The upgrade from version 7.2 to version 7.9 occurred successfully, however when performing the upgrade from version 7.9 to 8.7 the error below occurred. Database is SQLServer 2014.
2021.02.23 17:06:31 INFO web[][DbMigrations] Executing DB migrations...
2021.02.23 17:06:31 INFO web[][DbMigrations] #3540 'Copy 'LIVE_MEASURES' table to 'LIVE_MEASURES_COPY''...
2021.02.23 17:06:31 ERROR web[][DbMigrations] #3540 'Copy 'LIVE_MEASURES' table to 'LIVE_MEASURES_COPY'': failure | time=31ms
2021.02.23 17:06:31 ERROR web[][DbMigrations] Executed DB migrations: failure | time=31ms
2021.02.23 17:06:31 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=140ms
2021.02.23 17:06:31 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 #3540 'Copy 'LIVE_MEASURES' table to 'LIVE_MEASURES_COPY'' 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:834)
Caused by: java.lang.IllegalStateException: Fail to execute SELECT uuid, project_uuid, component_uuid, CAST (metric_id AS NVARCHAR (40)) AS metric_uuid, value, text_value, variation, measure_data, update_marker, created_at, updated_at INTO live_measures_copy FROM live_measures
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.step.DdlChange$ContextImpl.execute(DdlChange.java:128)
at org.sonar.server.platform.db.migration.version.v84.metrics.livemeasures.CopyLiveMeasuresTable.execute(CopyLiveMeasuresTable.java:53)
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: com.microsoft.sqlserver.jdbc.SQLServerException: There is already an object named 'live_measures_copy' in the database.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1632)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:872)
at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:767)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7418)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:3274)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:247)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:222)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(SQLServerStatement.java:743)
at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:194)
at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:194)
at org.sonar.server.platform.db.migration.step.DdlChange$ContextImpl.execute(DdlChange.java:91)
... 14 common frames omitted
2021.02.23 17:18:26 INFO web[][o.s.p.ProcessEntryPoint] Gracefully stopping process
2021.02.23 17:18:26 INFO web[][o.s.s.app.WebServer] WebServer stopped