expdp数据泵导出操作

Oracle数据泵导出导入实战
本文介绍Oracle数据库中使用数据泵进行表级数据导出和导入的操作过程,包括常见错误处理及权限设置。演示了如何指定导出特定表、排除特定表以及在导入过程中重命名表的具体步骤。

数据泵需要在本地执行,不可以远程登录操作。

数据泵需要建立目录directory  --sys下 create directory su as 'd:\xs'

目录的数据字典是dba_directories

SYS@ncbeta>select owner,directory_name,directory_path from  dba_directories;

要求导出scott用户下的emp表

这里两处错误

1,导出命令没有限制emp表而是全部

2,scott用户没有directory SU的访问权

SYS@ncbeta>grant read,write on directory su to scott;

C:\Documents and Settings\dell>expdp scott/tiger directory=su file=scottemp.dmp tables=scott.emp

如果操作要求是导出除去emp的scott表

C:\Documents and Settings\dell>expdp scott/tiger directory=su file=scottnoemp.dmp exclude=table:"IN('EMP')"

 

试一下NC用户的导出操作

有亮点


SYS@ncbeta>grant read,write on directory su to xmv502;

C:\Documents and Settings\dell>expdp xmv502/nc502 directory=su file=xmv5expdp.dmp

 

大小和exp的差不多

 2013-03-04 20:26:00 更新:

原来也可以直接在sql中写,只需要前面加上host

SYS@jsce>host expdp scott/tiger directory=su file=scottemp2.dmp tables=scott.emp

11g新特性,导入的时候重命名表:

SYS@jsce>host impdp scott/tiger directory=su file=scottemp2.dmp remap_table=emp:emp_new

但是有错误提示:

Import: Release 11.2.0.1.0 - Production on 星期一 3月 4 20:30:10 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
;;;
连接到: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
;;; 由于以下参数, 旧有模式处于活动状态:
;;; 旧有模式参数: "file=scottemp2.dmp" 位置: Command Line, 替换为: "dumpfile=scottemp2.dmp"
已成功加载/卸载了主表 "SCOTT"."SYS_IMPORT_FULL_01"
启动 "SCOTT"."SYS_IMPORT_FULL_01": scott/******** directory=su dumpfile=scottemp2.dmp remap_table=emp:emp_new
处理对象类型 TABLE_EXPORT/TABLE/TABLE
处理对象类型 TABLE_EXPORT/TABLE/TABLE_DATA
. . 导入了 "SCOTT"."EMP_NEW" 8.632 KB 16 行
处理对象类型 TABLE_EXPORT/TABLE/INDEX/INDEX
ORA-31684: 对象类型 INDEX:"SCOTT"."PK_EMP" 已存在
处理对象类型 TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
ORA-31684: 对象类型 CONSTRAINT:"SCOTT"."PK_EMP" 已存在
处理对象类型 TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
ORA-39111: 跳过从属对象类型 INDEX_STATISTICS, 基本对象类型 INDEX:"SCOTT"."PK_EMP" 已存在
处理对象类型 TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
ORA-31684: 对象类型 REF_CONSTRAINT:"SCOTT"."FK_DEPTNO" 已存在
处理对象类型 TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
作业 "SCOTT"."SYS_IMPORT_FULL_01" 已经完成, 但是有 4 个错误 (于 20:30:16 完成)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值