6.dblink连接

第一步配置串

image.png

关闭防火墙

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

第二步在CMD命令里面-连接dblink

create database link 创建的dblink名字
connect to 需要访问的用户 identified by “密码”
using ‘(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = 需要访问的数据库IP地址)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = 服务名)))’;


create database link QWE
   connect to SCOTT identified by tiger
  using '(DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 202.0.33.13)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )';

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

image.png

记录一次连接dblink

image.png
image.png
(DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.58.160.35)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

然后查看SQL,点击应用。

-- Create database link 
create database link ASZX
  connect to SICP4_BASICINFOCENTER identified by "sicp4_basicinfocenter+202004"
  using '(DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.58.160.35)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )';

连接本地dblink

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

2台电脑连接无解决

fbf950f933783def2e0ce30a06f973c.png

你可能感兴趣的:(6.dblink连接)