Chapter18Export and Import Utilities

1、export和import操作的.dmp文件,是一种二进制文件;面对一些小型的数据库,可以应付;但是对于那些大型的数据库,就有些吃力了;Import和export将逐渐的被淘汰;

  • exp.exe->exedp.exe
  • imp.exe->impdp.exe
  • *.dmp文件时平台无关性的;

2、Before Your Use Of Exp/Imp

  • Run the catexp.sql or catalog.sql script(如果DBA是用DBCA工具创建的数据库,Oracle  server 会自动执行上述两个脚本;如果是手工创建的数据库,则需要手工执行上述两个脚本)

3、Methods to invoke Exp/Imp

  • Command-line interface
  • An interactive mode
  • Parameter files
  • Oracle Enterprise Manager

4、exp命令使用

  • exp a1/a1@DB200 file=a1.dmp owner=a1 log=a1.log

5、Export Modes

Table Mode User Mode Tablespace Mode Full Database Mode

Table definitions

Table data(all or selected rows)

Owner`s table grants

Owner`s table indexes

Table constraints

Tables definitions

Tables data

Owner`s grants

Owner`s indexes

Tables constraints

Table definitions

Grants

Indexes

Table constraints Triggers

Table definitions

Tables data

Grants

Indexes

Tables contraints

  • Full Database Mode基本上被RMAN或者一些第三方工具给代替;
  • Tablespace Mode拥有特有的用途;
  • Table Mode或者User Mode比较常见;

6、Invoking Export

Syntax:exp keyword=value,value2,...,valuen

Example:

  • exp hr/hr TABLES=employees,departments rows=y file=exp1.dmp
    • tables=employees,departments表示只导出这两张表
    • rows=y,表示只导出数据
  • exp system/manager owner=hr direct=y file=expdata.dmp
    • owner=hr,表示导出hr这个用户的所有数据信息
  • exp \'username/password as sysdba'\ transport_tablespace=y tablespaces=ts_emp log=ts_emp.log
    • \'username/password as sysdba'\表示以sysdba身份导出数据
    • transport_tablespace=y表示只导出表空间的相关的数据字典信息(这个数据量很少),而表空间上的数据不会导出;
    • tablespaces=ts_emp,表示要导出的表空间名称

7、How the Transportable TS Modes Works

 

简述:通过Transportable模式进行exp操作,实际上导出的.dmp文件仅仅是被导出tablespace的相关的数据字典信息(也就是此tablespace在system dictionary中的登记信息),而实际tablespace中的数据信息,则是通过中介os copy的模式进行的;如此以来可以大大提高效率;

8、导出数据的两种方式

  • Direct Paht
  • Convention Paht

9、grant imp_full_database to u2

给用户u2授权imp_full_database命令,使其能够导入其他用户的dmp文件.

原文地址:https://www.cnblogs.com/arcer/p/2973055.html