CREATE DATABASE LINK数据库链接名
CONNECT TO 用户名
IDENTIFIED BY 密码
USING ‘数据库连接字符串';
例1:
CREATE PUBLIC DATABASE LINK CONN_MY_LINK
CONNECT TO MYUSER IDENTIFIED BY MYPASSWORD
USING 'MYORAL';
其中MYORAL为客户端服务器建立的访问服务端服务器的本地命名,
LINK CONN_MY_LINK为本地建立的dblink名称
例2:
CREATE PUBLIC DATABASE LINK LINK_HSMIS
CONNECT TO BI
IDENTIFIED BY BI
USING '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.188.245.201)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = hsmis)
)
)';
直接用本地命名连接字符串替代本地命名。
// 赋予创建权限
grant CREATE DATABASE LINK to smis;
grant CREATE SYNONYM to smis;