第一步配置串
關(guān)閉防火墻
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 202.0.33.13)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
第二步在CMD命令里面-連接dblink
create database link 創(chuàng)建的dblink名字
connect to 需要訪問的用戶 identified by “密碼”
using ‘(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = 需要訪問的數(shù)據(jù)庫IP地址)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = 服務(wù)名)))’;
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)) )
記錄一次連接dblink
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.58.160.35)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
然后查看SQL檩禾,點(diǎn)擊應(yīng)用。
-- 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)) )
-- 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)) )';