-- 创建dblink
create public database link dbLink_name(dblink的名称)
connect to sepcore identified by sepcore using '
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 需要连接的服务器ip)(PORT = 对应oracle的端口,默认是1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)';
-- 用户授权(将dblink连接授权给指定用户)
grant create public database link to userName
--查看oracle创建的dblink
select * from dba_db_links;或者
select owner,object_name from dba_objects where object_type='DATABASE LINK';
--删除dblink
DROP public database link dbLink_name