Oracle exp的常用工具有哪些


  本文标签:Oracle exp

  以下的文章主要是对Oracle exp篇,数据导出常用工具EXP的介绍,我们大家都知道Oracle EXP是用于客户端的工具,此工具可以用于Oracle客户端与Oracle服务器端  。当在Oracle客户端使用EXP工具时,必须带有连接字符串;

  当在Oracle服务器端使用EXP工具时,可以不带字符串  。导出包括导出表、导出方案、导出数据库三种模式  。

  (1)导出表

  导出表是指使用EXP工具将一个或多个表的结构和数据存储到OS文件中,导出表是使用TABLES选项来完成的  。

  普通用户可以导出其自身方案的所有表,但如果要导出其他方案的表,则要求该用户必须具有EXP_FULL_DATABASE角色或DBA角色  。另外当导出表时,默认情况下会导出相应表上的所有索引、触发器、约束  。下面以SYSTEM用户导出SCOTT.DEPT表为例,示例如下:

  

  1. exp system/Oracle@charge TABLE=scott.dept,scott.emp FILE=tab1.dmp 

  (2)导出方案

  导出方案是指使用Oracle EXP工具将一个或多个方案中的所有对象记数据存储到OS文件中,导出表是使用OWNER选项来完成的  。

  普通用户可以导出其自身方案,但如果要导出其他方案,则要求该用户必须具有DBA角色或EXP_FULL_DATABASE角色  。当用户要导出其自身方案的所有对象时,可以不指定OWNER选项,下面以SYSTEM用户导出SCOTT方案的所有对象为例,示例如下:

  

  1. exp system/Oracle@charge OWNER=scott FILE=schemal.dmp 

  以上为命令行方式进行数据的导出,EXP工具还可以以交互的方式进行数据导出  。

  (1)导出表(交互方式)

  

  1. [Oracle@ora-asm3 dbs]$ exp 

  Export: Release 10.2.0.1.0 - Production on 星期一 6月 16 16:24:26 2008

  

  1. Copyright (c) 1982, 2005, Oracle. All rights reserved. 

  Username: charge 输入用户名

  Password: 输入密码

  

  1. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production  
  2. With the Partitioning, OLAP and Data Mining options  

  

  Enter array fetch buffer size: 4096 > 输入缓冲区大小,可以默认也可以自定义,如果数据文件较大,建议设置的大一些  。

  Export file: expdat.dmp > charge01.dmp 输入导出的文件名,必须以”.dmp”文件做为扩展名  。

  (2)U(sers), or (3)T(ables): (2)U > t 输入导出类型,默认为用户(也就是方案),在此输入t,为导出表

  Export table data (yes/no): yes > 是否导出表中的数据,如果选NO,则导出表结构  。

  Compress extents (yes/no): yes > 是否对数据压缩

  

  1. Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set  
  2. About to export specified tables via Conventional Path ...  

  

  Table(T) or Partition(T:P) to be exported: (RETURN to quit) > clients 输入表名

  开始导出clients表数据

  

  1. . . exporting table CLIENTS 10 rows exported 

  Table(T) or Partition(T:P) to be exported: (RETURN to quit) > 如果没有要导出的数据时,按回车退出  。

  

  1. Export terminated successfully without warnings. 

  提示导出成功,没有任何告警  。
(2)导出方案(交互方式)

  

  1. [Oracle@ora-asm3 dbs]$ exp 

  Export: Release 10.2.0.1.0 - Production on 星期一 6月 16 16:23:47 2008

  

  1. Copyright (c) 1982, 2005, Oracle. All rights reserved. 

  Username: charge 输入用户名

  Password: 输入密码

  

  1. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production  
  2. With the Partitioning, OLAP and Data Mining options  

  

  Enter array fetch buffer size: 4096 > 输入缓冲区大小,可以默认也可以自定义,如果数据文件较大,建议设置的大一些  。

  Export file: expdat.dmp > charge.dmp 输入导出的文件名,必须以”.dmp”做为扩展名  。

  (2)U(sers), or (3)T(ables): (2)U > u 输入导出类型,默认为用户(方案),可以直接回车,也可以输入u  。

  Export grants (yes/no): yes > 导入权限

  Export table data (yes/no): yes > 是否导出表中的数据,如果选NO,则导出表结构  。

  Compress extents (yes/no): yes > 是否对数据压缩

  

  1. Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set  
  2. . exporting pre-schema procedural objects and actions  
  3. . exporting foreign function library names for user CHARGE  
  4. . exporting PUBLIC type synonyms  
  5. . exporting private type synonyms  
  6. . exporting object type definitions for user CHARGE  
  7. About to export CHARGEs objects ...  
  8. . exporting database links  
  9. . exporting sequence numbers  
  10. . exporting cluster definitions  
  11. . about to export CHARGEs tables via Conventional Path ...  
  12. . . exporting table BALANCE 0 rows exported  
  13. . . exporting table BALANCEFINISHED 0 rows exported  
  14. ………………  
  15. . exporting synonyms  
  16. . exporting views  
  17. . exporting stored procedures  
  18. . exporting operators  
  19. . exporting referential integrity constraints  
  20. . exporting triggers  
  21. . exporting indextypes  
  22. . exporting bitmap, functional and extensible indexes  
  23. . exporting posttables actions  
  24. . exporting materialized views  
  25. . exporting snapshot logs  
  26. . exporting job queues  
  27. . exporting refresh groups and children  
  28. . exporting dimensions  
  29. . exporting post-schema procedural objects and actions  
  30. . exporting statistics  
  31. Export terminated successfully without warnings.  

  

  提示导出成功,没有任何告警  。