1.创建Directory对象,并授予相应用户读写权限:
SQL> create directory dump_file_dir as '/u01/imp_exp/dmp'
2 ;
Directory created.
SQL> grant read,write on directory dump_file_dir to scott;
Grant succeeded.
但是物理文件却……
[oracle@linux5 imp_exp]$ ls
dept_emp.dmp dept_emp.log fulldb.dmp fulldb.log scott_to_test.log
应该会报错……
[oracle@linux5 orcl]$ expdp scott/oracle directory=dump_file_dir dumpfile=dept_10.dmp nologfile=y tables=de% query=dept:\"where deptno=\'10\'\"
Export: Release 10.2.0.1.0 - Production on Thursday, 10 April, 2014 18:56:30
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
ORA-39001: invalid argument value
ORA-39000: bad dump file specification
ORA-31641: unable to create dump file "/u01/imp_exp/dmp/dept_10.dmp"
ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory
提示不能创建文件:
[oracle@linux5 imp_exp]$ mkdir dmp
[oracle@linux5 imp_exp]$ ls
dept_emp.dmp dept_emp.log dmp fulldb.dmp fulldb.log scott_to_test.log
再次导出:
[oracle@linux5 orcl]$ expdp scott/oracle directory=dump_file_dir dumpfile=dept_10.dmp nologfile=y tables=de% query=dept:\"where deptno=\'10\'\"
Export: Release 10.2.0.1.0 - Production on Thursday, 10 April, 2014 18:57:50
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Starting "SCOTT"."SYS_EXPORT_TABLE_01": scott/******** directory=dump_file_dir dumpfile=dept_10.dmp nologfile=y tables=de% query=dept:"where deptno='10'"
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "SCOTT"."DEPT" 5.593 KB 1 rows
Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is:
/u01/imp_exp/dmp/dept_10.dmp
Job "SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at 19:00:11
参数文件方式:
dept_exp_20.par:
directory=dump_file_dir
dumpfile=dept_exp_20.dmp
logfile=dept_exp_20.log
#include=table:"like 'de%'" 注意转义字符
query=dept:"where deptno='20'"
~
~
[oracle@linux5 dmp]$ expdp scott/oracle parfile=dept_exp_20.par
Export: Release 10.2.0.1.0 - Production on Thursday, 10 April, 2014 19:14:28
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Starting "SCOTT"."SYS_EXPORT_SCHEMA_01": scott/******** parfile=dept_exp_20.par
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 192 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
P