Upgrade task 4408 fails with: "java.sql.SQLException: ORA-22859: invalid modification of columns"
Problem
Bamboo using Oracle DB fails to upgrade and presents the following errors in atlassian-bamboo.log
2017-05-16 14:39:08,435 INFO [16-UpgradeTaskBackgroundThread:pool-31-thread-1] [AbstractUpgradeManager] 4408 : Increase size of variable value in context to 4000 characters (post-bootstrap,
priority)
2017-05-16 14:39:08,435 INFO [16-UpgradeTaskBackgroundThread:pool-31-thread-1] [AbstractUpgradeManager] -------------------------------------------------------------------------------------
----------
2017-05-16 14:39:08,436 INFO [16-UpgradeTaskBackgroundThread:pool-31-thread-1] [UpgradeTask4408ResizeVariableContextValueField] Oracle DBMS: proceeding with alter table
2017-05-16 14:39:08,476 WARN [16-UpgradeTaskBackgroundThread:pool-31-thread-1] [SqlExceptionHelper] SQL Error: 22859, SQLState: 99999
2017-05-16 14:39:08,477 ERROR [16-UpgradeTaskBackgroundThread:pool-31-thread-1] [SqlExceptionHelper] ORA-22859: invalid modification of columns
2017-05-16 14:39:08,487 ERROR [16-UpgradeTaskBackgroundThread:pool-31-thread-1] [AbstractUpgradeManager] org.springframework.orm.hibernate5.HibernateJdbcException: JDBC exception on Hiberna
te data access: SQLException for SQL [n/a]; SQL state [99999]; error code [22859]; error executing work; nested exception is org.hibernate.exception.GenericJDBCException: error executing wo
rk
org.springframework.orm.hibernate5.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [n/a]; SQL state [99999]; error code [22859]; error executing work;
nested exception is org.hibernate.exception.GenericJDBCException: error executing work
at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:171)
at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:344)
at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:309)
at com.atlassian.bamboo.persistence.BambooConnectionTemplate$1.doInTransactionWithoutResult(BambooConnectionTemplate.java:35)
at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at com.atlassian.bamboo.persistence.BambooConnectionTemplate.execute(BambooConnectionTemplate.java:30)
at com.atlassian.bamboo.upgrade.tasks.AbstractInHibernateTransactionUpgradeTask.doUpgrade(AbstractInHibernateTransactionUpgradeTask.java:35)
at com.atlassian.bamboo.upgrade.AbstractUpgradeManager.runUpgradeTask(AbstractUpgradeManager.java:210)
at com.atlassian.bamboo.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:95)
...
Caused by: org.hibernate.exception.GenericJDBCException: error executing work
...
Caused by: java.sql.SQLException: ORA-22859: invalid modification of columns
...
at com.atlassian.bamboo.upgrade.tasks.v5_6.UpgradeTask4408ResizeVariableContextValueField.doUpgrade(UpgradeTask4408ResizeVariableContextValueField.java:58)
Cause
The upgrade task 4408 is part of Bamboo 5.6 changes and requires Oracle 11g to succeed.
If an upgrade path tries this upgrade task with Oracle 12c, for example, it will fail. This will happen if we jump from a version prior to 5.6 to a version above 5.11.
Resolution
Add an additional upgrade step to Bamboo 5.11 to make sure all upgrade tasks designed to run using Oracle 11g are run with this database version.
- upgrade Bamboo using Oracle 11g to Bamboo 5.11 (latest Bamboo version using Oracle 11g according to Bamboo v5.11 - Supported platforms)
- make sure the upgrade succeeded and Bamboo is working as expected
- migrate database from Oracle 11g to 12c
- start Bamboo 5.11, making sure the same works correctly
- upgrade Bamboo to aimed version
As a good practice, backup Bamboo logs during the upgrade process on each step so it can be reviewed by Atlassian Support in case needed.