Summary
Creating an XML Backup using Oracle JDBC driver 12.1.0.2 doesn't properly export the Active Objects tables sequence definitions.
Environment
- Confluence 5.9.9
- Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
Steps to Reproduce
- Download the Oracle JDBC driver 12.0.1.2 from Oracle's website and place into <confluence_install>/confluence/WEB-INF/lib/.
- Connect Confluence to Oracle via direct JDBC as per Database Setup for Oracle
- Generate an XML backup via Confluence Admin > Backup & Restore.
Expected Results
Sequence definitions for Active Object tables are exported.
This can be inspected by extracting the XML Backup and browsing the plugin-data/com.atlassian.activeobjects.confluence.spi/activeObjectsBackupRestoreProvider.pdata file.
Using the table AO_9412A1_AOUSER as an example, we would expect the autoIncrement attribute for the ID column definition (the primary key) set to true, as following:
<table name="AO_9412A1_AOUSER">
<column name="CREATED" primaryKey="false" autoIncrement="false" sqlType="93" scale="6"/>
<column name="ID" primaryKey="true" autoIncrement="true" sqlType="2" precision="20"/>
<column name="LAST_READ_NOTIFICATION_ID" primaryKey="false" autoIncrement="false" sqlType="2" precision="20"/>
<column name="TASK_ORDERING" primaryKey="false" autoIncrement="false" sqlType="2005" precision="2147483647"/>
<column name="UPDATED" primaryKey="false" autoIncrement="false" sqlType="93" scale="6"/>
<column name="USERNAME" primaryKey="false" autoIncrement="false" sqlType="12" precision="255"/>
</table>
Actual Results
The primary keys for the tables in the plugin-data/com.atlassian.activeobjects.confluence.spi/activeObjectsBackupRestoreProvider.pdata file have their autoIncrement attribute set to false.
Using the previous example (AO_9412A1_AOUSER.ID)
<table name="AO_9412A1_AOUSER">
<column name="CREATED" primaryKey="false" autoIncrement="false" sqlType="93" scale="6"/>
<column name="ID" primaryKey="true" autoIncrement="false" sqlType="2" precision="20"/>
<column name="LAST_READ_NOTIFICATION_ID" primaryKey="false" autoIncrement="false" sqlType="2" precision="20"/>
<column name="TASK_ORDERING" primaryKey="false" autoIncrement="false" sqlType="2005" precision="2147483647"/>
<column name="UPDATED" primaryKey="false" autoIncrement="false" sqlType="93" scale="6"/>
<column name="USERNAME" primaryKey="false" autoIncrement="false" sqlType="12" precision="255"/>
</table>
Business Impact
Importing this XML Backup into a new Confluence instance will corrupt the data and break several Confluence functionalities, including inline tasks and plugins that rely on Active Objects such as Team Calendars. Administrators can expect errors to be printed in Confluence logs which indicate that sequences are missing. The below snippet is an example following an XML import into a Postgres database:
Notes
This was reproducible on Confluence 5.9.9 but likely affects all prior versions supporting Oracle 12c (Confluence 5.7+)
Workaround 1
Modify the plugin-data/com.atlassian.activeobjects.confluence.spi/activeObjectsBackupRestoreProvider.pdata file such that the primary key of each AO table has autoIncrement set to "true". This will ensure that once imported, the correct sequences will be created for the primary keys.
Workaround 2
When generating an XML backup, temporarily revert to the Oracle JDBC 12.1.0.1 driver instead.