I'm porting a MySQL database and I want to move to an Oracle DB 12cRC2. The catch is some of my table's name are more than 30 characters long.
Everything works fine (after messing a bit with my schema.rb file).
I'm using the "Globalize" gem to localize my DB.
When I run my seed I got an error on my translation tables like:
OCIError: ORA-04043: object "aaaaaaaa_bbbbb_cccc_translations" does not exist
But when I sqlplus, I can see my table no problem... either with a DESC or SELECT query.
I use oracle-instantclient12.2 to connect.
I suspect the table name length since other tables with smaller name does'nt raise execption
My Stack:
rails aborted!
ActiveRecord::ConnectionAdapters::OracleEnhanced::ConnectionException: "DESC aaaaaaaa_bbbbb_cccc_translations" failed; does it exist?
/usr/local/bundle/gems/activerecord-oracle_enhanced-adapter-5.2.5/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb:209:in `rescue in describe'
/usr/local/bundle/gems/activerecord-oracle_enhanced-adapter-5.2.5/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb:202:in `describe'
/usr/local/bundle/gems/activerecord-oracle_enhanced-adapter-5.2.5/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:552:in `pk_and_sequence_for'
/usr/local/bundle/gems/activerecord-oracle_enhanced-adapter-5.2.5/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:585:in `primary_key'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/schema_cache.rb:43:in `primary_keys'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/attribute_methods/primary_key.rb:100:in `get_primary_key'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/attribute_methods/primary_key.rb:87:in `reset_primary_key'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/attribute_methods/primary_key.rb:75:in `primary_key'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/associations/foreign_association.rb:6:in `foreign_key_present?'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/associations/association.rb:203:in `find_target?'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/associations/collection_association.rb:272:in `load_target'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/associations/collection_proxy.rb:46:in `load_target'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/associations/collection_proxy.rb:1032:in `records'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/relation/delegation.rb:71:in `each'
/usr/local/bundle/gems/globalize-5.2.0/lib/globalize/active_record/instance_methods.rb:130:in `detect'
/usr/local/bundle/gems/globalize-5.2.0/lib/globalize/active_record/instance_methods.rb:130:in `translation_for'
/usr/local/bundle/gems/globalize-5.2.0/lib/globalize/active_record/instance_methods.rb:124:in `translation'
/usr/local/bundle/gems/globalize-5.2.0/lib/globalize/active_record/instance_methods.rb:162:in `save'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/persistence.rb:36:in `create'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/relation.rb:85:in `block in create'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/relation.rb:281:in `scoping'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/relation.rb:85:in `create'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/relation.rb:164:in `find_or_create_by'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/querying.rb:8:in `find_or_create_by'
/beecom/lib/tasks/aaaaaaaa_bbbbb_cccc.rake:10:in `block (3 levels) in <top (required)>'
/beecom/lib/tasks/aaaaaaaa_bbbbb_cccc.rake:9:in `each'
/beecom/lib/tasks/aaaaaaaa_bbbbb_cccc.rake:9:in `block (2 levels) in <top (required)>'
/beecom/db/seeds.rb:209:in `<top (required)>'
/usr/local/bundle/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `load'
/usr/local/bundle/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `block in load'
/usr/local/bundle/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
/usr/local/bundle/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `load'
/usr/local/bundle/gems/railties-5.2.2/lib/rails/engine.rb:551:in `load_seed'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/tasks/database_tasks.rb:281:in `load_seed'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/railties/databases.rake:194:in `block (2 levels) in <top (required)>'
/usr/local/bundle/gems/railties-5.2.2/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/usr/local/bundle/gems/railties-5.2.2/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/usr/local/bundle/gems/railties-5.2.2/lib/rails/command.rb:48:in `invoke'
/usr/local/bundle/gems/railties-5.2.2/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Caused by:
OCIError: ORA-04043: object "aaaaaaaa_bbbbb_cccc_translations" does not exist
metadata.c:175:in oci8lib_260.so
/usr/local/bundle/gems/ruby-oci8-2.2.7/lib/oci8/metadata.rb:2061:in `block in describe_table'
/usr/local/bundle/gems/ruby-oci8-2.2.7/lib/oci8/metadata.rb:2060:in `times'
/usr/local/bundle/gems/ruby-oci8-2.2.7/lib/oci8/metadata.rb:2060:in `describe_table'
/usr/local/bundle/gems/activerecord-oracle_enhanced-adapter-5.2.5/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb:350:in `describe'
/usr/local/bundle/gems/activerecord-oracle_enhanced-adapter-5.2.5/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb:206:in `describe'
/usr/local/bundle/gems/activerecord-oracle_enhanced-adapter-5.2.5/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:552:in `pk_and_sequence_for'
/usr/local/bundle/gems/activerecord-oracle_enhanced-adapter-5.2.5/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:585:in `primary_key'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/schema_cache.rb:43:in `primary_keys'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/attribute_methods/primary_key.rb:100:in `get_primary_key'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/attribute_methods/primary_key.rb:87:in `reset_primary_key'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/attribute_methods/primary_key.rb:75:in `primary_key'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/associations/foreign_association.rb:6:in `foreign_key_present?'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/associations/association.rb:203:in `find_target?'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/associations/collection_association.rb:272:in `load_target'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/associations/collection_proxy.rb:46:in `load_target'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/associations/collection_proxy.rb:1032:in `records'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/relation/delegation.rb:71:in `each'
/usr/local/bundle/gems/globalize-5.2.0/lib/globalize/active_record/instance_methods.rb:130:in `detect'
/usr/local/bundle/gems/globalize-5.2.0/lib/globalize/active_record/instance_methods.rb:130:in `translation_for'
/usr/local/bundle/gems/globalize-5.2.0/lib/globalize/active_record/instance_methods.rb:124:in `translation'
/usr/local/bundle/gems/globalize-5.2.0/lib/globalize/active_record/instance_methods.rb:162:in `save'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/persistence.rb:36:in `create'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/relation.rb:85:in `block in create'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/relation.rb:281:in `scoping'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/relation.rb:85:in `create'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/relation.rb:164:in `find_or_create_by'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/querying.rb:8:in `find_or_create_by'
/beecom/lib/tasks/aaaaaaaa_bbbbb_cccc.rake:10:in `block (3 levels) in <top (required)>'
/beecom/lib/tasks/aaaaaaaa_bbbbb_cccc.rake:9:in `each'
/beecom/lib/tasks/aaaaaaaa_bbbbb_cccc.rake:9:in `block (2 levels) in <top (required)>'
/beecom/db/seeds.rb:209:in `<top (required)>'
/usr/local/bundle/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `load'
/usr/local/bundle/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `block in load'
/usr/local/bundle/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
/usr/local/bundle/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `load'
/usr/local/bundle/gems/railties-5.2.2/lib/rails/engine.rb:551:in `load_seed'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/tasks/database_tasks.rb:281:in `load_seed'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/railties/databases.rake:194:in `block (2 levels) in <top (required)>'
/usr/local/bundle/gems/railties-5.2.2/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/usr/local/bundle/gems/railties-5.2.2/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/usr/local/bundle/gems/railties-5.2.2/lib/rails/command.rb:48:in `invoke'
/usr/local/bundle/gems/railties-5.2.2/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:seed
Your table name "aaaaaaaa_bbbbb_cccc_translations" has a 32 byte length, the limit has been 30 but in 12cR2 it has been increased to 128. But I guess the client tools you are using to access the database has a problem handling longer names.