Upgrade Failed with "Table has no primary key" Error Message
The Confluence upgrade process failed due a missing primary key or constraint in one of its tables. In the below example the problematic table is the LINKS table. The following appears in
2015-01-12 14:22:56,204 ERROR [localhost-startStop-1] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized Upgrade failed, application will not start: Upgrade task com.atlassian.confluence.upgrade.upgradetask.LowerCaseUsernameReferencesUpgradeTask@292e1ad3 failed during the SCHEMA_UPGRADE phase due to: Table 'LINKS' has no primary key com.atlassian.confluence.upgrade.UpgradeException: Upgrade task com.atlassian.confluence.upgrade.upgradetask.LowerCaseUsernameReferencesUpgradeTask@292e1ad3 failed during the SCHEMA_UPGRADE phase due to: Table 'LINKS' has no primary key at com.atlassian.confluence.upgrade.AbstractUpgradeManager.executeUpgradeStep(AbstractUpgradeManager.java:273) at com.atlassian.confluence.upgrade.AbstractUpgradeManager.runSchemaUpgradeTasks(AbstractUpgradeManager.java:217) at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:167) at com.atlassian.confluence.upgrade.UpgradeLauncherServletContextListener.contextInitialized(UpgradeLauncherServletContextListener.java:51) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
There are two possible causes for this behavior:
- The constraint was previously removed while making changes to the database.
- The constraint was not added during a previous upgrade attempt.
- Restore your database from a working backup.
- Create a temporary Confluence instance that matches the version you restored to.
- Match the LINKS table from your Confluence with the LINKS table from the fresh installation.
- Shutdown your Confluence.
- Add the missing constraints so the LINKS table in both instances match
- Confluence を起動します。
- Try upgrading again.
- If it fails again with a different table repeat the process to find out the missing constraints and fix them (AO tables can be ignored)
Since these steps involve multiple changes to the database, we strongly recommend using a DBA to assist in this task.