oracle - dblink

1.同一个数据库的用户(a)要用到用户(b)的表等,所需要建立的连接

CCPBS_19 =    --SID引用名
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.130.38.19)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = CCPBS) -- 数据库实例名SID
    )
  )

格式:create public database link  link_name connect to  username(b)   identified by password  using 'SID引用名';

例子create public database link  ecbm_19   connect to  ecbm_userName identified by ecbm_pwd  using 'CCPBS_19';

 

2.不同数据库之间的访问

create database link test_DBLINK 
  connect to username identified by "password "
    using '(DESCRIPTION = 
    (ADDRESS_LIST = 
    (ADDRESS = (PROTOCOL = TCP)(HOST = xx.xx.xx.xx)(PORT = 1521)) 
    ) 
    (CONNECT_DATA = 
    (SERVICE_NAME = orcl) 
    ) 
    )';

 

查询  select * from tablename@link_name;

如    select * from emp@ecbm_19;

删除 DROP PUBLIC DATABASE LINK ecbm_19;

--查询刚刚新建的dblink

select * from all_db_links order by created desc;

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值