今天有同事导入数据库时,当create type时候报错,我在原有数据库A(同一数据库下建立多个用户)测试很多遍都出现这个问题。新创建数据B导入没有问题。
查看ora-02304错误原因如下:
- not a string of 32 hexadecimal characters - an object identifier that already identifies an existing object - an object identifier different from the original object identifier already assigned to the typeORA-02304:
invalid object identifier literal Cause: An attempt was made to enter an object identifier literal for CREATE TYPE that is either: Action: Do not specify the object identifier clause or specify a 32 hexadecimal-character object identifier literal that is unique or identical to the originally assigned object identifier. Then retry the operation.
但是我数据库A中建立新用户,不可能出现重复的type数据类型啊,很难解释。在网上找到解决的详细资料,在此发出来做一个备份,并且学习高手分析问题的能力。
本文出处:http://www.cnblogs.com/fangwenyu/archive/2010/07/02/1769667.html 在此非常感谢作者。
在尝试用impdp把一个dump文件从一个schema导入到另外一个schema (两个schema位于同一个数据库上,需要用到remap_schema参数来进行schema的映射转换)遇到了诸多类似如下的错误....
(cmd> impdp test/test directory=dump_dir dumpfile=dump.dmp logfile=dump.log remap_schema=frank:test)
注意到在创建type的时候,“多出来”一段OID的东东,很是奇怪,因为平时在创建一个type的时候,根本就不会涉及到指定OID的问题, 问题八成就是出在这个OID上。那么这个OID到底是什么呢?为什么会导致ORA-02304的错误呢?
OID应该就是Object Identifier, 在数据库中每个object都有自己唯一的标识,也就是object id. 因此把一个Object从一个schema导入到另外一个schema的时候(在同一个数据库上),如果这个OID也保持不变的话,那么就会出现多个Object共享同一个object id的问题,这显然是不行的。因此会出现这个invalid object identifier的问题。
那么如何解决这个问题呢? 通过impdp help=y 可以看到有一个参数来解决这个问题,
看看帮助文档,得到如下信息,
OID - If the value is specified as n, the assignment of the exported OID during the
creation of object tables and types is inhibited. Instead, a new OID is assigned.
This can be useful for cloning schemas, but does not affect referenced objects. The
default value is y.
大意就是说如果TRANSFORM参数设置成OID=N,表示在imp的时候,新创建的表或这个类型会赋予新的OID,而不是dmp文件中包含的OID的值。但是这个参数的默认值是OID=Y,因此在进行Imp的时候,新创建的表或者type会赋予同样的OID,如果是位于同一个数据库上的不同schema,那就会造成OID冲突的问题,因此解决这个问题也很简单,只需要在impdp的时候,显示设置transform. 参数为OID=N既可以了。如下所示,
(cmd> impdp test/test directory=dump_dir dumpfile=dump.dmp logfile=dump.log remap_schema=frank:test transform=OID:N)
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12272958/viewspace-681149/ ,如需转载,请注明出处,否则将追究法律责任。