wso2is-km upgrade from 5.7 to 5.10 - wso2

I am upgrading wso2is-km from 5.7 to 5.10. I am following document.
https://is.docs.wso2.com/en/latest/setup/migrating-to-5100/
But I am getting below error. Can you please provide link for db script which is required for migration?
Caused by: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO IDN_OIDC_SCOPE_CLAIM_MAPPING (SCOPE_ID, EXTERNAL_CLAIM_ID) SELECT 6,IDN_CLAIM.ID FROM IDN_CL
AIM LEFT JOIN IDN_CLAIM_DIALECT ON IDN_CLAIM_DIALECT.ID = IDN_CLAIM.DIALECT_ID WHERE CLAIM_URI='sub' AND IDN_CLAIM_DIALECT.DIALECT_URI='http://wso2.org/oidc/cla
im' AND IDN_CLAIM_DIALECT.TENANT_ID=-1234 was aborted: ERROR: insert or update on table "idn_oidc_scope_claim_mapping" violates foreign key constraint "idn_oidc
_scope_claim_mapping_scope_id_fkey"
Detail: Key (scope_id)=(6) is not present in table "idn_oidc_scope". Call getNextException to see other errors in the batch.
at org.postgresql.jdbc.BatchResultHandler.handleError(BatchResultHandler.java:148)
Caused by: org.postgresql.util.PSQLException: ERROR: column "uuid" does not exist
Hint: Perhaps you meant to reference the column "sp_app.id".
Position: 310
Caused by: org.postgresql.util.PSQLException: ERROR: column "image_url" does not exist
Position: 302
Detailed error:
Caused by: java.lang.Exception: Error occurred while executing : DROP FUNCTION IF EXISTS OIDC_SCOPE_DATA_MIGRATE_FUNCTION
at org.wso2.carbon.is.migration.service.SchemaMigrator.executeSQL(SchemaMigrator.java:303)
at org.wso2.carbon.is.migration.service.SchemaMigrator.executeSQLScript(SchemaMigrator.java:234)
... 31 more
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at end of input
Position: 59

When you run the provided migration client in the doc, it executes the relevant DB scripts and you don't have to execute any DB scripts manually again.
Can you please recheck whether you followed the steps correctly in the doc?
Please note the following in the doc for PostgreSQL.
"During the migration, "uuid-ossp" extension is created in the database. In order to create this extension, the database user should have the 'Superuser' permission. If the user is not already a superuser, assign the permission before starting the migration.
ALTER USER <user> WITH SUPERUSER;"

Related

Errors when upgrade WSO2 IS as KM and APIs are not migrated

I tried to upgrade WSO2 IS as KM from 5.6.0 to 5.7.0 and API Manager from 2.5.0 to 2.6.0 in corresponding with instructions:
https://docs.wso2.com/display/AM260/Upgrading+from+the+Previous+Release+when+WSO2+IS+is+the+Key+Manager
https://docs.wso2.com/display/IS570/Upgrading+from+the+Previous+Release
https://docs.wso2.com/display/AM260/Upgrading+from+the+Previous+Release
In instructions there is no mention that i need to import SQl script again to DB apimgt from /dbscripts/apimgt/mysql.sql, cause 5.7.0 IS as KM has more tables in that DB than 5.6.0 version.
During upgrade of IS i have errors in logs:
ERROR {org.wso2.carbon.is.migration.service.SchemaMigrator} - Error occurred while executing SQL script for migrating database
java.lang.Exception: Error occurred while executing : CREATE INDEX IDX_RID ON IDN_UMA_RESOURCE (RESOURCE_ID)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate key name 'IDX_RID'
ERROR {org.wso2.carbon.is.migration.service.SchemaMigrator} - Error occurred while executing SQL script for migrating database
java.lang.Exception: Error occurred while executing : CREATE INDEX IDX_SP_TEMPLATE ON SP_TEMPLATE (TENANT_ID, NAME)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate key name 'IDX_SP_TEMPLATE'
ERROR {org.wso2.carbon.is.migration.service.SchemaMigrator} - Error occurred while executing SQL script for migrating database
java.lang.Exception: Error occurred while executing : ALTER TABLE CM_PURPOSE ADD COLUMN PURPOSE_GROUP VARCHAR(255) NOT NULL, ADD COLUMN GROUP_TYPE VARCHAR(255) NOT NULL, DROP KEY NAME, ADD UNIQUE KEY (NAME, TENANT_ID, PURPOSE_GROUP, GROUP_TYPE)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate column name 'PURPOSE_GROUP'
INFO {org.wso2.carbon.is.migration.service.v570.migrator.OAuthDataMigrator} - WSO2 Product Migration Service Task : Migration starting on OAuth2 access token table.
java.lang.OutOfMemoryError: GC overhead limit exceeded
Dumping heap to /usr/lib64/wso2/wso2is-km-5.7.0/repository/logs/heap-dump.hprof ...
Unable to create /usr/lib64/wso2/wso2is-km-5.7.0/repository/logs/heap-dump.hprof: File exists
ERROR {org.wso2.carbon.is.migration.MigrationClientImpl} - Migration process was stopped.
java.lang.OutOfMemoryError: GC overhead limit exceeded
Despite on errors IS is launched, after i launched API-M without errors, but my APIs are not migrated.
I use MariaDB 5.5.
What is the problem with IS and why APIs dont migrated?
"So i shouldn't do Steps from 2.1 to 2.4, yes? But what with errors that i have during upgrade of IS?"
That means, didn't you do the steps 2.1 to 2.4 in https://docs.wso2.com/display/AM260/Upgrading+from+the+Previous+Release#c130adc044364015ae336f584909e3ac?
If you have already followed the steps mentioned in https://docs.wso2.com/display/AM260/Upgrading+from+the+Previous+Release+when+WSO2+IS+is+the+Key+Manager#250, then you need to skip only the 2.4 step in https://docs.wso2.com/display/AM260/Upgrading+from+the+Previous+Release#c130adc044364015ae336f584909e3ac.
Also please make sure that you have given the versions correctly in the migration-config.yaml file as below.
migrationEnable: "true"
currentVersion: "5.6.0"
migrateVersion: "5.7.0"
Note: You do not need to create tables manually.

