Initializing Oracle db for Developer 8.7 fails with numerous errors

  • 8.7.0.41497 - latest docker image sonarqube:8.7-developer
  • Oracle 19c with 19.1 JDBC
  • how to reproduce - make a clean install into empty db schema

Once I launch Sonar for the 1st time, it starts initializing db up to #3210 ‘Add index on ALM_slug’ bug.

2021.03.03 19:35:02 INFO  web[][o.s.s.p.d.m.AutoDbMigration] Automatically perform DB migration on fresh install
2021.03.03 19:35:03 INFO  web[][DbMigrations] Executing DB migrations...
2021.03.03 19:35:03 INFO  web[][DbMigrations] #1 'Create initial schema'...
2021.03.03 19:35:05 INFO  web[][DbMigrations] #1 'Create initial schema': success | time=2716ms
2021.03.03 19:35:05 INFO  web[][DbMigrations] #2 'Populate initial schema'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #2 'Populate initial schema': success | time=325ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3000 'Set Organizations#guarded column nullable'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3000 'Set Organizations#guarded column nullable': success | time=23ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3001 'Create ProjectQualityGates table'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3001 'Create ProjectQualityGates table': success | time=31ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3002 'Make index on DEPRECATED_RULE_KEYS.RULE_ID non unique'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3002 'Make index on DEPRECATED_RULE_KEYS.RULE_ID non unique': success | time=23ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3003 'Populate ProjectQualityGate table from Properties table'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3003 'Populate ProjectQualityGate table from Properties table': success | time=22ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3004 'Rename ANALYSIS_PROPERTIES.SNAPSHOT_UUID to ANALYSIS_UUID'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3004 'Rename ANALYSIS_PROPERTIES.SNAPSHOT_UUID to ANALYSIS_UUID': success | time=40ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3005 'Remove default quality gate property from Properties table'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3005 'Remove default quality gate property from Properties table': success | time=11ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3006 'Create NEW_CODE_PERIOD table'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3006 'Create NEW_CODE_PERIOD table': success | time=31ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3007 'Populate NEW_CODE_PERIOD table'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3007 'Populate NEW_CODE_PERIOD table': success | time=23ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3008 'Remove leak period properties'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3008 'Remove leak period properties': success | time=6ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3009 'Remove GitHub login generation strategy property'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3009 'Remove GitHub login generation strategy property': success | time=5ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3100 'Create ALM_SETTINGS table'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3100 'Create ALM_SETTINGS table': success | time=29ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3101 'Create PROJECT_ALM_SETTINGS table'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3101 'Create PROJECT_ALM_SETTINGS table': success | time=39ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3102 'Migrate property 'sonar.alm.github.app.privateKey.secured' to 'sonar.alm.github.app.privateKeyContent.secured''...
2021.03.03 19:35:06 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 rows processed (0 items/sec)
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3102 'Migrate property 'sonar.alm.github.app.privateKey.secured' to 'sonar.alm.github.app.privateKeyContent.secured'': success | time=16ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3103 'Migrate GitHub ALM settings from PROPERTIES to ALM_SETTINGS tables'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3103 'Migrate GitHub ALM settings from PROPERTIES to ALM_SETTINGS tables': success | time=13ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3104 'Migrate Bitbucket ALM settings from PROPERTIES to ALM_SETTINGS tables'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3104 'Migrate Bitbucket ALM settings from PROPERTIES to ALM_SETTINGS tables': success | time=11ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3105 'Migrate Azure ALM settings from PROPERTIES to ALM_SETTINGS tables'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3105 'Migrate Azure ALM settings from PROPERTIES to ALM_SETTINGS tables': success | time=6ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3106 'Delete 'sonar.pullrequest.provider' property'...
2021.03.03 19:35:06 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 rows processed (0 items/sec)
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3106 'Delete 'sonar.pullrequest.provider' property': success | time=4ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3107 'Migrate default branches to keep global setting'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3107 'Migrate default branches to keep global setting': success | time=13ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3108 'Add EXCLUDE_FROM_PURGE column'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3108 'Add EXCLUDE_FROM_PURGE column': success | time=36ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3109 'Populate EXCLUDE_FROM_PURGE column'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3109 'Populate EXCLUDE_FROM_PURGE column': success | time=13ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3110 'Remove 'sonar.branch.longLivedBranches.regex''...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3110 'Remove 'sonar.branch.longLivedBranches.regex'': success | time=7ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3111 'Rename 'sonar.dbcleaner.daysBeforeDeletingInactiveShortLivingBranches' setting'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3111 'Rename 'sonar.dbcleaner.daysBeforeDeletingInactiveShortLivingBranches' setting': success | time=5ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3112 'Migrate short and long living branches types to common BRANCH type'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3112 'Migrate short and long living branches types to common BRANCH type': success | time=6ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3113 'Migrate short and long living branches types to common BRANCH type in ce tasks table'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3113 'Migrate short and long living branches types to common BRANCH type in ce tasks table': success | time=10ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3200 'Drop 'In Review' Security Hotspots status '...
2021.03.03 19:35:06 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 rows processed (0 items/sec)
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3200 'Drop 'In Review' Security Hotspots status ': success | time=12ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3201 'Migrate Manual Vulnerabilities to Security Hotspots '...
2021.03.03 19:35:06 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 rows processed (0 items/sec)
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3201 'Migrate Manual Vulnerabilities to Security Hotspots ': success | time=12ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3202 'Remove 'newsbox.dismiss.hotspots' user property'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3202 'Remove 'newsbox.dismiss.hotspots' user property': success | time=8ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3203 'Ensure Security Hotspots have status TO_REVIEW'...
2021.03.03 19:35:06 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 rows processed (0 items/sec)
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3203 'Ensure Security Hotspots have status TO_REVIEW': success | time=8ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3204 'Rename table 'PROJECTS' to 'COMPONENTS''...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3204 'Rename table 'PROJECTS' to 'COMPONENTS'': success | time=46ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3205 'Add PROJECTS table'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3205 'Add PROJECTS table': success | time=36ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3206 'Populate PROJECTS table'...
2021.03.03 19:35:06 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 projects processed (0 items/sec)
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3206 'Populate PROJECTS table': success | time=18ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3207 'Drop 'TAGS' column from COMPONENTS table'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3207 'Drop 'TAGS' column from COMPONENTS table': success | time=26ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3208 'Remove old Security Review Rating measures'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3208 'Remove old Security Review Rating measures': success | time=8ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3209 'Create ALM_PATS table'...
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3209 'Create ALM_PATS table': success | time=27ms
2021.03.03 19:35:06 INFO  web[][DbMigrations] #3210 'Add index on ALM_slug'...
2021.03.03 19:35:06 ERROR web[][DbMigrations] #3210 'Add index on ALM_slug': failure | time=4ms
2021.03.03 19:35:06 ERROR web[][DbMigrations] Executed DB migrations: failure | time=3705ms
2021.03.03 19:35:06 ERROR web[][o.s.s.p.PlatformImpl] Web server startup failed
org.sonar.server.platform.db.migration.step.MigrationStepExecutionException: Execution of migration step #3210 'Add index on ALM_slug' 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.AutoDbMigration.start(AutoDbMigration.java:40)
	at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:40)
	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
	at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
	at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
	at org.picocontainer.behaviors.Stored.start(Stored.java:110)
	at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
	at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
	at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
	at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
	at org.sonar.server.platform.PlatformImpl.start(PlatformImpl.java:213)
	at org.sonar.server.platform.PlatformImpl.startSafeModeContainer(PlatformImpl.java:205)
	at org.sonar.server.platform.PlatformImpl.doStart(PlatformImpl.java:105)
	at org.sonar.server.platform.PlatformImpl.doStart(PlatformImpl.java:96)
	at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:44)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4689)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5155)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1412)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1402)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Can not check that table project_alm_settings exists
	at org.sonar.db.DatabaseUtils.wrapSqlException(DatabaseUtils.java:395)
	at org.sonar.db.DatabaseUtils.findIndex(DatabaseUtils.java:350)
	at org.sonar.db.DatabaseUtils.doIndexExistsIgnoreIndexCase(DatabaseUtils.java:321)
	at org.sonar.db.DatabaseUtils.indexExistsIgnoreCase(DatabaseUtils.java:315)
	at org.sonar.server.platform.db.migration.version.v82.AddIndexOnSlugOfProjectAlmSettings.indexExists(AddIndexOnSlugOfProjectAlmSettings.java:61)
	at org.sonar.server.platform.db.migration.version.v82.AddIndexOnSlugOfProjectAlmSettings.execute(AddIndexOnSlugOfProjectAlmSettings.java:42)
	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)
	... 29 common frames omitted
