SONAR 3.7.3 database update failure - JDBC Error - sonarqube

After installing SONAR 3.7.3 I received the following error on startup: "o.s.s.p.DatabaseServerCompatibility Database must be upgraded. Please browse /setup"
I then followed instructions to upgrade the databse by navigating to http://:/setup. However, when I click update databse I get the following error
The migration failed: An error has occurred, all later migrations canceled: ActiveRecord::JDBCError: ORA-01430: column being added already exists in table : ALTER TABLE reviews ADD manual_severity NUMBER(1).
Please check the logs.
I can see, as the message suggests that the table reviews already exist and it already contains the column manual_severity, so I'm not sure why its trying to re-add it.
Any ideas?

I would use a backup of the database schema and start the process again from the beginning.
If you don't have a backup, I cannot see any other way than to delete the column in your schema and try to migrate the database again, but you might find a lot of errors of this kind and have to repeat this operation some times. Also, you will never be sure that your DB is Ok.

Related

Migration Error in Entity Framework with Oracle Database

I am using Code First, and I want to migrate it to ORACLE database, after multiple migrations process, I am getting this error,
The best overloaded method match for Oracle.ManagedDataAccess.EntityFramework.OracleMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.CreateTableOperation) has some invalid arguments
I'm facing the same problem
finally I solve it by opening the database and delete the migration_history table manually
and run the command again.
see at EF5 Code First - Changing A Column Type With Migrations
in each migration you will save a record in __MigrationHistory, so in case there is no sync between the code and the migration do the following:
delete the migration history table in the database.
migrate it again by create new migration 'in package manager console' add-migration data.
update the migration to database update-database

Oracle Database Copy Failed Using SQL Developer

Few days ago while i tried perform database copy from remote server to local server i got some warnings and one of them was like this
"Error occured executing DDL for TABLE:MASTER_DATA".
And then i clicked yes, but the result of database copy was unexpected, there were only few tables has been copied.
When i tried to see DDL from SQL section/tab on one of table, i got this kind of information
-- Unable to render TABLE DDL for object COMPANY_DB_PROD.MASTER_DATA with DBMS_METADATA attempting internal generator.
I also got this message and i believe this message showed up because there's something wrong with DDL on my database so tables won't be created.
ORA-00942: table or view does not exist
I've never encountered this problem before and i always perform database copy every day since two years ago.
For the record before this problem occurred, i have removed old .arch files manually not by RMAN and i never using any RMAN commands. I also have removed old .xml log files, because these two type of files have made my remote server storage full.
How to trace and fix this kind of problem? Is there any corruption on my Oracle?
Thanks in advance.
The problem was caused by datafile has reached its max size though. I have resolved the problem by following the answer of this discussion ORA-01652: unable to extend temp segment by 128 in tablespace SYSTEM: How to extend?
Anyway, thank you everyone for the help.

Duplicate key error post SonarQube 5.3 upgrade

We have recently upgraded to Sonar 5.3 from 4.4.1 and seen duplicate key issue with one of our projects. I checked the collation and found database server and database to be case insensitive and column to be case sensitive. Should we change collation on the database to "Latin1_General_CS_AS" ? Changing the collation on the server is bit difficult but we can try with database.
SELECT SERVERPROPERTY('COLLATION')
Output: Latin1_General_CI_AS
SELECT DATABASEPROPERTYEX('<SonarDatabaseName>', 'Collation') SQLCollation;
Output: Latin1_General_CI_AS
For the column, it is "Laitn1_General_CS_AS"
Error in sonar log. I did see a duplicate key in the table but not sure if this is due to collation as reported here Duplicate key error with SonarQube 5.2:
ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AVM28yZdM8YcgYQ_GJuI
org.sonar.server.computation.component.VisitException: Visit failed for Component
.
.
### Error updating database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert duplicate key row in object 'dbo.projects' with unique index 'projects_kee'.
Thanks in advance.
Case sensitivity is a requirement, so yes you really need to change the collation of this database (putting it case-sensitive (CS) and accent-sensitive (AS)).

SonarQube upgrade fails from v5.1 to v5.2

I am trying to upgrade SonarQube v5.1 to v5.2 and it fails with below error:
ERROR web[o.s.s.d.m.DatabaseMigrator] Fail to execute database migration: org.sonar.db.version.v52.RemoveDuplicatedComponentKeys
java.lang.IllegalStateException: Error during processing of row:..................................................................
Caused by: java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic#7f872fa8 is still active. No statements may be issued when any streaming result sets are open and in use on a given connection. Ensure that you have called .close() on any active streaming result sets before attempting more queries.
2015.11.05 09:08:32 INFO web[o.s.s.d.m.PlatformDatabaseMigration] DB migration failed | time=6911ms
2015.11.05 09:08:32 ERROR web[o.s.s.d.m.PlatformDatabaseMigration] DB Migration or container restart failed. Process ended with an exception
org.jruby.exceptions.RaiseException: (StandardError) An error has occurred, all later migrations canceled:
Fail to execute database migration: org.sonar.db.version.v52.RemoveDuplicatedComponentKeys
I found a workaround. I've deleted the duplicated projects from the projects table and then restarted the migration process.
To get an idea what is going on, execute the following query on your database:
select p.kee, COUNT(p.kee) FROM projects p GROUP BY p.kee HAVING COUNT(p.kee) > 1;
If you this query returns any elements you have to remove duplicated ones (e.g. the oldest ones). In my case it was easy because I had no isseues in the issue table related to projects in question.
I you have to mimic the SonarQube 5.2 migration procedure step by step (deleting duplicated projects and updating issues for them) you can find a list of queries being executed during the migration step on Github.

Pre-Installation Check Mantis: can't install

I am trying to install Mantis on my server. Problem is that I can't seem to get pass the Pre-Installation Check step. I click on "Install/Upgrade Database", and displays all "GOOD". Then it says:
Database Creation Suppressed, SQL Queries follow
<< here it prints a lot of sql queries, mainly create and alter tables >>. When I say this the first time, I went to MySQL Workbench, (the database bugtracker was already created), and ran the script given. Thereby, creating all the needed tables.
Then it says:
Your database has not been created yet. Please create the database, then install the tables and data using the information above before proceeding.
It checks a few more things (all with result "GOOD") and finally it displays this message:
Install was successful.
Continue to log into Mantis
The previous word "Continue" appears as a hyperlink leading to login_page.php. When I click it, it leads right back to this pre installation check page.
The thing is, the database is created! And the first time I encountered the sql queries I ran them, so the tables are indeed created.
Attempting to connect to database as admin GOOD
Attempting to connect to database as user GOOD
Checking Database Server Version
Running mysql version 5.5.25
My PHP version is 5.3.14.
The Mantis version i'm trying to install is 1.2.11.
Any ideas as in what it is I am doing wrong? Or any other piece of information I could provide?
I realize now that this is not the best place for this question. Nonetheless, in case someone else happens tu stumble across this, I wanted to let know the only workaround I could find was installing another Mantis version: 1.1.1. Very old, but it worked!

Resources