Support Questions

Find answers, ask questions, and share your expertise

ambari-server upgrade Issues from Ambari 2.4.2 to 2.5.0.3

avatar
Contributor

Hi,

PFA

I was trying to upgrade ambari 2.5.0.3

ambari-server upgrade

facing below error,

ERROR [main] DBAccessorImpl:847 - Error executing query: ALTER TABLE hostcomponentdesiredstate ADD CONSTRAINT PK_hostcomponentdesiredstate PRIMARY KEY (id)java.sql.SQLSyntaxErrorException: ORA-00955: name is already used by an existing object .

Failed to run the Amba ri Server org.apache.ambari.server.AmbariException: Current database store version is not compatible with current server version, serverVersion=2.5.0.3, schemaVersion=2.4 .2 at org.apache.ambari.server.checks.DatabaseConsistencyCheckHelper.checkD BVersionCompatible(DatabaseConsistencyCheckHelper.java:222) at org.apache.ambari.server.controller.AmbariServer.main(AmbariServer.ja va:1002)

Oracle Database need to update Schema automatically once ambari-server upgrade, but some how i am geting above issues.

any solution ?


upgrade.png
1 ACCEPTED SOLUTION

avatar
Super Collaborator

You're hitting an issue with Ambari Server Upgrade from 2.4.2 to 2.5.0.3 - as part of this upgrade, we need to drop and re-create the primary key on the hostcomponentdesiredstate table. The error you're getting indicates that the primary key already exists and thus can't be added again.

In your logs, you might see something like this statement:

Unable to determine the primary key constraint name for hostcomponentdesiredstate

I'd like to know why this might be happening (could be an artifact of how your Oracle DB is installed). In any event, you should be able to correct this by hand and re-run the upgrade:

ALTER TABLE hostcomponentdesiredstate DROP CONSTRAINT PK_hostcomponentdesiredstate;
ALTER TABLE hostcomponentdesiredstate ADD CONSTRAINT PK_hostcomponentdesiredstate PRIMARY KEY (id);

Now you can retry "ambari-server upgrade"

View solution in original post

2 REPLIES 2

avatar
Super Collaborator

You're hitting an issue with Ambari Server Upgrade from 2.4.2 to 2.5.0.3 - as part of this upgrade, we need to drop and re-create the primary key on the hostcomponentdesiredstate table. The error you're getting indicates that the primary key already exists and thus can't be added again.

In your logs, you might see something like this statement:

Unable to determine the primary key constraint name for hostcomponentdesiredstate

I'd like to know why this might be happening (could be an artifact of how your Oracle DB is installed). In any event, you should be able to correct this by hand and re-run the upgrade:

ALTER TABLE hostcomponentdesiredstate DROP CONSTRAINT PK_hostcomponentdesiredstate;
ALTER TABLE hostcomponentdesiredstate ADD CONSTRAINT PK_hostcomponentdesiredstate PRIMARY KEY (id);

Now you can retry "ambari-server upgrade"

avatar
Contributor

I found the root cause, ambari user which is created for oracle DB not have enough privileges to drop the Constraint. When I run ambari-server update the constraint is not dropping and not replacing new constraint.