Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql Oracle数据泵导入到现有表中_Sql_Oracle_Datapump_Impdp - Fatal编程技术网

Sql Oracle数据泵导入到现有表中

Sql Oracle数据泵导入到现有表中,sql,oracle,datapump,impdp,Sql,Oracle,Datapump,Impdp,我需要一种有效的方法将数据从一个数据库复制到另一个数据库。 两者都基于Oracle 11g 步骤:(重新)创建新表 步骤:安装pl sql包 步骤:使用expdp从数据库1导出表tab_old1和tab_old2 步骤:使用impdp导入tab_new1和tab_new2数据库2 +x步骤:使用已安装的pl sql过程 挑战: pl sql过程已经使用了tab_new1和tab_new2。因此,我在步骤1和2中创建了两个表。 在步骤3和4中,我只导入和导出数据。 但是tab_new1和tab_n

我需要一种有效的方法将数据从一个数据库复制到另一个数据库。 两者都基于Oracle 11g

  • 步骤:(重新)创建新表
  • 步骤:安装pl sql包
  • 步骤:使用expdp从数据库1导出表tab_old1和tab_old2
  • 步骤:使用impdp导入tab_new1和tab_new2数据库2
  • +x步骤:使用已安装的pl sql过程
  • 挑战: pl sql过程已经使用了tab_new1和tab_new2。因此,我在步骤1和2中创建了两个表。 在步骤3和4中,我只导入和导出数据。 但是tab_new1和tab_new2有额外的列->导入失败。 我试图创建没有新列的视图

    导入失败,并显示以下错误消息:

    ORA-31693: Table data object "Schema"."tab_old1" failed to load/unload and is being skipped due to error:
    ORA-31603: object “tab_old1” of type TABLE not found in schema “Schema” 
    
    ORA-31693: Table data object "Schema"."tab_old2" failed to load/unload and is being skipped due to error:
    ORA-31603: object “tab_old2” of type TABLE not found in schema “Schema” 
    
    这些视图称为tab_old1和tab_old2,但它们当然不是TABLE类型

    有什么想法吗

    如何从包含其他列的现有表中的tab_old1导入数据

    我不想在第一步中导出/导入表,重命名它们,然后安装pl sqls过程

    你能帮我吗

    编辑:

    谢谢你的回答。我尝试了两次您的示例,但remap_table函数对我不起作用。导入:版本11.1.0.6.0-64位生产

    编辑2: 对这似乎是我的oracle版本的一个问题。将忽略“重新映射表”函数。我可以写一些废话,比如remap_table=not.existing/table,impdp对此毫不在乎。
    嗯,我没有时间解决这个问题。我必须努力工作。无论如何,谢谢你的帮助

    好的,那么您仅使用content=data\u导入,并且将tab\u old1重命名为tab\u new1并添加了一些列

    指定导入放置重新映射表时=tab\u old1:tab\u new1

    只要新列可以为空,这就可以工作

    例如:

    所以重新映射

    SQL> host impdp test/test tables=foo remap_table=foo:foo2 directory=data_pump_dir content=data_only
    
    Import: Release 11.2.0.2.0 - Production on Thu Nov 8 15:42:33 2012
    
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Master table "TEST"."SYS_IMPORT_TABLE_02" successfully loaded/unloaded
    Starting "TEST"."SYS_IMPORT_TABLE_02":  test/******** tables=foo remap_table=foo:foo2 directory=data_pump_dir content=data_only 
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    . . imported "TEST"."FOO2"                               5.031 KB       5 rows
    Job "TEST"."SYS_IMPORT_TABLE_02" successfully completed at 15:42:37
    
    
    SQL> select * from foo2;
    
    ID     A
    ---------- ----------
         1
         2
         3
         4
         5
    

    好的,那么您是仅使用content=data\u导入的,并且您已经将tab\u old1重命名为tab\u new1并添加了一些列

    指定导入放置重新映射表时=tab\u old1:tab\u new1

    只要新列可以为空,这就可以工作

    例如:

    所以重新映射

    SQL> host impdp test/test tables=foo remap_table=foo:foo2 directory=data_pump_dir content=data_only
    
    Import: Release 11.2.0.2.0 - Production on Thu Nov 8 15:42:33 2012
    
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Master table "TEST"."SYS_IMPORT_TABLE_02" successfully loaded/unloaded
    Starting "TEST"."SYS_IMPORT_TABLE_02":  test/******** tables=foo remap_table=foo:foo2 directory=data_pump_dir content=data_only 
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    . . imported "TEST"."FOO2"                               5.031 KB       5 rows
    Job "TEST"."SYS_IMPORT_TABLE_02" successfully completed at 15:42:37
    
    
    SQL> select * from foo2;
    
    ID     A
    ---------- ----------
         1
         2
         3
         4
         5
    

    在您的编辑中,您已经输入了foo:foo2,而不是真正的表名等。您是否正确地替换了它们。请把你真正的命令和输出我刚刚创建了一个新的用户和新的表。这些是我真正的命令和输出。参见edit2我想在11.1中可能不可能(我没有11.1实例要测试)。我看到文档在11.1上有:
    只有导入创建的对象将被重新映射。特别是,如果TABLE\u EXISTS\u ACTION设置为TRUNCATE或APPEND,则不会重新映射先前存在的表。
    此注释不在11.2 11.1 11.2中,您在编辑中输入了foo:foo2,而不是实际的表名等。您是否正确地替换了它们。请把你真正的命令和输出我刚刚创建了一个新的用户和新的表。这些是我真正的命令和输出。参见edit2我想在11.1中可能不可能(我没有11.1实例要测试)。我看到文档在11.1上有:
    只有导入创建的对象将被重新映射。特别是,如果TABLE\u EXISTS\u ACTION设置为TRUNCATE或APPEND,则不会重新映射先前存在的表。
    11.2 11.1 11.2中没有此注释
    SQL> host impdp test/test tables=foo remap_table=foo:foo2 directory=data_pump_dir content=data_only
    
    Import: Release 11.2.0.2.0 - Production on Thu Nov 8 15:42:33 2012
    
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Master table "TEST"."SYS_IMPORT_TABLE_02" successfully loaded/unloaded
    Starting "TEST"."SYS_IMPORT_TABLE_02":  test/******** tables=foo remap_table=foo:foo2 directory=data_pump_dir content=data_only 
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    . . imported "TEST"."FOO2"                               5.031 KB       5 rows
    Job "TEST"."SYS_IMPORT_TABLE_02" successfully completed at 15:42:37
    
    
    SQL> select * from foo2;
    
    ID     A
    ---------- ----------
         1
         2
         3
         4
         5