Home  >  Article  >  Database  >  Oracle expdp命令使用详解

Oracle expdp命令使用详解

WBOY
WBOYOriginal
2016-06-07 17:24:361068browse

相关参数以及导出示例: 1. DIRECTORY 指定转储文件和日志文件所在的目录 DIRECTORY=directory_object Directory_object用于指定

相关参数以及导出示例:

1. DIRECTORY

指定转储文件和日志文件所在的目录

DIRECTORY=directory_object

Directory_object用于指定目录对象名称.需要注意,目录对象是使用CREATE DIRECTORY语句建立的对象,而不是OS目录

Expdp scott/tiger DIRECTORY= DMP  DUMPFILE=a.dump

create or replace directory dmp

as 'd:/dmp'

expdp zftang/zftang@zftang directory=dmp  dumpfile=test.dmp content=metadata_only

2. CONTENT

该选项用于指定要导出的内容.默认值为ALL

CONTENT={ALL | DATA_ONLY | METADATA_ONLY}

当设置CONTENT为ALL时,将导出对象定义及其所有数据.为DATA_ONLY时,只导出对象数据,为METADATA_ONLY时,只导出对象定义

expdp zftang/zftang@zftang directory=dmp  dumpfile=test.dmp content=metadata_only

----------只导出对象定义

expdp zftang/zftang@zftang directory=dmp  dumpfile=test.dmp content=data_only

----------导出出所有数据

3. DUMPFILE

用于指定转储文件的名称,默认名称为expdat.dmp

DUMPFILE=[directory_object:]file_name [,….]

Directory_object用于指定目录对象名,file_name用于指定转储文件名.需要注意,如果不指定directory_object,导出工具会自动使用DIRECTORY选项指定的目录对象

expdp zftang/zftang@zftang directory=dmp  dumpfile=test1.dmp

数据泵工具导出的步骤:

1、创建DIRECTORY

create directory dir_dp as 'D:/Oracle/dir_dp';

2、授权

Grant read,write on directory dir_dp to zftang;

--查看目录及权限

SELECT privilege, directory_name, DIRECTORY_PATH FROM user_tab_privs t, all_directories d

WHERE t.table_name(+) = d.directory_name ORDER BY 2, 1;

3、执行导出

expdp zftang/zftang@fgisdb schemas=zftang directory=dir_dp dumpfile =expdp_test1.dmp logfile=expdp_test1.log;

连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1

With the Partitioning, OLAP and Data Mining options

启动 "ZFTANG"."SYS_EXPORT_SCHEMA_01":  zftang/********@fgisdb sch

ory=dir_dp dumpfile =expdp_test1.dmp logfile=expdp_test1.log;  */

备注:

1、directory=dir_dp必须放在前面,如果将其放置最后,,会提示 ORA-39002: 操作无效

ORA-39070: 无法打开日志文件。

ORA-39087: 目录名 DATA_PUMP_DIR; 无效

2、在导出过程中,DATA DUMP 创建并使用了一个名为SYS_EXPORT_SCHEMA_01的对象,此对象就是DATA DUMP导出过程中所用的JOB名字,如果在执行这个命令时如果没有指定导出的JOB名字那么就会产生一个默认的JOB名字,如果在导出过程中指定JOB名字就为以指定名字出现

如下改成:

expdp zftang/zftang@fgisdb schemas=zftang directory=dir_dp dumpfile =expdp_test1.dmp logfile=expdp_test1.log,job_name=my_job1;

3、导出语句后面不要有分号,否则如上的导出语句中的job表名为‘my_job1;’,而不是my_job1。因此导致expdp zftang/zftang attach=zftang.my_job1执行该命令时一直提示找不到job表

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn