最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

oracle19c - Oracle copy command is changing the target table layout - Stack Overflow

programmeradmin3浏览0评论

I am trying to create a generic script which can replicate the oracle source table structure along with data to target db. I am using the below copy command but it is somehow changing the table structure at destination.

Changes line a field from 10 bytes is changing to 40 bytes. How to I make sure this does not happen and as is structure with data gets copied. I am refraining from mentioning each of the columns in the command

copy from USER_XXX/$PASS_YYY@DB_NAMEXXX create $table_name using select * from $table_name where ROWNUM <=100;

I am trying to create a generic script which can replicate the oracle source table structure along with data to target db. I am using the below copy command but it is somehow changing the table structure at destination.

Changes line a field from 10 bytes is changing to 40 bytes. How to I make sure this does not happen and as is structure with data gets copied. I am refraining from mentioning each of the columns in the command

copy from USER_XXX/$PASS_YYY@DB_NAMEXXX create $table_name using select * from $table_name where ROWNUM <=100;

Share Improve this question asked Mar 11 at 12:10 NishantMNishantM 1613 silver badges16 bronze badges 1
  • Why don't you use export/import utilities instead? – Littlefoot Commented Mar 11 at 12:58
Add a comment  | 

1 Answer 1

Reset to default 2

Most likely it is not changing it as you think. If you are seeing 10 become 40, that is very likely the data_length you're looking at (maximum number of bytes required) not the char_length (maximum number of characters allowed) that has changed, and this reflects a move from a single-byte characterset to a multiple-byte characterset such as AL32UTF8 (which can encode up to 4 bytes per char) for varchar2 fields defined using character semantics { varchar2(10 char) vs varchar2(10 byte) }. If you have any foreign characters in your data, the new characterset may require more than 10 bytes to store those 10 characters, so it has no choice but to report a byte maximum of 4x the character length to account for the possibility of every character being a 4-byte character.

I wouldn't worry about it. What matters from a declaratory perspective is the char_length, and that should remain the same. How many bytes Oracle might require internally to store those characters is up to it, not something we should be too concerned with (unless, of course, it overflows the 4KB limit).

发布评论

评论列表(0)

  1. 暂无评论