Unique Constraint Violation Due to Value too Large for Column
症状
The following error appears during a site restore when you are trying to migrate to an Oracle database:
The following error appears in the log file:
Caused by: java.sql.SQLException: ORA-12899: value too large for column "TEST"."LINKS"."DESTPAGETITLE" (actual: 256, maximum: 255)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:219)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:970)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1190)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3370)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3454)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:462)
followed by
org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not insert: [com.atlassian.confluence.pages.Attachment#19858346]; SQL []; ORA-00001: unique constraint (TEST.SYS_C0038932) violated; nested exception is java.sql.SQLException: ORA-00001: unique constraint (TEST.SYS_C0038932) violated
Caused by: java.sql.SQLException: ORA-00001: unique constraint (TEST.SYS_C0038932) violated
原因
A column in your previous database is too long to insert into the oracle database you are migrating to, causing a commitAndRethrow
. It is suspected that this causes the Attachments references to be written to the Attachments
table, causing a PK violation when the actual Attachments are to be inserted.
ソリューション
There is an entry in your existing database that is too long. It may be because of the encoding that is being used in your previous database, which does not match up to the encoding you have set for Oracle.
Once you fix entry so the column length is no longer too long and is unique, so you can get pas the error ORA-12899, you should no longer get the ORA-00001 error. Detailed instructions can be found at Cannot Restore XML Backup due to Value too Large for Column.