Caused by: java.sql.SQLException: Invalid argument(s) in call
	at oracle.jdbc.OracleDatabaseMetaData.getIndexInfo(OracleDatabaseMetaData.java:3792)
	at org.apache.commons.dbcp2.DelegatingDatabaseMetaData.getIndexInfo(DelegatingDatabaseMetaData.java:419)
	at org.apache.commons.dbcp2.DelegatingDatabaseMetaData.getIndexInfo(DelegatingDatabaseMetaData.java:419)
	at org.sonar.db.DatabaseUtils.findIndex(DatabaseUtils.java:341)
	... 35 common frames omitted

After google it I tried to apply a workaround:

CREATE INDEX PROJECT_ALM_SETTINGS_SLUG ON PROJECT_ALM_SETTINGS (ALM_SLUG)
INSERT INTO schema_migrations (version) VALUES('3210');
COMMIT;

But after launching db upgrade http://mysonar/setup it fails with another error:

2021.03.03 19:44:16 ERROR web[][DbMigrations] #3412 'Drop unique index on 'uuid' column of 'CE_QUEUE' table': failure | time=3ms
2021.03.03 19:44:16 ERROR web[][DbMigrations] Executed DB migrations: failure | time=879ms
2021.03.03 19:44:16 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=934ms
2021.03.03 19:44:16 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 #3412 'Drop unique index on 'uuid' column of 'CE_QUEUE' 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(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Can not check that table ce_queue exists
	at org.sonar.db.DatabaseUtils.wrapSqlException(DatabaseUtils.java:395)
	at org.sonar.db.DatabaseUtils.findIndex(DatabaseUtils.java:350)
	at org.sonar.db.DatabaseUtils.findExistingIndex(DatabaseUtils.java:330)
	at org.sonar.server.platform.db.migration.step.DropIndexChange.findExistingIndexName(DropIndexChange.java:50)
	at org.sonar.server.platform.db.migration.step.DropIndexChange.execute(DropIndexChange.java:41)
	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.SQLException: Invalid argument(s) in call
	at oracle.jdbc.OracleDatabaseMetaData.getIndexInfo(OracleDatabaseMetaData.java:3792)
	at org.apache.commons.dbcp2.DelegatingDatabaseMetaData.getIndexInfo(DelegatingDatabaseMetaData.java:419)
	at org.apache.commons.dbcp2.DelegatingDatabaseMetaData.getIndexInfo(DelegatingDatabaseMetaData.java:419)
	at org.sonar.db.DatabaseUtils.findIndex(DatabaseUtils.java:341)
	... 14 common frames omitted

So what could be wrong with fresh install on Oracle?

Thanks,
Maksym