1.创建试验表test_table
ora11g@RHEL53 /home/oracle$ sqlplus sec/sec
SQL*Plus: Release 11.1.0.6.0 - Production on Mon Mar 2 18:28:50 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
sec@ora11g> select * from cat;
no rows selected
sec@ora11g> create table test_table as select * from dba_objects where rownum<1000;
Table created.
sec@ora11g> select count(*) from test_table;
COUNT(*)
----------
999
2.使用参数文件进行导出
ora11g@RHEL53 /home/oracle$ cat test_tables_query.par
QUERY=test_table:"where rownum<10"
NOLOGFILE=y
DIRECTORY=DATA_PUMP_DIR
DUMPFILE=expdp_test_table.dmp
ora11g@RHEL53 /home/oracle$ expdp sec/sec parfile=test_tables_query.par reuse_dumpfiles=y
Export: Release 11.1.0.6.0 - Production on Monday, 02 March, 2009 18:35:10
Copyright (c) 2003, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SEC"."SYS_EXPORT_SCHEMA_01": sec/******** parfile=test_tables_query.par reuse_dumpfiles=y
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 128 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
. . exported "SEC"."TEST_TABLE" 11.42 KB 9 rows
Master table "SEC"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SEC.SYS_EXPORT_SCHEMA_01 is:
/oracle/u01/app/oracle/admin/ora11g/dpdump/expdp_test_table.dmp
Job "SEC"."SYS_EXPORT_SCHEMA_01" successfully completed at 18:35:38
3.单条语句导出时,需要加一对单引号QUERY=test_table:'"where rownum<10"'
ora11g@RHEL53 /home/oracle$ expdp sec/sec reuse_dumpfiles=y QUERY=test_table:'"where rownum<10"' NOLOGFILE=y DIRECTORY=DATA_PUMP_DIR DUMPFILE=expdp_test_table.dmp
或
ora11g@RHEL53 /home/oracle$ expdp sec/sec reuse_dumpfiles=y QUERY='test_table:"where rownum<10"' NOLOGFILE=y DIRECTORY=DATA_PUMP_DIR DUMPFILE=expdp_test_table.dmp
Export: Release 11.1.0.6.0 - Production on Monday, 02 March, 2009 18:38:21
Copyright (c) 2003, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SEC"."SYS_EXPORT_SCHEMA_01": sec/******** reuse_dumpfiles=y QUERY=test_table:"where rownum<10" NOLOGFILE=y DIRECTORY=DATA_PUMP_DIR DUMPFILE=expdp_test_table.dmp
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 128 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
. . exported "SEC"."TEST_TABLE" 11.42 KB 9 rows
Master table "SEC"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SEC.SYS_EXPORT_SCHEMA_01 is:
/oracle/u01/app/oracle/admin/ora11g/dpdump/expdp_test_table.dmp
Job "SEC"."SYS_EXPORT_SCHEMA_01" successfully completed at 18:38:40
secooler
09.03.02
-- The End --
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/148459/viewspace-1062599/
,如需转载,请注明出处,否则将追究法律责任。