数据泵IMPDP导入工具的使用_第1页
数据泵IMPDP导入工具的使用_第2页
数据泵IMPDP导入工具的使用_第3页
数据泵IMPDP导入工具的使用_第4页
数据泵IMPDP导入工具的使用_第5页
已阅读5页,还剩1页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、  数据泵IMPDP 导入工具的使用 收藏 -=-数据泵IMPDP 导入工具的使用-=        数据的导入导出时数据库经常处理的作业之一,Oracle 提供了IMP和IMPDP以及SQL*Loader等工具来完成数据的导入工作,其中IMP服务于早期的9i之前的版本,在10g及后续版本,Oracle 提供了数据泵高速导入工具,本文主要介绍IMPDP的使用方法,关于高速导出工具请参照:数据泵EXPDP 导出工具的使用。SQL*Loader请参照:SQL*Loader使用方法。 一、数据泵的体系结构 &#

2、160;  数据泵的体系结构在数据泵EXPDP 导出工具的使用已列出,再此不再赘述。 二、IMPDP支持的接口及导入模式    导入接口        使用命令行带参数的        使用命令行带参数文件        使用命令行交互        使用databas

3、e console(GUI)    几种常用的导入模式        导入表        导入方案        导入表空间        导入数据库        传输表空间模式   &

4、#160;                    三、演示如何导入    1.关于查看impdp的帮助,使用以下命令        oracleoradb $ impdp -?  或oracleoradb $ impdp -help  前者提供帮助信息并开启命令行交互模式  &#

5、160;     2. 导入表        -将表dept,emp导入到scott方案中        impdp scott/tiger directory=dump_scott dumpfile=tab.dmp tables=dept,emp         -将表dept和emp从scott方案导入到system方案中,对于方案的转移,必须

6、使用remap_shcema参数        impdp system/manage directory=dump_scott dumpfile=tab.dmp tables=scott.dept,scott.emp remap_schema=scott:system     3.导入方案        -将dump_scott目录下的schema.dmp导入到scott方案中   &

7、#160;    impdp scott/tiger directory=dump_scott dumpfile=schema.dmp schemas=scott                -将scott方案中的所有对象转移到system方案中        impdp system/redhat directory=dump_scott dumpfil

8、e=schema.dmp schemas=scott remap_schema=scott:system     4.导入表空间        impdp system/redhat directory=dump_scott dumpfile=tablespace.dmp tablespaces=user01            5.导入数据库   

9、60;    impdp system/redhat directory=dump_scott dumpfile=full.dmp full=y                   6.将数据对象原样导回(演示从Windows客户端来实现,数据库基于Linux系统)        从Windows客户端来导出scott.emp表,导出后删除该表,再

10、原样导回        C:>expdp scott/tigerlist2 directory=dump_scott dumpfile=emp.dmp tables=emp                C:>sqlplus scott/tigerlist2         SQL*Plus: R

11、elease 10.2.0.1.0 - Production on 星期一9月20 20:50:35 2010         Copyright (c) 1982, 2005, Oracle.  All rights reserved.         Connected to:        Oracle Database 10g Enterprise

12、Edition Release 10.2.0.1.0 - Production        With the Partitioning, OLAP and Data Mining options         SQL> drop table emp;         Table dropped.     &#

13、160;   SQL> commit;         Commit complete.        SQL> select count(1) from emp;        select count(1) from emp          

14、                   *        ERROR at line 1:        ORA-00942: table or view does not exist        SQL>

15、; host impdp scott/tigerlist2 directory=dump_scott dumpfile=emp.dmp         SQL> select count(1) from emp;          COUNT(1)        -        &

16、#160;       14           7.将导出的对象使用remap_schema参数转移到不同的方案        a.将dept从scott用户导入到system用户下            expdp scott/tiger directory=dum

17、p_scott dumpfile=dept.dmp tables=dept                            方法一:            impdp system/redhat tables=scott.d

18、ept directory=dump_scott dumpfile=dept.dmp remap_schema=scott:system             方法二:            sql>grant imp_full_database to scott;        

