欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

PL/SQL:database links

程序员文章站 2022-05-05 11:34:57
...

1  在被连接的数据库上,查看监听配置文件

PL/SQL:database links

 2   tnsnames.ora

PL/SQL:database links

 3  复制所需要连接用户的DESCRIPTOIN

  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

 4  在连接的数据库上,新增database links

PL/SQL:database links

 5  选择需要的信息,数据库的内容为上述的DESCRIPTOIN,也可以间写为:localhost:1521/orcl

PL/SQL:database links

 6  创建database links对应的sql语句

-- Create database link 
create database link dblink_scott
  connect to scott identified by tiger
  using '(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = orcl)))';

7  测试

PL/SQL:database links