一.搭建环境
C:\Documents and Settings\Administrator>sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on 星期一 11月 15 20:08:26 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> create user david identified by abc123;
用户已创建。
SQL> grant resource, connect to david;
授权成功。
SQL> grant create any directory to david;
或
SQL>grant read, write on directory to david;
授权成功。
SQL> grant imp_full_database to david;
授权成功。
SQL> create tablespace tbs_david datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\tbs_david01.dbf' size 100M reuse autoextend on next 10M;
表空间已创建。
SQL> alter user david default tablespace tbs_david;
用户已更改。
SQL> conn david/abc123@orcl
已连接。
SQL> create or replace directory dirdp as 'D:\dirdp';
目录已创建。
SQL> conn david/abc123;
已连接。
SQL> grant read, write on directory dirdp to scott;
二.导出数据
1)按用户导出, 这里由david执行导出scott的数据表
C:\>expdp scott/tiger@orcl schemas=scott directory=dirdp dumpfile=expdp.dmp logfile=expdp.log
Export: Release 10.2.0.1.0 - Production on 星期一, 15 11月, 2010 20:22:29
Copyright (c) 2003, 2005, Oracle. All rights reserved.
连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
启动 "SCOTT"."SYS_EXPORT_SCHEMA_01": scott/********@orcl schemas=scott director
y=dirdp dumpfile=expdp.dmp logfile=expdp.log;
正在使用 BLOCKS 方法进行估计...
处理对象类型 SCHEMA_EXPORT/TABLE/TABLE_DATA
使用 BLOCKS 方法的总估计: 384 KB
处理对象类型 SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
处理对象类型 SCHEMA_EXPORT/TABLE/TABLE
处理对象类型 SCHEMA_EXPORT/TABLE/INDEX/INDEX
处理对象类型 SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
处理对象类型 SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
处理对象类型 SCHEMA_EXPORT/TABLE/COMMENT
处理对象类型 SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
处理对象类型 SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . 导出了 "SCOTT"."DEPT" 5.656 KB 4 行
. . 导出了 "SCOTT"."EMP" 7.820 KB 14 行
. . 导出了 "SCOTT"."SALGRADE" 5.585 KB 5 行
. . 导出了 "SCOTT"."T1" 4.937 KB 5 行
. . 导出了 "SCOTT"."TEAM" 4.929 KB 4 行
. . 导出了 "SCOTT"."TEAM2" 4.929 KB 4 行
. . 导出了 "SCOTT"."BONUS" 0 KB 0 行
已成功加载/卸载了主表 "SCOTT"."SYS_EXPORT_SCHEMA_01"
***********