19、    impdp scott/tiger directory=dump_scott dumpfile=dept.dmp tables=dept                   remap_schema=scott:system table_exists_action=replace           

20、 b.将scott方案下的所有对象导入到system方案下            expdp scott/tiger directory=dump_scott dumpfile=allobj.dmp schemas=scott            impdp scott/tiger directory=dump_scott dumpfile=allobj.dmp remap_

21、schema=scott:system table_exists_action=replace     8.使用remap_datafile参数转移到不同的数据文件(用于不同平台之间存在不同命名方式时)        下面的示例首先创建了一个参数文件,参数文件名为payroll.par            directory=pump_scott  

22、60;         full=y            dumpfile=datafile.dmp            remap_datafile='db$:hrdata.payrolltbs2.f':'/db/hrdata/payroll/tbs2.f'&#

23、160; -指明重新映射数据文件                impdp scott/tiger PARFILE=payroll.par        9.使用remap_tablespace参数转移到不同的表空间        impdp scott/scott remap_tablespace=users:tbs1 dir

24、ectory=dpump_scott dumpfile=users.dmp             10.并行导入:        expdp e/e directory=dump_e dumpfile=a_%u.dmp schemas=e parallel=3         impdp e/e directory=dump_e dumpfile

25、=a_%u.dmp schemas=e parallel=3 table_exists_action=replace 四、数据泵impdp参数:    1.REMAP_DATAFILE        该选项用于将源数据文件名转变为目标数据文件名,在不同平台之间搬移表空间时需要该选项.        REMAP_DATAFILE=source_datafie:target_datafile  

26、60;  2.REMAP_SCHEMA        该选项用于将源方案的所有对象装载到目标方案中.        REMAP_SCHEMA=source_schema:target_schema     3.REMAP_TABLESPACE        将源表空间的所有对象导入到目标表空间中   

27、0;    REMAP_TABLESPACE=source_tablespace:target:tablespace     4.REUSE_DATAFILES        该选项指定建立表空间时是否覆盖已存在的数据文件.默认为N        REUSE_DATAFIELS=Y | N     5.SKIP_UNUSABLE_INDEXES&#

28、160;       指定导入是是否跳过不可使用的索引,默认为N     6,sqlfile  参数允许创建DDL 脚本文件        impdp scott/tiger directory=dump_scott dumpfile=a1.dmp sqlfile=c.sql         默认放在directory下,因此不要指定绝对路径

29、60;    7.STREAMS_CONFIGURATION        指定是否导入流元数据(Stream Matadata),默认值为Y.     8.TABLE_EXISTS_ACTION        该选项用于指定当表已经存在时导入作业要执行的操作,默认为SKIP        TABBLE_EXISTS_

30、ACTION=SKIP | APPEND | TRUNCATE | FRPLACE          当设置该选项为SKIP时,导入作业会跳过已存在表处理下一个对象;        当设置为APPEND时,会追加数据        当设置为TRUNCATE时,导入作业会截断表,然后为其追加新数据;        当设置

31、为REPLACE时,导入作业会删除已存在表,重建表并追加数据,        注意,TRUNCATE选项不适用与簇表和NETWORK_LINK选项     9.TRANSFORM        该选项用于指定是否修改建立对象的DDL语句        TRANSFORM=transform_name:value:object_type &

32、#160;      transform_name用于指定转换名,其中SEGMENT_ATTRIBUTES用于标识段属性(物理属性,存储属性,表空间,日志等信息),        STORAGE用于标识段存储属性,VALUE用于指定是否包含段属性或段存储属性,object_type用于指定对象类型.         Impdp scott/tiger directory=dump dumpfile

33、=tab.dmp transform=segment_attributes:n:table     10.TRANSPORT_DATAFILES        该选项用于指定搬移空间时要被导入到目标数据库的数据文件        TRANSPORT_DATAFILE=datafile_name        Datafile_name用于指定被复制到目标数据库的数据文件        Impdp system/manager DIRECTORY=dump DUMPFILE=tts.dmp        TRANSPORT_DATAFILES=/user01/data/tbs1.f 五、影响数据泵性能的相关参数   

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论