Oracle 数据泵的使用方法

一、新建逻辑目录

最好以system等管理员创建逻辑目录,Oracle不会自动创建实际的物理目录“D:\oracleData”(务必手动创建此目录),仅仅是进行定义逻辑路径dump_dir;

sql> conn system/123456a?@orcl as sysdba;

sql>create directory dump_dir as 'D:\oracleData';

二、查看管理员目录(同时查看操作系统是否存在该目录,因为oracle并不关心该目录是否存在,假如不存在,则出错)

sql>select * from dba_directories;

三、用expdp导出数据

1)导出用户及其对象
expdp scott/tiger@orcl schemas=scott dumpfile=expdp.dmp directory=dump_dir;

2)导出指定表
expdp scott/tiger@orcl tables=emp,dept dumpfile=expdp.dmp directory=dump_dir;

3)按查询条件导
expdp scott/tiger@orcl directory=dump_dir dumpfile=expdp.dmp tables=empquery='where deptno=20';

4)按表空间导
expdp system/manager@orcl directory=dump_dir dumpfile=tablespace.dmptablespaces=temp,example;

5)导整个数据库
expdp system/manager@orcl directory=dump_dir dumpfile=full.dmp full=y;

四、用impdp导入数据

在正式导入数据前,要先确保要导入的用户已存在,如果没有存在,请先用下述命令进行新建用户

--创建表空间
create tablespace tb_name datafile 'D:\tablespace\tb_name.dbf' size 1024m AUTOEXTEND ON;

--创建用户
create user user_name identified by A123456a default tablespace tb_name temporary tablespace TEMP;

--给用户授权

sql>grant read,write on directory dump_dir to user_name;

sql>grant dba,resource,unlimited tablespace to user_name;

1)导入用户(从用户scott导入到用户scott)
impdp scott/tiger@orcl directory=dump_dir dumpfile=expdp.dmp schemas=scott;

2)导入表(从scott用户中把表dept和emp导入到system用户中)
impdp system/manager@orcl directory=dump_dir dumpfile=expdp.dmptables=scott.dept,scott.emp remap_schema=scott:system;

3)导入表空间
impdp system/manager@orcl directory=dump_dir dumpfile=tablespace.dmp tablespaces=example;

4)导入数据库
impdb system/manager@orcl directory=dump_dir dumpfile=full.dmp full=y;

5)追加数据
impdp system/manager@orcl directory=dump_dir dumpfile=expdp.dmp schemas=systemtable_exists_action

最新文章

  1. Linux中修改环境变量导致大量命令不可用的解决办法
  2. 【NOIP 2004】虫食算
  3. Apache常用2种工作模式prefork和worker比较
  4. UR fall detection dataset
  5. saltstack之(十二)配置管理mount
  6. Android中Toast的用法简介
  7. Kinetic使用注意点--blob
  8. [Codeforces Round #296 div2 D] Clique Problem 【线段树+DP】
  9. SQL Server审计功能入门:更改跟踪(Change Tracking)
  10. angular学习笔记04 理论加实践
  11. HDU 2084 数塔(简单DP入门)
  12. cocos-lua3.17 Lua tablrView工具类
  13. python 更换 版本
  14. 【托业】【新托业TOEIC新题型真题】学习笔记4-题库一->P7
  15. centos7下swoole1.9的安装与HttpServer的使用
  16. 使用appledoc 生成技术API文档具体解释
  17. HBase基于region数目和data locality来balance regions
  18. Team Foundation Server (TFS) 2017 团队资源管理器
  19. python使用元类
  20. [android ndk] -android studio中编译生成so文件

热门文章

  1. 四博智慧物联系统入门示例-1.增加一个DHT11温湿度传感器
  2. 代码优化与sql优化---未完待续
  3. 实型(浮点型):float、double
  4. java面试的一些问题
  5. 如何将返回的JSon字符串用MAP格式读取
  6. Centos7修改用户名
  7. python基础 Day8
  8. mysql索引类型:FULLTEXT、NORMAL、SPATIAL、UNIQUE的区别
  9. 个人项目wc
  10. js apply() call() bind() 的使用