oracle expdp impdp 数据泵方式

一、不管导入还有导出都要先创建目录

  1、登录plsql  

  sqlplus/nolog
  conn sys/dbwork@orcl  

  2、创建目录

  create directory my_dir as 'd:\yth';--生成目录(必须在指定位置先创建文件夹,名称最好与用户名一致)

  yth:是目录名。必须手工创建。

  2、增加权限

    赋予目录读写权限  Grant read,write on directory my_dir to yth;

  yth:导入、导出的用户名

二、导出:           
            exit,退出plsql。然后操作如下

            expdp yth/dcjet@orcl schemas=yth dumpfile=yth.dmp DIRECTORY=my_dir logfile=expdp.log



三、导入:

1、

   impdp zjgl/dcjet@orcl directory=myDir dumpfile=zjgl.dmp schemas=zjgl logfile=zjgl.log;

2、
            impdp yth/dcjet@orcl  directory=my_dir dumpfile=yth.dmp logfile=a.log remap_schema=jzfw_data:yth  remap_tablespace=jzfw_data:yth,users:yth,jcfz:yth
            ---remap_schema:旧用户:目标用户
            ---remap_tablespace:旧表空间:新表空间(多个的情况用逗号分隔)

下面是成功的例子(my_dir),有时本地只有一个用例不用给@orcl:
    

     impdp zjgl/dcjet@orcl directory=myDir dumpfile=zjgl.dmp schemas=zjgl logfile=zjgl.log;

        impdp yth/dcjet directory=my_dir dumpfile=ENTRY.DMP tables=data_ct.entry_head remap_schema=data_ct:yth remap_tablespace=data_center:yth

    ---tables  指定表名:原表用户.用表名

 

四、更多导出数据

1)按用户导

expdp scott/tiger@orcl schemas=scott dumpfile=expdp.dmp DIRECTORY=dir logfile=expdp.log

2)并行进程parallel

expdp scott/tiger@orcl directory=dir dumpfile=scott3.dmp parallel=40 job_name=scott3

3)按表名导

expdp scott/tiger@orcl TABLES=emp,dept dumpfile=expdp.dmp DIRECTORY=dir;

4)按查询条件导

expdp scott/tiger@orcl directory=dir dumpfile=expdp.dmp Tables=emp query='WHERE deptno=20';

5)按表空间导

expdp system/manager DIRECTORY=dir DUMPFILE=tablespace.dmp TABLESPACES=temp,example;

6)导整个数据库

expdp system/manager DIRECTORY=dir DUMPFILE=full.dmp FULL=y;
五、更多导入数据

1)导到指定用户下

impdp scott/tiger@orcl DIRECTORY=dir DUMPFILE=expdp.dmp SCHEMAS=scott logfile=impdp.log

2)改变表的owner

impdp system/manager DIRECTORY=dir DUMPFILE=expdp.dmp TABLES=scott.dept REMAP_SCHEMA=scott:system;

3)导入表空间

impdp system/manager DIRECTORY=dir DUMPFILE=tablespace.dmp TABLESPACES=example;

4)导入数据库

impdb system/manager DIRECTORY=dump_dir DUMPFILE=full.dmp FULL=y;

5)追加数据

impdp system/manager DIRECTORY=dir DUMPFILE=expdp.dmp SCHEMAS=system TABLE_EXISTS_ACTION

转载于:https://www.cnblogs.com/xbding/p/6053754.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值