Upgrade from 5.8.16 to 5.9.2 fails: ORA-02261: such unique or primary key already exists in the table
Asked by Michael_Coxe:

After pre-upgrade prep \& then starting Confluence, it gets this far before falling over:

```
2015-12-08 17:19:45,101 INFO [localhost-startStop-1] [confluence.upgrade.impl.DefaultUpgradeManager] beforeUpgrade Finished generating pre-upgrade recovery file.** OK until now **2015-12-08 17:20:37,164 ERROR [localhost-startStop-1] [hibernate.tool.hbm2ddl.SchemaUpdate] execute Unsuccessful: alter table USER_RELATION add constraint u2u_relation_unique unique (SOURCEUSER, TARGETUSER, RELATIONNAME)2015-12-08 17:20:37,165 ERROR [localhost-startStop-1] [hibernate.tool.hbm2ddl.SchemaUpdate] execute ORA-02261: such unique or primary key already exists in the table2015-12-08 17:20:37,165 ERROR [localhost-startStop-1] [hibernate.tool.hbm2ddl.SchemaUpdate] execute could not complete schema updatejava.sql.SQLSyntaxErrorException: ORA-02261: such unique or primary key already exists in the table        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450)        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399)        at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1017)        at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:655)        at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:249)        at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:566)        at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:202)        at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:45)        at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:933)        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1075)        at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1640)        at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1603)        at oracle.jdbc.driver.OracleStatementWrapper.executeUpdate(OracleStatementWrapper.java:308)        at com.mchange.v2.c3p0.impl.NewProxyStatement.executeUpdate(NewProxyStatement.java:410)        at net.sf.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:167)        at bucket.core.persistence.hibernate.schema.SchemaHelper.updateSchemaIfNeeded(SchemaHelper.java:206)        at bucket.core.persistence.hibernate.schema.SchemaHelper.updateSchemaIfNeeded(SchemaHelper.java:181)        at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:160)        at com.atlassian.confluence.plugin.PluginFrameworkContextListener.launchUpgrades(PluginFrameworkContextListener.java:136)        at com.atlassian.confluence.plugin.PluginFrameworkContextListener.contextInitialized(PluginFrameworkContextListener.java:86)        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4738)        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5181)        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)        at java.util.concurrent.FutureTask.run(FutureTask.java:266)        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)        at java.lang.Thread.run(Thread.java:745)2015-12-08 17:20:37,181 ERROR [localhost-startStop-1] [atlassian.confluence.plugin.PluginFrameworkContextListener] launchUpgrades Upgrade failed, application will not start: com.atlassian.config.ConfigurationException: Cannot update schema***** ?A couple more schema error messages, then proceeds with Plugins startup,   but doesn't appear that is working either.*****
```


Answers:
author: Bruno Raymundo
body: Hi Michael,

It seems you're being affected by this bug: [CONF-40174](https://jira.atlassian.com/browse/CONF-40174)

I suggest you watch it for updates or contact Support in case you require deeper investigation.

Regards,

Bruno


author: Rodrigo Girardi Adami
body: Hi Michael,

While we fix this bug, I recommend to use the 5.9.1 as a workaround to reach the version 5.9.x.

Regards,

Rodrigo


Tags: oracle