Home >Database >Mysql Tutorial >Oracle跨服务器查询插入数据

Oracle跨服务器查询插入数据

WBOY
WBOYOriginal
2016-06-07 16:20:381053browse

想实现insert into 当前库表 select 远程库中的表数据这种方式的数据同步,于是配置了一下oracle服务,远程和本地服务都是oracle 一、在当前库中插入数据 1 2 create public database link remotedb connect to username identified by password using 'db';

 想实现insert into 当前库表 select 远程库中的表数据这种方式的数据同步,于是配置了一下oracle服务,远程和本地服务都是oracle

一、在当前库中插入数据

1

2

create public database link remotedb  connect to username identified by password using 'db';

create public database link curdb connect to username identified by password using 'curdb';

其中db,,curdb是配置的别名【注意,这个需要配置在服务器端的tnsnames.ora中,如果是配置在客户端的tnsnames.ora中,则会报TNS:无法解析指定的连接标示符】

二、接下来就可以直接写语句了 

1

2

insert into tb@curdb(field)

select field from tb@remotedb where rownum

这个配置关键是tnsnames.ora需要配置在服务器端,不要在客户端

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn