使用expdp在远程导出数据(键人岐)

当本地也有一个数据库时,获取远程数据库的数据就又多了一种方式:利用NETWORK_LINK。
用NETWORK_LINK时也有几个限制:
Restrictions
When the NETWORK_LINK parameter is used in conjunction with the TABLES parameter, only whole tables can be exported (not partitions of tables).
The only types of database links supported by Data Pump Export are: public, fixed-user, and connected-user. Current-user database links are not supported.
1、在客户端上面修改tnsnames.ora
增加服务端的连接字符串
例如:
asdf =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.201.10.10)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = sidsid)
)
)
2.在客户端创建DATABASE LINK连接要导出数据的服务端。
SQL> create public database link db10_rc connect to username identified by password using 'connect_string';
Database link created.
//username和password是server端的,并且特别注意该处的connect_string 就为tnsnames.ora中的服务名.
3、在客户端创建文件夹,并给导出的用户授权。
create or replace directory dir as 'directory'; 
grant read,write on directory dir to username; 
这里的username是客户端的用户名,用于导出数据用的。
4、使用expdp导出远程的数据到本地。
expdp user/pass network_link=db10_rc directory=trans_dir dumpfile=test1.dmp schemas=esbdev
//这里的username用创建dblink的那个用户,directory也是客户端数据库创建的。
也可以直接将远程的用户导入本地用户,跳过生成DUMPFILE这一步
SQL> $impdp system/manager network_link=db10_rc directory=trans_dir tables=lyn.test remap_schema=lyn:yy
Import: Release 10.2.0.1.0 - Production on Thursday, 25 March, 2010 19:50:25
Copyright (c) 2003, 2005, oracle. All rights reserved.
Connected to: oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Starting "SYSTEM"."SYS_IMPORT_TABLE_01": system/******** network_link=db10_rc directory=trans_dir t
ables=lyn.test remap_schema=lyn:yy
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
. . imported "YY"."TEST" 1 rows
Job "SYSTEM"."SYS_IMPORT_TABLE_01" successfully completed at 19:50:37
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值