expdp常见用法

expdp是 oracle 10g提供的一个代替exp的工具,不论从速度还是功能上来讲,相对于exp来说都是一个飞跃。

1. 执行expdp之前要先创建directory对象,如:

CONNECT system/manager
CREATE OR REPLACE DIRECTORY expdir AS ‘d:\exp’;
GRANT read,write ON DIRECTORY expdir TO public;

2. 常见用法:

2.1 导出scott整个schema

expdp scott/tiger@bright parfile=c:\exp.par –默认导出登陆账号的schema

exp.par内容:

DIRECTORY=expdir
DUMPFILE=scott_full.dmp
LOGFILE=scott_full.log

或者:

expdp system/oracle@bright parfile=c:\exp.par  –其他账号登陆,在参数中指定schemas

exp.par内容:

DIRECTORY=expdir
DUMPFILE=scott_full.dmp
LOGFILE=scott_full.log
SCHEMAS=SCOTT

2.2 导出scott下的dept,emp表

expdp scott/tiger@bright parfile=c:\exp.par

exp.par内容:

DIRECTORY=expdir
DUMPFILE=scott.dmp
LOGFILE=scott.log
TABLES=DEPT,EMP

2.3 导出scott下除emp之外的表

expdp scott/tiger@bright parfile=c:\exp.par

exp.par内容:

DIRECTORY=expdir
DUMPFILE=scott.dmp
LOGFILE=scott.log
EXCLUDE=TABLE:”=’EMP’”

2.4 导出scott下的存储过程

expdp scott/tiger@bright parfile=c:\exp.par

exp.par内容:

DIRECTORY=expdir
DUMPFILE=scott.dmp
LOGFILE=scott.log
INCLUDE=PROCEDURE

2.5 导出scott下以’E'开头的表

expdp scott/tiger@bright parfile=c:\exp.par

DIRECTORY=expdir
DUMPFILE=scott.dmp
LOGFILE=scott.log
INCLUDE=TABLE:”LIKE ‘E%’”   –可以改成 NOT LIKE,就导出不以E开头的表

2.6 带QUERY导出

expdp scott/tiger@bright parfile=c:\exp.par

exp.par内容:

DIRECTORY=expdir
DUMPFILE=scott.dmp
LOGFILE=scott.log
TABLES=EMP,DEPT
QUERY=EMP:”where empno >=8000″
QUERY=DEPT:”where deptno >=10 and deptno <=40″

注:处理这样带查询的多表导出,如果多表之间有外健关联,可能需要注意查询条件所筛选的数据是否符合这样的外健约束,比如:EMP中有一栏位是deptno,是关联dept中的主键,如果”where empno >=8000″中得出的deptno=50的话,那么,你的dept的条件”where deptno >=10 and deptno <=40″就不包含deptno=50的数据,那么在导入的时候就会出现错误!

  
« Oracle中的audit            Home            IT行业三大著名定理 »

3 Comments so far

Leave a comment

Name(required)
Mail (will not be published)(required)
Website

Fields in bold are required. Email addresses are never published or distributed.

Some HTML code is allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
URLs must be fully qualified (eg: http://www.dbifan.com),and all tags must be properly closed.

Line breaks and paragraphs are automatically converted.

Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.

    搜索本站

    站点日历

    2月 2008
    « 1   3 »
     123
    45678910
    11121314151617
    18192021222324
    2526272829  

    订阅本站

    文章分类

    最新日志

    热点文章

    日志存档

    常用标签