创建一个链接到其他数据库的DBLINK


  1. --创建一个链接到其他数据库的链接
  2. --USING 'BitOrcl' 中的 BitOrcl 为 tnsnames.ora 中配置

  3. CREATE SHARED PUBLIC DATABASE LINK BitOrcl
  4. AUTHENTICATED BY SYS IDENTIFIED BY his
  5. USING 'BitOrcl' ;

  6. --使用方法,在表格后面加上需要链接数据库的DBLink名:

  7. SELECT * FROM 人员表@BitOral ;

  8. --删除DBLink
  9. DROP PUBLIC DATABASE LINK BitOral ;

  10. --创建一个连接到电子病历服务器的链接
  11. CREATE SHARED PUBLIC DATABASE LINK EmrOrcl
  12. AUTHENTICATED BY SYS IDENTIFIED BY his
  13. USING '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.71.103)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = emrorcl)))' ;

  14. --删除DBLink
  15. DROP PUBLIC DATABASE LINK EmrOrcl ;

  16. --创建一个连接到测试服务器的链接
  17. CREATE PUBLIC DATABASE LINK BitTest
  18. CONNECT TO SYS IDENTIFIED BY his
  19. USING '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.71.115)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = orcl)))' ;

  20. CREATE PUBLIC DATABASE LINK Hisinterface
  21. CONNECT TO ZLHIS IDENTIFIED BY HIS
  22. USING '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.168.110)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = orcl)))' ;

  23. --删除DBLink
  24. DROP PUBLIC DATABASE LINK BitTest ;

 --创建一个简易的dblink
 create public database link HisInterface connect to zlhis identified by his using '192.168.168.110:1521/orcl';


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28878983/viewspace-2133926/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/28878983/viewspace-2133926/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值