Database Migration to Oracle Fails with "value too large for column" Error on CRU_REVIEW
When trying to migrate from the embedded HSQLDB to Oracle, it fails with a similar on-screen error:
Database error at cru_review:4575 (table:row) of the input: ORA-12899: value too large for column "<Fisheye Database>"."CRU_REVIEW"."CRU_NAME" (actual: 261, maximum: 255) null Database migration failed: com.atlassian.crucible.migration.ParseException: null ORA-12899: value too large for column "<Fisheye Database>"."CRU_REVIEW"."CRU_NAME" (actual: 261, maximum: 255) Database migration failed: java.sql.BatchUpdateException: ORA-12899: value too large for column "FISHEYE"."CRU_REVIEW"."CRU_NAME" (actual: 261, maximum: 255)
The embedded HSQLDB does not enforce any column length, which can cause a problem when migrating to an external database with such constraints in place. In this case, the CRU_NAME column in the CRU_REVIEW table has exceeded the limit of 255 characters. It has 261 characters in one of the records.
Ensure you have a complete backup of your Fisheye isntance prior to running the following query directly on your database.
Create a file called
fixupdb.sql with the following content:
update cru_review set cru_name = left(cru_name, 255) where length(cru_name) > 255 ;
This will truncate all such reviews with column length larger than 255.
To apply the patch, follow these steps:
- Backup Fisheye
- Shut down Fisheye
- Run the fixupdb.sql on the internal database by using the following command:
java -Xms1024m -Xmx1024m -jar <FishEye installation directory>/lib/hsqldb-22.214.171.124.jar --inlineRC "URL=jdbc:hsqldb:file:<FISHEYE_HOME>/var/data/crudb/crucible;shutdown=true,USER=sa,PASSWORD=" <path_to_file>/fixupdb.sql
- After that, if the script succeeds, you should be able to start Fisheye again and retrigger the migration.