##引用
https://jingyan.baidu.com/article/8275fc86b1ff7a46a03cf68c.html
https://blog.csdn.net/mr_awei/article/details/81089259
##导出数据泵
创建数据导出目录expnc_dir为目录名,'E:\ncdatabak'为数据库实际目录,命令如下:
##登录system用户
create directory expnc_dir as 'E:\ncdatabak';
为oracle用户授予访问数据目录的权限,命令如下:
Grant read,write on directory expnc_dir to csdb;
执行数据泵出命令,注意一定要在Cmd下执行,不能登录sqlplus后执行。
expdp csdb/mima@orcl directory=expnc_dir dumpfile=ncdatabak.dmp schemas=csdb logfile=ncdatabak.log;
##创建新用户并授权
create user test identified by mima;
grant connect to test;
grant resource to test;
grant create any view to test;
grant create any table to test;
grant unlimited tablespace to test;
grant dba to test;
##导入数据泵
1、把之前到导出的文件夹复制到新的服务器上,比如:复制到E盘; E:\ncdatabak
2、数据库管理员登录sqlplus,创建数据导出目录expnc_dir为目录名,'E:\ncdatabak'为数据库实际目录,命令如下:
create directory expnc_dir as 'E:\ncdatabak';
3、为oracle用户授予访问数据目录的权限,命令如下:
Grant read,write on directory expnc_dir to test;
4、执行数据泵出命令,注意一定要在Cmd下执行,不能登录sqlplus后执行。
impdp test/mima@orcl REMAP_SCHEMA = csdb:test directory=expnc_dir dumpfile=ncdatabak.dmp
#指定用户:REMAP_SCHEMA = csdb:test
#指定表空间:REMAP_TABERSPACE = csdb:test