数据泵导出导入工具的使用
2012-10-08 11:50
316 查看
一.导出工具expdp 示例
a.创建目录
create directory dump_dir as 'D:\dump';
b.赋予用户scott对目录dump_dir的读写权限
grant
read,writeon directory dump_dir
to scott;
c.1.导出表
expdp
scott/tiger@demo directory = dump_dir dumpfile = tab.dmp logfile = tab.log tables = emp,dept
2.导出方案
expdp
scott/tiger@demo directory = dump_dir dumpfile = scott.dmp logfile = scott.log schemas = scott
3.导出表空间
expdp
scott/tiger@demo directory = dump_dir dumpfile = tablespace.dmp logfile = tablespace.log tablespaces=user01,user02
导出数据库
expdp
scott/tiger@demo directory = dump_dir dumpfile = full.dmp logfile = full.log full=y
二.导入工具impdp示例
1.导入表
同一用户导入
impdp
scott/tiger@demo directory = dump_dir dumpfile = tab.dmp tables = emp,dept
不同用户导入
impdp system/manager@demo directory = dump_dir dumpfile = tab.dmp tables = emp,dept remap_schema
= scott:system
2. 导入方案
impdp scott/tiger@demo directory = dump_dir dumpfile = scott.dmp schemas = scott
impdp system/manager@demo directory = dump_dir dumpfile = scott.dmp schemas = scott remap_schema = scott:system
3.导入表空间
impdp scott/tiger@demo directory = dump_dir dumpfile = tablespace.dmp tablespaces = user01
导入数据库
impdp
scott/tiger@demo directory = dump_dir dumpfile = full.dmp full = y
三.expdp常用参数
1.content:该选项用于指定要导出的内容.默认值为ALL
CONTENT={ALL| DATA_ONLY
| METADATA_ONLY}
expdp scott/tiger schemas=scottcontent=all
expdp scott/tiger tables=empcontent=data_only directory=dump_scott dumpfile=empdata.dmp(只导出对象数据)
expdp scott/tiger tables=empcontent=metadata_only directory=dump_scott dumpfile=empmd.dmp(只有定义信息)
2.estimate: 指定估算被导出表所占用磁盘空间分方法.默认值是blocks
expdp scott/tiger directory=dump_scott dumpfile=dba_object.dmp tablespaces=users
estimate=statistics
expdp scott/tiger directory=dump_scott dumpfile=dba_object.dmp tablespaces=users
estimate=blocks
3.extimate_only:指定是否只估算导出作业所占用的磁盘空间,默认值为N
expdp scott/tiger schemas=scott estimate_only=y
设置为Y时,导出作用只估算对象所占用的磁盘空间,而不会执行导出作业,
为N时,不仅估算对象所占用的磁盘空间,还会执行导出操作.
4.exclude:该选项用于指定执行操作时释放要排除对象类型或相关对象
exclude=view
exclude=package
exclude=index:"like 'EMP%'
object_type用于指定要排除的对象类型,name_expr用于指定要排除的具体对象.exclude和include不能同时使用
expdp scott/tiger schemas=scott exclude=view dumpfile=a9.dmp
include = object_type[:"name_expr"]
5.filesize:指定导出文件的最大尺寸,默认为,(表示文件尺寸没有限制)
6.flashback_scn: 前提闪回功能开启
expdp scott/tiger tables=emp dumpfile=e2.dmp flashback_scn=4284715
如果闪回的时间点该对象结构发生变化,将报错(比如该对象没有创建或者ddl操作)
7.flashback_time:指定导出特定时间点的表数据
expdp scott/tiger DIRECTORY=dump DUMPFILE=a.dmp FLASHBACK_TIME="TO_TIMESTAMP(’-08-2004 14:35:00’,’DD-MM-YYYY
HH24:MI:SS’)"
windows下:
C:/>expdp scott/tiger DIRECTORY=dump_dir DUMPFILE=a.dmp
flashback_time=/"TO_TIMESTAMP('06-04-2010 11:24:26','DD-MM-YYYY HH24:MI:SS')/"
8.query导出查询得到的结果集
query=scott.emp :"where deptno= 30
and sal > 3500"
9.sample 使用该参数进行对导出的数据进行采样
sample="scott"."emp":20
expdp scott/tiger directory=dump_scott dumpfile=sam.dmp sample=30
10.dumpfile 指定导出时的文件名
dumpfile=scott_tb.dmp
dumpfile=scott_tb_%u.dmp %u 用于扩展导出的文件名,固定长度为个字符,从开始递增,使用并行导出时建议指定该参数
a.创建目录
create directory dump_dir as 'D:\dump';
b.赋予用户scott对目录dump_dir的读写权限
grant
read,writeon directory dump_dir
to scott;
c.1.导出表
expdp
scott/tiger@demo directory = dump_dir dumpfile = tab.dmp logfile = tab.log tables = emp,dept
2.导出方案
expdp
scott/tiger@demo directory = dump_dir dumpfile = scott.dmp logfile = scott.log schemas = scott
3.导出表空间
expdp
scott/tiger@demo directory = dump_dir dumpfile = tablespace.dmp logfile = tablespace.log tablespaces=user01,user02
导出数据库
expdp
scott/tiger@demo directory = dump_dir dumpfile = full.dmp logfile = full.log full=y
二.导入工具impdp示例
1.导入表
同一用户导入
impdp
scott/tiger@demo directory = dump_dir dumpfile = tab.dmp tables = emp,dept
不同用户导入
impdp system/manager@demo directory = dump_dir dumpfile = tab.dmp tables = emp,dept remap_schema
= scott:system
2. 导入方案
impdp scott/tiger@demo directory = dump_dir dumpfile = scott.dmp schemas = scott
impdp system/manager@demo directory = dump_dir dumpfile = scott.dmp schemas = scott remap_schema = scott:system
3.导入表空间
impdp scott/tiger@demo directory = dump_dir dumpfile = tablespace.dmp tablespaces = user01
导入数据库
impdp
scott/tiger@demo directory = dump_dir dumpfile = full.dmp full = y
三.expdp常用参数
1.content:该选项用于指定要导出的内容.默认值为ALL
CONTENT={ALL| DATA_ONLY
| METADATA_ONLY}
expdp scott/tiger schemas=scottcontent=all
expdp scott/tiger tables=empcontent=data_only directory=dump_scott dumpfile=empdata.dmp(只导出对象数据)
expdp scott/tiger tables=empcontent=metadata_only directory=dump_scott dumpfile=empmd.dmp(只有定义信息)
2.estimate: 指定估算被导出表所占用磁盘空间分方法.默认值是blocks
expdp scott/tiger directory=dump_scott dumpfile=dba_object.dmp tablespaces=users
estimate=statistics
expdp scott/tiger directory=dump_scott dumpfile=dba_object.dmp tablespaces=users
estimate=blocks
3.extimate_only:指定是否只估算导出作业所占用的磁盘空间,默认值为N
expdp scott/tiger schemas=scott estimate_only=y
设置为Y时,导出作用只估算对象所占用的磁盘空间,而不会执行导出作业,
为N时,不仅估算对象所占用的磁盘空间,还会执行导出操作.
4.exclude:该选项用于指定执行操作时释放要排除对象类型或相关对象
exclude=view
exclude=package
exclude=index:"like 'EMP%'
object_type用于指定要排除的对象类型,name_expr用于指定要排除的具体对象.exclude和include不能同时使用
expdp scott/tiger schemas=scott exclude=view dumpfile=a9.dmp
include = object_type[:"name_expr"]
5.filesize:指定导出文件的最大尺寸,默认为,(表示文件尺寸没有限制)
6.flashback_scn: 前提闪回功能开启
expdp scott/tiger tables=emp dumpfile=e2.dmp flashback_scn=4284715
如果闪回的时间点该对象结构发生变化,将报错(比如该对象没有创建或者ddl操作)
7.flashback_time:指定导出特定时间点的表数据
expdp scott/tiger DIRECTORY=dump DUMPFILE=a.dmp FLASHBACK_TIME="TO_TIMESTAMP(’-08-2004 14:35:00’,’DD-MM-YYYY
HH24:MI:SS’)"
windows下:
C:/>expdp scott/tiger DIRECTORY=dump_dir DUMPFILE=a.dmp
flashback_time=/"TO_TIMESTAMP('06-04-2010 11:24:26','DD-MM-YYYY HH24:MI:SS')/"
8.query导出查询得到的结果集
query=scott.emp :"where deptno= 30
and sal > 3500"
9.sample 使用该参数进行对导出的数据进行采样
sample="scott"."emp":20
expdp scott/tiger directory=dump_scott dumpfile=sam.dmp sample=30
10.dumpfile 指定导出时的文件名
dumpfile=scott_tb.dmp
dumpfile=scott_tb_%u.dmp %u 用于扩展导出的文件名,固定长度为个字符,从开始递增,使用并行导出时建议指定该参数
相关文章推荐
- BCP 大容量数据导入导出工具使用步骤
- 使用bcp工具导入和导出批量数据
- Mongodb数据导出工具mongoexport和导入工具mongoimport使用
- 在pl/sql中使用exp/imp工具实现oracle数据导出/导入
- 在pl/sql中使用exp/imp工具实现oracle数据导出/导入
- SQL server 数据导入导出BCP工具使用详解
- Oracle Imp and Exp (导入和导出) 数据 工具使用
- SQL server 数据导入导出BCP工具使用详解
- SQL Server -- 数据导入导出BCP工具使用详解
- ORACLE数据导出与导入专题(3)——使用exp/imp工具进行数据导入导出
- SQL Server数据导入导出工具BCP使用详解
- 在pl/sql中使用exp/imp工具实现oracle数据导出/导入
- SQL server 数据导入导出BCP工具使用详解
- redis-dump-load数据导出导入备份工具使用介绍
- 在pl/sql中使用exp/imp工具实现oracle数据导出/导入
- 使用sqoop工具进行数据导入导出 sqoop并行导入
- 在plsql中使用exp imp工具实现oracle数据导出导入(转)
- 在命令行中使用exp/imp工具实现oracle数据导出/导入
- 在命令行中使用exp/imp工具实现oracle数据导出/导入
- Oracle Imp and Exp (导入和导出) 数据 工具使用