Upgrade Sonar qube

in the first setup for Sonar 10.4 , show to us the upgrade and ta is required , when we did the maintance the below error log is shown and the Database upgrade is failed, could you please help how we solve it


2024.04.02 09:03:25 INFO  web[][DbMigrations] #100015 'Add ncloc to 'Projects' table': success | time=197ms
2024.04.02 09:03:25 INFO  web[][DbMigrations] #100016 'Populate ncloc in 'Projects' table'...
2024.04.02 09:03:25 ERROR web[][DbMigrations] #100016 'Populate ncloc in 'Projects' table': failure | time=208ms
2024.04.02 09:03:25 ERROR web[][DbMigrations] Executed DB migrations: failure | time=409ms
2024.04.02 09:03:25 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=459ms
2024.04.02 09:03:25 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 #100016 'Populate ncloc in 'Projects' 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:422)
	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:54)
	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:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:842)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'live_measures'.
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:259)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1695)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:648)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:567)
	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7675)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:4137)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:272)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:246)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:485)
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
	at org.sonar.server.platform.db.migration.step.SelectImpl.scroll(SelectImpl.java:74)
	at org.sonar.server.platform.db.migration.step.MassUpdate.execute(MassUpdate.java:93)
	at org.sonar.server.platform.db.migration.version.v100.PopulateNclocForForProjects.execute(PopulateNclocForForProjects.java:48)
	at org.sonar.server.platform.db.migration.step.DataChange.execute(DataChange.java:44)
	at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:75)

Hey there.

That’s weird. If you check your database, do you have a table called live_meaures?

no, should we add it?

No – if it’s not there, that’s a big problem!

This is the very first time you’re starting SonarQube? You aren’t upgrading from a previous version (no matter what the UI/logs said?)

yes its the first time to downlead.

we have table with project.measure is it the same?
and how get the UI log?

this the log in web.log file:


2024.04.03 10:31:03 INFO  web[][o.s.p.ProcessEntryPoint] Starting Web Server
2024.04.03 10:31:03 INFO  web[][o.s.s.a.TomcatHttpConnectorFactory] Starting Tomcat on port 9000
2024.04.03 10:31:06 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 10.4.1.88267 / b4b21d73b333be40b994dbbc4730efb54374dff7
2024.04.03 10:31:06 INFO  web[][o.s.d.DefaultDatabase] Create JDBC data source for jdbc:sqlserver://212.107.109.124;databaseName=SonarQubeNaqel;encrypt=false;
2024.04.03 10:31:06 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Starting...
2024.04.03 10:31:07 INFO  web[][c.z.h.p.HikariPool] HikariPool-1 - Added connection ConnectionID:1 ClientConnectionId: f5ca025e-62c2-4641-84c1-117b9dd0de66
2024.04.03 10:31:07 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Start completed.
2024.04.03 10:31:08 INFO  web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: D:\Ebtihal\sonarqube-enterprise-10.4.1.88267\sonarqube-10.4.1.88267
2024.04.03 10:31:08 INFO  web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2024.04.03 10:31:08 INFO  web[][o.s.c.e.CoreExtensionsLoader] Loaded core extensions: enterprise-edition, ce-workers, developer-scanner, developer-server, governance, github-provisioning, gitlab-provisioning, license, securityreport, monitoring, scim, gitlab-vulnerability-report
2024.04.03 10:31:09 WARN  web[][o.s.s.p.DatabaseServerCompatibility] The database must be manually upgraded. Please backup the database and browse /setup. For more information: https://docs.sonarsource.com/sonarqube/latest/setup/upgrading
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy ABAP Code Quality and Security / 3.14.0.5470 / ed8f535cc76a0a2be68bcfd2de29eff22412e83f
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Apex Code Quality and Security / 1.15.0.4655 / 28938525c4093d5e9fa4e858535bbcb60af7f066
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy C# Code Quality and Security / 9.19.0.84025 / 919a72f86bbe46efa58da7cf9c60725489e33005
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy CFamily Code Quality and Security / 6.52.1.66618 / 20a3a27bae72ee4d99c88b854fd5e7732c3d69cf
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy COBOL Code Quality / 5.6.0.7604 / 3d9919465fb080ff10c29bdd29619e33adc461f5
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Clean as You Code / 2.3.0.1782 / 1db4e32c08cf9d0b999498e7ba4fd5849583dfdd
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Dataflow Bug Detection / 1.22.0.7341 / 0
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Dataflow Bug Detection Rules for Java / 1.22.0.7341 / 0
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Dataflow Bug Detection Rules for Python / 1.22.0.7341 / 0
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Flex Code Quality and Security / 2.12.0.4568 / e8b2821a05db57b79b8ae85e3db1571f5b744273
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Go Code Quality and Security / 1.15.0.4655 / 28938525c4093d5e9fa4e858535bbcb60af7f066
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy HTML Code Quality and Security / 3.13.0.4821 / 380c7b2b69ec812c52f58d75873123fad2ad9429
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy IaC Code Quality and Security / 1.26.0.8471 / null
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy JaCoCo / 1.3.0.1538 / 74a7798c7cea687c72ed9df40c93eb7ea2a58c49
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Java Code Quality and Security / 7.30.0.34429 / ece994b44873ef9f9de151d7af023dc238733b26
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy JavaScript/TypeScript/CSS Code Quality and Security / 10.11.1.25225 / b377dc9f07d77c532bfaa7d819fa3dba46e52d08
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Kotlin Code Quality and Security / 2.20.0.4382 / eb22cc4ed915de84e358135dd3f2ea2080de1441
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy PHP Code Quality and Security / 3.33.0.11274 / 89583886fa2f4951991f0550938d64572117fd0c
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy PL/I Code Quality and Security / 1.15.0.4810 / 9a38207e30a026fef7a06a3826e3a90da81a58bf
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy PL/SQL Code Quality and Security / 3.12.0.6513 / 39004ddbfbf935e44594ab56013ca71502176c8e
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Python Code Quality and Security / 4.14.0.14263 / 17b124821fadcb914376e4dab20f358056a8486f
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy RPG Code Quality / 3.8.0.4662 / da1795fc8e4bd07106859aae63c3d36ca20bc774
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Ruby Code Quality and Security / 1.15.0.4655 / 28938525c4093d5e9fa4e858535bbcb60af7f066
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Scala Code Quality and Security / 1.15.0.4655 / 28938525c4093d5e9fa4e858535bbcb60af7f066
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Swift Code Quality and Security / 4.12.0.7262 / f947de544e18adb09cf1d5397bf3e5956d49fde9
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy T-SQL Code Quality and Security / 1.12.0.7020 / 84a550b150b49fcd59c3452b7089f7fa49c9e4e6
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Text Code Quality and Security / 2.8.0.1635 / null
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Text Code Quality and Security / 2.8.0.1635 / null
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy VB.NET Code Quality and Security / 9.19.0.84025 / 919a72f86bbe46efa58da7cf9c60725489e33005
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy VB6 Code Quality and Security / 2.12.0.4860 / 265e40a88d61285c1aefe0298a8e6ddff4b097fe
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Vulnerability Analysis / 10.4.0.30099 / 7acf09b551bc4915ef1cf27090de5bd597391480
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Vulnerability Rules for C# / 10.4.0.30099 / 7acf09b551bc4915ef1cf27090de5bd597391480
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Vulnerability Rules for JS / 10.4.0.30099 / 7acf09b551bc4915ef1cf27090de5bd597391480
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Vulnerability Rules for Java / 10.4.0.30099 / 7acf09b551bc4915ef1cf27090de5bd597391480
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Vulnerability Rules for PHP / 10.4.0.30099 / 7acf09b551bc4915ef1cf27090de5bd597391480
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Vulnerability Rules for Python / 10.4.0.30099 / 7acf09b551bc4915ef1cf27090de5bd597391480
2024.04.03 10:31:10 INFO  web[][o.s.s.p.ServerPluginManager] Deploy XML Code Quality and Security / 2.10.0.4108 / 34b16ba369117f6befc0b1e0866a069a80f6db2e
2024.04.03 10:31:25 INFO  web[][o.s.s.p.d.m.c.MssqlCharsetHandler] Verify that database collation is case-sensitive and accent-sensitive
2024.04.03 10:31:25 INFO  web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [http://kubernetes.docker.internal:9001]
2024.04.03 10:31:27 WARN  web[][o.s.a.s.w.WebService$Action] Description is not set on action api/monitoring/metrics
2024.04.03 10:31:27 WARN  web[][o.s.a.s.w.WebService$Action] Since is not set on action api/monitoring/metrics
2024.04.03 10:31:27 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/monitoring/metrics
2024.04.03 10:31:27 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/system/liveness
2024.04.03 10:31:27 INFO  web[][o.s.s.p.Platform] Database needs to be migrated. Please refer to https://docs.sonarsource.com/sonarqube/latest/setup/upgrading
2024.04.03 10:31:27 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.platform.web.WebServiceFilter@690df641 [pattern=UrlPattern{inclusions=[/api/system/migrate_db.*, ...], exclusions=[/api/components/update_key, ...]}]
2024.04.03 10:31:29 INFO  web[][o.h.v.i.util.Version] HV000001: Hibernate Validator null
2024.04.03 10:31:47 INFO  web[][o.s.s.p.d.m.DatabaseMigrationImpl] Starting DB Migration and container restart
2024.04.03 10:31:47 INFO  web[][DbMigrations] Executing DB migrations...
2024.04.03 10:31:47 INFO  web[][DbMigrations] #100016 'Populate ncloc in 'Projects' table'...
2024.04.03 10:31:47 ERROR web[][DbMigrations] #100016 'Populate ncloc in 'Projects' table': failure | time=184ms
2024.04.03 10:31:47 ERROR web[][DbMigrations] Executed DB migrations: failure | time=188ms
2024.04.03 10:31:47 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=250ms
2024.04.03 10:31:47 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 #100016 'Populate ncloc in 'Projects' 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:422)
	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:54)
	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: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: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'live_measures'.
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:259)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1695)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:648)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:567)
	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7675)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:4137)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:272)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:246)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:485)
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
	at org.sonar.server.platform.db.migration.step.SelectImpl.scroll(SelectImpl.java:74)
	at org.sonar.server.platform.db.migration.step.MassUpdate.execute(MassUpdate.java:93)
	at org.sonar.server.platform.db.migration.version.v100.PopulateNclocForForProjects.execute(PopulateNclocForForProjects.java:48)
	at org.sonar.server.platform.db.migration.step.DataChange.execute(DataChange.java:44)
	at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:75)
	... 9 common frames omitted

from UI we received the below message

Upgrade Failed

Database connection cannot be established. Please check database status and JDBC settings

My suggestion would be that for now, you delete (drop) your existing database and start over, and see if the error goes away.

yes colin, its fixed now . thanks
but when we run the sonar again we received the below error. please note the user has full permission

“failed to read content of table schema_migrations”

could you please help me on this

Typically this is a user privilege issue.

we already provide the admin access to the user that we used but still have same issue, is there any specials access?

its solved, thanks