网站首页 > 技术文章 正文
概述
继上篇expdp导出,这里主要分享怎么去用impdp命令。
1. 首先需要创建Directory
这里目录名字定义为"jy",
若是windows平台,对应系统目录为"E:\jingyu";
create or replace directory jy as 'E:\jingyu';
若是Unix/Linux平台,对应系统目录为"/tmp/jingyu".
create or replace directory jy as '/tmp/jingyu';
注意:目录在系统上需要真实存在(mkdir -p /tmp/jingyu),且有访问的权限。
2. 创建表空间和用户及赋权
create tablespace users datafile '+data1' size 10M autoextend on maxsize 30G; create user scott identified by tiger default tablespace users; grant connect, resource to scott; grant read, write on directory jy to scott;
3. 使用impdp导入用户数据
初始化环境:
初始1:得到删除当前用户下表的SQL:select 'drop table '||table_name||' purge;' from user_tables;
初始2:得到查询当前用户下表的数据量:select 'select count(1) from '||table_name||';' from user_tables;
3.1 导入scott用户的元数据,且不包含统计信息;
impdp system directory=jy dumpfile=scott_meta.dmp logfile=impdp_scott_meta.log
3.2 导入scott用户的数据;
在3.1导入元数据后才可以导入数据。
impdp system directory=jy dumpfile=scott_data.dmp logfile=impdp_scott_data.log
3.3 只导入scott用户下的emp表及数据;
这里为了演示导入,先初始化删除scott用户下的所有表。
impdp scott directory=jy tables=emp dumpfile=scott_emp_dept.dmp logfile=impdp_scott_emp.log
3.4 只导入scott用户下的emp,dept表结构;
这里为了演示导入,先初始化删除scott用户下的所有表。
impdp scott directory=jy tables=emp,dept dumpfile=scott_emp_dept_meta.dmp logfile=impdp_scott_emp_dept_meta.log
由于导出就是emp,dept两张表,所以也可以不指定tables,以下两种写法在这里都是可以的:
impdp scott directory=jy dumpfile=scott_emp_dept_meta.dmp logfile=impdp_scott_emp_dept_meta.log impdp scott directory=jy dumpfile=scott_emp_dept_meta.dmp logfile=impdp_scott_emp_dept_meta.log full=y
3.5 并行导入scott用户下所有的内容;
impdp system directory=jy schemas=scott table_exists_action=replace dumpfile=scott_all%U.dmp logfile=impdp_scott_all.log parallel=2
这里对于已经存在的对象直接replace掉。
总结
到这里关于expdp和impdp就告一段落啦,在工作中这个还是很实用的,而且会碰到各种奇怪的问题,例如expdp导出时显示乱码、导入时提示用户不存在等等,这种就要靠大家多多尝试了。
后面会分享更多关于DBA内容,感兴趣的朋友可以关注下!!
猜你喜欢
- 2024-10-16 oracle数据库得备份方式 oracle数据库三种备份方式
- 2024-10-16 SmartSQL一款方便快捷的数据库文档查询、导出工具
- 2024-10-16 从零开始学习Oracle之数据备份与还原
- 2024-10-16 Oracle11g中使用expdp导sys用户下的表时报错ORA-39166/ORA-31655
- 2024-10-16 Oracle SQLPlus导出数据到csv文件
- 2024-10-16 Oracle 转换成 MySQL oracle转mysql sql语句
- 2024-10-16 ORACLE 体系 - 14 oracle体系结构思维导图
- 2024-10-16 记一次生产数据库Oracle数据泵导出报ORA-31617错误的解决过程
- 2024-10-16 超级好用的数据库表结构导出工具 数据库导出表结构语句
- 2024-10-16 记Oracle中快速获取表及其各个字段注释的方法
你 发表评论:
欢迎- 06-24发现一款开源宝藏级工作流低代码快速开发平台
- 06-24程序员危险了,这是一个 无代码平台+AI+code做项目的案例
- 06-24一款全新的工作流,低代码快速开发平台
- 06-24如何用好AI,改造自己的设计工作流?
- 06-24濮阳网站开发(濮阳网站建设)
- 06-24AI 如何重塑前端开发,我们该如何适应
- 06-24应届生靠这个Java简历模板拿下了5个offer
- 06-24服务端性能测试实战3-性能测试脚本开发
- 566℃Oracle分析函数之Lag和Lead()使用
- 564℃几个Oracle空值处理函数 oracle处理null值的函数
- 549℃Oracle数据库的单、多行函数 oracle执行多个sql语句
- 545℃0497-如何将Kerberos的CDH6.1从Oracle JDK 1.8迁移至OpenJDK 1.8
- 543℃Oracle 12c PDB迁移(一) oracle迁移到oceanbase
- 536℃【数据统计分析】详解Oracle分组函数之CUBE
- 526℃最佳实践 | 提效 47 倍,制造业生产 Oracle 迁移替换
- 518℃Oracle有哪些常见的函数? oracle中常用的函数
- 最近发表
- 标签列表
-
- 前端设计模式 (75)
- 前端性能优化 (51)
- 前端模板 (66)
- 前端跨域 (52)
- 前端缓存 (63)
- 前端react (48)
- 前端aes加密 (58)
- 前端脚手架 (56)
- 前端md5加密 (54)
- 前端富文本编辑器 (47)
- 前端路由 (61)
- 前端数组 (73)
- 前端js面试题 (50)
- 前端定时器 (59)
- Oracle RAC (73)
- oracle恢复 (76)
- oracle 删除表 (48)
- oracle 用户名 (74)
- oracle 工具 (55)
- oracle 内存 (50)
- oracle 导出表 (57)
- oracle 中文 (51)
- oracle的函数 (57)
- 前端调试 (52)
- 前端登录页面 (48)
本文暂时没有评论,来添加一个吧(●'◡'●)