This query ran against the "innovate-db" database, unless qualified by the query

im receiving this two errors: please help me .
Your query has the following error(s):
Output bucket doesn't exist: s3://aws-athena-query-results-041497399321-ap-southeast-1/Unsaved/2019/02/11/09e29893-68f8-42fd-ae1e-4af88b90d82e.csv
This query ran against the "innovate-db" database, unless qualified by the query. Please post the error message on our forum or contact customer support with Query Id: 09e29893-68f8-42fd-ae1e-4af88b90d82e.
SYNTAX_ERROR: line 1:12: Column 'created_at' cannot be resolved
This query ran against the "innovate-db" database, unless qualified by the query. Please post the error message on our forum or contact customer support with Query Id: b2a0b094-1f4a-4485-bd6c-5d944802eb44.
how may i fix this errors.
The first error is saying that the chosen output bucket does not exist.
Click the Settings option in the Amazon Athena console and enter the name of a bucket that does exist.
The second error is saying that there is no column defined as created_at.

I'm getting java.lang.RuntimeException in solr

I'm getting above exception and failed to indexing the data to solr
Full Import failed:java.lang.RuntimeException: java.lang.RuntimeException:
org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query:
select * from workbook Processing Document # 1
I think the problem is with the url parameter. If the MySQL database is on the same machine, then use url="jdbc:mysql://localhost/mydb" If its on www.mysite.com, then use url="jdbc:mysql://www.mysite.com/mydb"
Also, your log files may have more details regarding the error - please go through the logs and post the appropriate entries here.
NEW EDIT ON REQUIREMENT
Under solr-dataconfig.xml
Check this
<dataSource name="jdbc" driver="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:#//192.168.1.25:1521/UNIDEV" username="test"/>

Django models.ForeignKey Foreign Key Constraint

I have the following 2 apps in my Django project. One app (player) has a ForeignKey that references the other app (team).
App 1 - players/models.py
class Player(models.Model):
name = models.CharField(max_length=100)
team = models.ForeignKey(Team)
App 2 - teams/models.py
class Team(models.Model):
name = models.CharField(max_length=100)
Problem #1 - Everything seems to work, but when I try to run manage.py reset teams I get the following error :
Error: Error: users couldn't be reset. Possible reasons:
* The database isn't running or isn't configured correctly.
* At least one of the database tables doesn't exist.
* The SQL was invalid.
Hint: Look at the output of 'django-admin.py sqlreset users'. That's the SQL this command wasn't able to run.
The full error: (1217, 'Cannot delete or update a parent row: a foreign key constraint fails')
I made sure all my tables are InnoDB. I've seen people suggest using SET FOREIGN_KEY_CHECKS=0 as a fix, but I'm not sure how to best use this with manage.py rest
Problem #2 - When I do a mysqldump, I cannot restore my MySQL db without running into errors. My basic procedure is as follows:
Dump my db.
mysqldump --user=root --password=pass --result-file=MYBACKUP.SQL --compact MYDB
DROP the database, and CREATE a new one with the same name.
Restore my db.
mysql -u root -p MYDB < MYBACKUP.SQL
And that's it. When I attempt to restore the first time, it gives me this error
ERROR 1005 (HY000) at line 12: Can't create table 'MYDB.auth_group_permissions' (errno: 150)
When I attempt to restore for the second (and subsequent) time, it makes it one line farther, but it gives me this error:
ERROR 1050 (42S01) at line 3: Table 'auth_group' already exists
I think those errors have to do with Foreign Key Constraints, but I'm not sure how to fix it.
I know this was a mouthful but any advice would be greatly appreciated. I'll post my findings here tomorrow, if any.
Thanks in advance!
Solution for Problem 2 - So my problem with dumping and then restoring my db has to do with how I use mysql dump - the --compact flag is causing the problem.
This line ...
mysqldump --user=root --password=pass --result-file=MYBACKUP.SQL --compact MYDB
... should be ...
mysqldump --user=root --password=pass --result-file=MYBACKUP.SQL MYDB

Django syncing Database Integrity Error

i was trying to deploy my application to heroku i was using sqlite so i have changed the settings to postgreSQL, i had some initial data initial_data.json then i removed it but i keep getting this error when i try to syncdb even without any initial data.
File /usr/local/lib/python2.6/site-packages/django/db/backends/postgresql_psycopg2/base.py, line 44, in execute
return self.cursor.execute(query, args)
django.db.utils.IntegrityError: duplicate key value violates unique constraint auth_permission_content_type_id_key
actually after looking i found that i have a permission i added customly that propably caused a conflict when i removed it it worked !!