1.按用户导出及导入:
导出:
1.用SYS登陆ORCL(源数据库).
2.建立逻辑目录:
create directory yandata1 as 'd:\test\dump'; d:\test\dump 必须物理存在且空间足够.
3.给SCOTT付给权限可以读写逻辑目录.
grant read,write on directory yandata1 to scott
4.在CMD里面写如下命令.
expdp scott/123@orcl schemas=scott dumpfile=expdp.dmp DIRECTORY=yandata1
导入:
前两步和导出一样.
3.给SCOTT(可以是其他用户)付给权限可以读写逻辑目录.
grant read,write on directory yandata1 to scott
在CMD里面写如下命令:
impdp scott/123@yanorcl(和第3步的用户相同) DIRECTORY=yandata1 DUMPFILE=expdp.dmp SCHEMAS=scott(和第3步的用户相同) table_exists_action=replace
以上导入有点问题,建议导入前,DROP目标数据库所有将要导入的表.否则即使是用了table_exists_action=replace
参数,仍然有重复导入的错误.
2.导出单张表:
expdp scott/123@orcl TABLES=S1APMESSAGE dumpfile=expdp.dmp DIRECTORY=yandata1
impdp scott/123@orcl TABLES=S1APMESSAGE dumpfile=expdp.dmp DIRECTORY=yandata1
如果不同schema 导单张表
表名前要加源schema名
impdp <desuser>/<despassword>@orcl REMAP_SCHEMA=<org>:<des> TABLES=<org>.tablename dumpfile=<file.dmp> Directory=<dirname>
导入导出数据.
猜你喜欢
转载自xixiyanqi.iteye.com/blog/1738216
今日推荐
周排行