exp与expdp的区别

数据泵导出导入与传统导出导入的区别

 

在10g之前,传统的导出和导入分别使用EXP工具和IMP工具,从10g开始,不仅保留了原有的EXP和IMP工具,还提供了数据泵导出导入工具EXPDP和IMPDP.使用EXPDP和IMPDP时应该注意的事项:

1)EXP和IMP是客户端工具程序,它们既可以在可以客户端使用,也可以在服务端使用。

2)EXPDP和IMPDP是服务端的工具程序,他们只能在ORACLE服务端使用, 不能在客户端使用。

3) IMP 只适用于EXP 导出文件, 不适用于EXPDP 导出文件;IMPDP 只适用于EXPDP 导出文件, 而不适用于EXP 导出文件。

 

其中:

数据泵取只能在服务器端运行,客户端只能用来连接服务器启动导入导出操作

即:从192.168.10.201 执行248 导出命令后,导出的数据存储在248 上。也就是201 只是调用了248 的expdp 命令而已;

 

 

Exp 远程导出

如果高版本数据库导出低版本数据库数据会产生

EXP-00008: ORACLE 错误 904 出现

ORA-00904: 无效列名

EXP-00000: 导出终止失败

 

201 导出248 中scott 用户下的dept 

 

配置网络

192.168.1.201

[oracle@localhost admin]$ vim $ORACLE_HOME/network/admin/tnsnames.ora

248 =

     (DESCRIPTION =

         (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.248)(PORT = 1521))

              (CONNECT_DATA =

                  (SERVER = DEDICATED)

                     (SERVICE_NAME = orcl)

             )

       )

[oracle@localhost admin]$ tnsping 248

 

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 23-4月 -2015 09:29:05

 

Copyright (c) 1997, 2005, Oracle.  All rights reserved.

 

已使用的参数文件:

/opt/oracle/product/10.2.0/network/admin/sqlnet.ora

 

已使用 TNSNAMES 适配器来解析别名

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.248)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))

OK (0 毫秒)

 

 

2 远程导出

[oracle@localhost exp]$ exp scott/tiger@248 file=dept.dmp tables=dept

 

Export: Release 10.2.0.1.0 - Production on 星期四 4月 23 09:24:10 2015

 

Copyright (c) 1982, 2005, Oracle.  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

已导出 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集

 

即将导出指定的表通过常规路径...

. . 正在导出表                            DEPT导出了           4 行

成功终止导出, 没有出现警告。

 

[oracle@localhost exp]$ strings dept.dmp >dept.txt

[oracle@localhost exp]$ cat dept.txt

 

 

expdp 远程导出

 

[oracle@localhost chen]$ expdp scott/tiger@248 directory=chen_dir tables=dept du

mpfile=deptaaa.dmp

 

Export: Release 10.2.0.1.0 - Production on 星期四, 23 4月, 2015 11:15:01

 

Copyright (c) 2003, 2005, Oracle.  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

ORA-39002: 操作无效

ORA-39070: 无法打开日志文件。

ORA-39087: 目录名 CHEN_DIR 无效      

 

因为客户端201 配置了目录及权限,但是服务端没有配置目录及权限,客户端只是调用服务端expdp 命令而已

 

192.168.10.248

 

SQL> conn /as sysdba

Connected.

 

SQL> create directory chen_dir as '/home/oracle11/exp';

 

Directory created.

 

SQL> grant read,write on directory chen_dir to scott;

 

Grant succeeded.       

 

192.168.10.201

[oracle@localhost chen]$ expdp scott/tiger@248 directory=chen_dir tables=dept dumpfile=dept201-248.dmp

 

Export: Release 10.2.0.1.0 - Production on 星期四, 23 4月, 2015 12:26:25

 

Copyright (c) 2003, 2005, Oracle.  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

启动 "SCOTT"."SYS_EXPORT_TABLE_01":  scott/********@248 directory=chen_dir tables=dept dumpfile=dept201-248.dmp

正在使用 BLOCKS 方法进行估计...

处理对象类型 TABLE_EXPORT/TABLE/TABLE_DATA

使用 BLOCKS 方法的总估计: 64 KB

处理对象类型 TABLE_EXPORT/TABLE/TABLE

处理对象类型 TABLE_EXPORT/TABLE/INDEX/INDEX

处理对象类型 TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

处理对象类型 TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

处理对象类型 TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

. . 导出了 "SCOTT"."DEPT"                              5.937 KB       4 行

已成功加载/卸载了主表 "SCOTT"."SYS_EXPORT_TABLE_01"

******************************************************************************

SCOTT.SYS_EXPORT_TABLE_01 的转储文件集为:

  /home/oracle11/exp/dept201-248.dmp

作业 "SCOTT"."SYS_EXPORT_TABLE_01" 已于 12:51:39 成功完成

 

 

192.168.10.248

[oracle11@localhost exp]$ ls

dept201-248.dmp  export.log  

转自:http://blog.itpub.net/29785807/viewspace-1593229/

posted on 2021-01-17 20:45  wtsgtc  阅读(1939)  评论(0编辑  收藏  举报

导航