创建 dblink 链接
-- 本地建立导出用户
Create user db_exp identified by db_exp;
Grant connect,resource,create database link to db_exp;
-- 本地创建 directory 并授权导出用户使用
create or replace directory DIR_EXP as 'D:\direxp';
grant read,write on directory DIR_EXP to db_exp;
-- 创建 dblink 链接
create database link to_exp_65
connect to user_exp identified by user_exp
using '(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.48.1.65)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = orcl)
)
)';
Select 1 from dual@to_exp_65;
导出
expdp db_exp/db_exp@orcl_67 directory=DIR_EXP dumpfile=expdp_01.dmp logfile=expdp_01.log tables=(t_exp) network_link=to_exp_65
- Db_exp:本地用户,用来连接远端数据库服务器
- Dir_exp:本地db_exp用户下 的 directory 用户本地指定expdp写入目录,这里是D盘direxp文件夹
- To_exp_65:本地db_exp用户下的 db link ,用来连接远端数据库服务器