根据需要修改以下红色字体的部分即可。
1、连接集群式数据库DBLINK语法
create public database link 自定义的dblink名字
connect to 连接对方数据库的用户名 identified by "密码"
using '(DESCRIPTION =
(ADDRESS_LIST =
(FAILOVER = ON)
(LOAD_BALANCE = OFF)
(ADDRESS = (PROTOCOL = TCP)(HOST =对方数据库集群服务器1)(PORT = 端口号))
(ADDRESS = (PROTOCOL = TCP)(HOST =对方数据库集群服务器2)(PORT = 端口号))
(ADDRESS = (PROTOCOL = TCP)(HOST =对方数据库集群服务器3)(PORT = 端口号))
(ADDRESS = (PROTOCOL = TCP)(HOST =对方数据库集群服务器4)(PORT = 端口号))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(FAILOVER_MODE=(TYPE=select)(METHOD=basic))
(INSTANCE_ROLE = ANY)
(SERVICE_NAME = 对方数据库的服务名)))';
2、单机数据库服务器DBLINK语法:
CREATE public database 自定义的dblink名字
connect to 连接对方数据库的用户名 identified by "密码"
using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 对方数据库服务器 )(PORT = 端口号))
)
(CONNECT_DATA =
(SERVICE_NAME = 对方数据库的服务名))
)';