What Do I Do If the Maximum Index Length Has Been Reached During Migration from Oracle to MySQL?
Index Length
- For a column index, the length of each column cannot exceed the value given in Max. Characters of a Column Index in Table 1. For example, in MySQL 5.7.6 that uses the InnoDB storage engine, the length of a column index cannot exceed 767 bytes (Max. Characters of a Column Index = 767 / Max. Bytes).
- For a multiple-column index, the length of each column cannot exceed the value given in Max. Characters of a Column Index in Table 1, and the total length of columns cannot exceed the value given in Max. Characters of a Multiple-Column Index. For example, in MySQL 5.7.6 that uses the InnoDB storage engine, each column index length cannot exceed 767 bytes (Max. Characters of a Column Index = 767 / Max. Bytes), and the total column index length cannot exceed 3072 bytes (Max. Characters of a Column Index = 3072 / Max. Bytes)
Solution
- Method 2
Changes to index length may cause data consistency problems. Exercise caution when performing this operation. For example, if the destination database version is MySQL 5.7.6 or earlier and uses UTF8MB4 character set, run the following command to change the index length:
alter table tablename modify columnname varchar2 (768) ;
Replace tablename with the actual table name and columnname with the actual column name.
- Method 3
Delete the index and its constraints from the source database. For example, if the destination database version is MySQL 5.7.6 or earlier and uses UTF8MB4 character set, run the following commands to delete the index and its constraints:
drop index indexname; alter table tablename drop constraint constraintname;
Replace indexname with the actual index name, tablename with the actual table name, and constraintname with the actual constraint name.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot