Oracle中dmp/dmpdp导出,imp/impdp导入

expdp/impdp和exp/imp的区别

1、exp和imp是客户端工具程序,它们既可以在客户端使用,也可以在服务端使用。

2、expdp和impdp是服务端的工具程序,他们只能在oracle服务端使用,不能在客户端使用。

3、imp只适用于exp导出的文件,不适用于expdp导出文件;impdp只适用于expdp导出的文件,而不适用于exp导出文件。

4、对于10g以上的服务器,使用exp通常不能导出0行数据的空表,而此时必须使用expdp导出。

5、exp导出方式要求表空间必须一致,而expdg方式只需要在语句中配一下目录就可以了

exp与 imp导入导出

命令行中的字段解释

-- exp方式导出数据库

exp dgpdg/[email protected]/ORCL file=D:\gd_base.dmp log=D:\gd_base.log(不要加full=y,会把整个数据库下所有用户的表倒下来)

-- imp方式导入数据库

imp dgpdgltfirst/[email protected]/orcl file="D:\dgpdgltfirst20171025.dmp" log="D:\dgpdgltfirst20171025.log" full=y ignore=y statistics=none

expdp与impdp导入导出

参考文挡

-- expdp方式导出数据库:此部分主要参考https://www.cnblogs.com/promise-x/p/7477360.html

1.使用sys用户创建目录

SQL>create directory [dirname] as [dirpath];	-- create directory cea as 'D:/';

2.查看目录是否创建好了

SQL>select * from dba_directories;

3.授权给操作用户这个cea目录的权限 

SQL>grant read,write on directory cea to scott;

4.在命令行中实现导出

expdp scott/[email protected]/ORCL directory=cea dumpfile=a.dmp logfile=aa.log


第一种:“full=y”,全量导出数据库;
expdp user/passwd@orcl dumpfile=expdp.dmp directory=data_dir full=y logfile=expdp.log;

第二种:schemas按用户导出;
expdp user/passwd@orcl schemas=user dumpfile=expdp.dmp directory=data_dir logfile=expdp.log;

第三种:按表空间导出;
expdp sys/passwd@orcl tablespace=tbs1,tbs2 dumpfile=expdp.dmp directory=data_dir logfile=expdp.log;

第四种:导出表;
expdp user/passwd@orcl tables=table1,table2 dumpfile=expdp.dmp directory=data_dir logfile=expdp.log;

第五种:按查询条件导;
expdp user/passwd@orcl tables=table1='where number=1234' dumpfile=expdp.dmp directory=data_dir logfile=expdp.log;


-- impdp方式导入数据库

1.建立逻辑目录(通导出的前三步)

2.在命令行中实现导入

impdp user/passwd directory=data_dir dumpfile=expdp.dmp full=y;	-- 其余的去上面的网站中找

猜你喜欢

转载自www.cnblogs.com/x54256/p/9289368.html