What are you trying to achieve: I have been testing SonarQube Community edition which is running on a VM with MS SQL 2022 installed, I’m trying to move it to a dedicated MS SQL 2019 VM that is also being used by other apps.
What have you tried so far to achieve this: I created a bacpac file from the MS SQL 2022 and restored it on the MS SQL 2019, database tables and data seems to be correctly imported. The problem I have is that SonarQube wipes all the data on the database as soon as it starts up. I have observed this weird behaviour on other SonarQube testing environments but I never was able to reproduce it, now I can not stop it from happening, at least on this instance, and don’t know what is causing it.
This has been happening now for a while and currently I can not initialize my SonarQube instance because it wipes all data that is on the database when I start it. I had a backup of a few months ago and everytime I restore the database and start SonarQube it deletes everything and starts from scratch, I can see that the users table that is populated with quite a few of users is deleted as soon as SonarQube starts, leaving the default admin user only. SonarQube acts as if it is the first booting up, asking to change the default admin password. Currenlty I can not get SonarQube to start without wiping the database.
Sorry for taking so long to reply, I see a few files inside the logs folder, I’m not completely sure which one is the most useful in this case. I will share sonar.log and web.log, if there is any other what might be useful I can upload it. web.log (45.3 KB) sonar.log (3.6 KB)
SonarQube sees this as a fresh install. Line 34 of web.log:
2024.09.30 10:23:09 INFO web[][o.s.s.p.d.m.AutoDbMigration] Automatically perform DB migration on fresh install
So the question is, what’s in the schema it’s connecting to before it does that? Because SonarQube wouldn’t do this if it recognized an existing SonarQube DB schema. What’s in
2024.09.30 10:22:58 INFO web[][o.s.d.DefaultDatabase] Create JDBC data source for jdbc:sqlserver://BDSQTEST.us.local;databaseName=SonarQube;trustServerCertificate=true;integratedSecurity=true
It’s a database we migrated over from a MS SQL 2022 instance to MSSQL 2019 using a bacpac file. The import process was simply clicking on the Databases folder in SQL Server Management Studio and using the “Import Data-tier Application” option. Data and users seems to be on the tables. When I start SonarQube I can see the dbo.users table being wiped out. Could be there something that is missing when importing the Database that is causing SonarQube to think that is a fresh install? Where should I look?
I’m not familiar with bacpac files. All I can say is that something must be missing. I’m not sure what, exactly SonarQube is looking for (at a guess, the migrations table, but that’s a pure, wild guess) to know whether to start fresh or not. But after your next restore & before you crank up SonarQube again, you should do a comparison to see what’s missing.