一、执行EXPDP命令
从oracle数据库导出数据分为4种情况。
1.导出表
(1) 创建目录(勇于存放导出文件),并赋予用户权限;
create directory dump_dir as ‘D:\SLYSXYDB0709‘;
1 grant read,write on directory dump_dir to scott;
(2) 执行导出命令
expdp scott/123456 directory =dump_dir dumpfile = daochu.emp tables = SHIPINFO
2.导出模式
1 create directory dump_dir as ‘D:SLYSXYDB0709‘; 2 grant read,write on directory dump_dir to scott; 3 grant EXP_FULL_DATABASE to scott;
(2)执行命令
1 expdp scott/123456 directory = dump_dir dumfile = xxxx.dmp schemas = scott
3.导出表空间
(1)创建目录,并赋予权限
1 create directory dump_dir as ‘D:SLYSXYDB0709‘; 2 grant read,write on directory dump_dir to scott; 3 grant EXP_FULL_DATABASE to scott;
(2)执行命令
1 expdp scott/12345678 directory = dump_dir dumfile = xxxx.dmp tablespace = users
二、执行IMPDP命令
1.导入表
创建目录,把需要导入的dmp文件放至目录中,并赋予权限
1 create directory dump_dir as ‘D:SLYSXYDB0709‘; 2 grant read,write on directory dump_dir to scott; 3 grant EXP_FULL_DATABASE to scott;
(2)执行命令
1 impdp scott/12345678 directory = dump_dir dumpfile = xxxx.dmp tablses = SHIPINFO remap_schema = 源模式:Scott(目标模式)
2.导入模式
(1)创建目录,把需要导入的dmp文件放至目录中,并赋予权限
1 create directory dump_dir as ‘D:SLYSXYDB0709‘; 2 grant read,write on directory dump_dir to scott; 3 grant EXP_FULL_DATABASE to scott;
(2)执行命令
1 impdp scott/12345678 directory = dump_dir dumfile = xxx.dmp schemas =scott remap_schema = 源模式:Scott(目标模式)
3.导入表空间
(1)创建目录,赋予权限,参考以上
(2)执行命令
1 impdp scott/12345678 directory = dump_dir dumpfile = xxx.dmp tablespaces =users
注意:在导入模式的时候,由于 源模式表空间在目标模式表空间未必存在,所以,导入表空间时可能存在问题,需要在目标模式中新建表空间
原文:https://www.cnblogs.com/codechangeworld1947/p/10919185.html