oracle创建dblink方法示例
1.应用场景:
现有两个数据库,一个是nc650115,一个是nc56,现要通过dblink在nc650115连接nc56。
2.先在nc650115查看是否拥有创建dblink权限。在nc650115中执行
select * from user_sys_privs where privilege like upper('%DATABASE LINK%');
有权限显示如下
没有权限到sys里面授权
grant CREATE PUBLIC DATABASE LINK,DROP PUBLIC DATABASE LINK to nc650115;
3.在nc650115下创建dblink。
create public database link NC65DBLINK connect to nc56 identified by nc56 using '(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = 192.168.17.254)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = orcl)))';
其中NC65DBLINK 为dblink名字,
connect to 需要连接的用户名 identified by 密码
HOST=需要连接数据库的ip
SERVICE_NAME=数据库实例
查看是否创建成功
select * from dba_db_links; select owner,object_name from dba_objects where object_type='DATABASE LINK';--查询时间久
4.操作:
查询nc56里面的数据
select * from crm_bd_building@NC65DBLINK
删除dblink
drop public database link NC65DBLINK
相关推荐
lklong 2020-11-22
oraclemch 2020-11-06
shilukun 2020-10-10
周嘉笙 2020-11-09
zhuzhufxz 2020-09-16
bfcady 2020-08-16
Hody 2020-08-16
FightFourEggs 2020-08-16
数据库设计 2020-08-16
yanghuatong 2020-08-16
dbasunny 2020-08-16
罗罗 2020-08-16
ihuaqiang 2020-08-16
choice0 2020-07-30
娜娜 2020-07-28
solarspot 2020-07-28
踩风火轮的乌龟 2020-07-26
娜娜 2020-07-20
xwb 2020-07-19
娜娜 2020-07-18
流云追风 2020-07-04
dataminer 2020-06-25
娜娜 2020-06-22
zhangchaoming 2020-06-21