出错原因: 往b用户imp表时,要创建type,使用的OID和用户a的一样,同一个实例的OID不能重复。 解决办法: 在system用户下定义 type MAIN_SZ_ZGY_TYPE,授权 grant all on MAIN_SZ_ZGY_TYPE to public; 用户a建表用system.MAIN_SZ_ZGY_TYPE 类型,这样导出用户表时就不会到type了,在用户b中就不会建type。 详细内容如下: Introduction: ============= If you are importing using the FROMUSER/TOUSER clause to duplicate a schema within an instance, you may experience the following errors:   imp system/manager fromuser=a touser=b file=demo.dmp log=import.log   IMP-00017: following statement failed with ORACLE error 2304:   IMP-00003: ORACLE error 2304 encountered   ORA-02304: invalid object identifier literal   IMP-00063: Warning: Skipping table "x"."x" because object                type "x"."x" cannot be created or has different identifier These errors will occur if the schema has a user defined object type(s) (CREATE TYPE) and a relational table column of a user defined datatype. The IMP-00017 error is of particular interest since it indicates te source of the error:   IMP-00017: following statement failed with ORACLE error 2304:   "CREATE TYPE "xxxx" TIMESTAMP '1999-01-01:12:00:00' OID '####' as object ..." In brief, if the FROMUSER's object types already exist on the target instance, errors occur because the object identifiers (OIDs) of the TOUSER's object types already exist. Within a single database instance, object identifiers (OIDs) must be unique. As a result, the error causes Import will skip the creation of relational tables with columns of the pre-existing user defined type. So what are the options available to us for completing this import? Possible Solution Scenarios: ============================ A.) Use the IGNORE=Y clause on the import     This WILL NOT succeed since CREATE TYPE errors are only ignored if     importing into the originating schema, not into a separate "to"     schema! B.) Pre-create the relational table in the TOUSER's schema     This WILL NOT succeed since the CREATE TYPE statement is present in     the export file. C.) Drop the TABLE and TYPE in the FROMUSER schema prior to performing     the import.     This WILL succeed. Note that we cannot simply drop     the type since this will result in an ORA-02303 error as follows:     ORA-02303: cannot drop or replace a type with type or table dependents     We must first drop all tables containing the target TYPE, then the TYPE     itself as follows:     SQL> drop table mytypetable;     SQL> drop table mytypetable2;     SQL> drop type mytype;      D.) From import.log note down the object id (OID) for the erroring type.     I.e., the OID '####' of the error.       Then run the following statement as dba:     SQL> select OWNER, TYPE_NAME from dba_types where TYPE_OID='####';     This statement would give you the owner and the typename for this OID.     If not needed, drop this type as below:     SQL>drop type XXX;     Run the import again. E.) Perform a cascading drop of the FROMUSER prior to performing the import.     This WILL succeed since it is essentially the same as option C, only     far less selective. The syntax is quite simple:     SQL> drop user myfromuser cascade; F.) Recreate the TYPE in an independent schema, grant all on the TYPE to PUBLIC,     create a copy of the TABLE in the FROMUSER schema using this public TYPE,     copy all the old TABLE into the new TABLE using PL/SQL, and redo the     export. Subsequently, perform the TOUSER import.     This WILL succeed since the owner of the TYPE is not involved in the     export or import operations. As such, the CREATE TYPE statement is     not issued as a part of the import operation.     The trick part of this option is recreating the object in question using     the public TYPE. This can accomplished by following this guide:     -- create the public type     SQL> connect system/manager@local     SQL> create or replace type mytype as object (m1 number, m2 varchar2(20));     SQL> grant all on mytype to public;     -- rename the user-type table     SQL> connect myuser/mypassword@local     SQL> rename mytypetable to mytypetemp;     -- create the new public-type table to be corrected     SQL> create table mytypetable (id number primary key, person system.mytype);     -- copy the data from the user-type table to the public-type table     SQL> declare            v_col1  number;            v_col2  mytype;            cursor c1 is              select * from mytypetemp;          begin            open c1;            loop              fetch c1 into v_col1, v_col2;              exit when c1%notfound;              insert into mytypetable                values (v_col1, system.mytype(v_col2.m1, v_col2.m2));              commit;            end loop;            close c1;          end;          /     -- drop the user-type and user-type table     SQL> drop table mytypetable;     SQL> drop type mytype;      Summmary: ========= In summary, if FROMUSER/TOUSER import is used to duplicate a schema in an instance then object types should be isolated in a schema designated only for object types. This is a design and maintenance issue that requires serious consideration.  IGNORE=Y only ignores CREATE TYPE import errors if the import schema is the export schema.   Note: A table level export/import works exactly the same as a schema level in       regards to object types since the object type is a component of the table       scope.

oracle中怎么导外表,ORACLE 自定义类型该如何导入????相关推荐

  1. 【DB笔试面试612】在Oracle中,查询转换包含哪些类型?

    ♣题目 部分 在Oracle中,查询转换包含哪些类型? ♣答案部分 在Oracle数据库中,用户发给Oracle让其执行的目标SQL和Oracle实际执行的SQL有可能是不同的,这是因为Oracle可 ...

  2. oracle中的guid,在Oracle中使用Guid

    在Oracle中使用Guid 在Oracle中使用Guid 在Oracle中可以用SYS_GUID()来生成一个guid,相当于msSql中的newid(). 在Oracle9i和Oracle 10g ...

  3. oracle数据库insert into,oracle中insert into用法 oracle中insert如何带条件添加数据?

    oracle insert into 脚本怎么写 INSE INTO BOOK(bookid,name,price) VALUES('100123','oracle ',54); 或者 INSE IN ...

  4. oracle中的几大对象,oracle 4个大对象(lobs)类型介绍

    oracle 4个大对象(lobs)类型介绍 在oracle中,有4个大对象(lobs)类型可用,分别是blob,clob,bfile,nclob. 下面是对lob数据类型的简单介绍. blob:二进 ...

  5. oracle中如何加字母,Oracle数据库之oracle数据库表插入数据的时候如何产生一个字母+数字...

    本文主要向大家介绍了Oracle数据库之oracle数据库表插入数据的时候如何产生一个字母+数字,通过具体的内容向大家展现,希望对大家学习Oracle数据库有所帮助. Oracle 语句中" ...

  6. oracle中exist什么意思,oracle中not exists 是什么意思 , oracle数据库中exists的作用

    导航:网站首页 > oracle中not exists 是什么意思 , oracle数据库中exists的作用 oracle中not exists 是什么意思 , oracle数据库中exist ...

  7. oracle通过dblink导表,oracle dblink用法总结和expdp和impdp利用dblink倒入导出到本地

    oracle中的database link是定义一个数据库到另一个数据库的路径的对象,database link允许你查询远程表和执行远程程序.在任何分布式环境里,dblink都是必要的,另外注意da ...

  8. oracle中的循环函数,Oracle日期函数和循环总结

    一,日期相关的函数 Select to_char(sysdate,'Q') from dual;--指定日期的季度 Select to_char(sysdate,'MM') from dual;--月 ...

  9. oracle中asm磁盘不足,Oracle用户无法访问ASM磁盘组问题

    1. 权限问题引起找不到ASM磁盘组 1.1 确认操作系统用户属主 # 确认属主 Grid Infrastructure Home Owner : grid Primary Group : oinst ...

最新文章

  1. c++ standard library_什么是C/C++的标准库?
  2. python post请求_python发送http的post请求
  3. 最后8小时 | 最新智能驾驶视觉技术行业研究报告出炉!圈内从业者、投资人不可错过...
  4. VTK:PolyData之RemoveOutsideSurface
  5. 性能提升2.58倍!阿里最快KV存储引擎揭秘
  6. c语言函数fread的调用形式,C语言的问题,fread和fgets的区别是什么?
  7. python日志模块备份_Python Logging模块 输出日志颜色、过期清理和日志滚动备份
  8. 2015总结及2016计划
  9. 2.4_double-ended_queue_双向队列
  10. 深度学习自学(十二):关键点数据集处理-300VW
  11. 使用阿里云邮件推送服务架设自己邮件验证与推送体系
  12. java二手书交易系统_基于Java的二手图书交易系统后台设计与实现.doc
  13. HTML 盒子模型( box-sizing: border-box)
  14. 怎么将CAD图纸转化为PDF格式呢?教你两个妙招搞定!
  15. Unity Android 真机调试 + 夜神模拟器调试 + ADB Logcat
  16. 1-11摇号机java_11选5在线模拟摇号
  17. “攻城狮” 需要了解的密码知识
  18. Locally Differential for Frequency Estimation
  19. 今天win10弹出了flash助手,禁用它
  20. Vue3:自定义指令directive

热门文章

  1. 8G+256G固态笔记本,结合这款IDEA插件,写代码飞起!
  2. Java 支付项目实战教程,包括支付宝,微信等支付方式,不看亏!
  3. Eclipse中写jsp文件时,发现里面加载不了js文件和css文件(解决css文件在eclipse中显示不了)
  4. struts2的OGNL表达式(三)
  5. Java阶段性测试--第二三大题参考代码
  6. 修改linux内核启动动画,Android 开机界面及Linux内核启动界面的修改(tiny6410)
  7. Android利用广播实现ViewPager中item之间的数据通信
  8. Activiti与SpringBoot的整合
  9. 从源码出发:JAVA中对象的比较
  10. 深究AngularJS——校验(非form表单)