ORACLE 创建数据链

废话不多说直接上SQL语句:

create database link linkname 
   connect to dbuser identified by dbpassword 
   using '(DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.122.110)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = rac)
    )
  )';

其中  linkname 是数据链名称 ,dbuser 登陆用户名 ,dbpassword 登陆密码 ,HOST= 数据库所在ip,PORT =端口(默认是1521),SERVICE_NAME=数据库的sid(一般默认是orcl)

获取数据库的sid:select instance_name from v$instance

例子:
create database link interfaceDb_8_11
   connect to interfaceDb identified by 000000
   using '(DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.11)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl)
    )
  )'; 

你可能感兴趣的:(ORACLE 创建数据链)