Oracle DBLink脚本
-- Drop existing database link
drop database link DBLink名称;
-- Create database link
create database link DBLink名称
connect to 远程数据库用户名 identified by 密码
using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 远程数据库IP地址)(PORT = 数据库端口号))
)
(CONNECT_DATA =
(SERVICE_NAME = 实例名)
)
)';
例:
-- Drop existing database link
drop database link TEST_DBLINK;
-- Create database link
create database link TEST_DBLINK
connect to test identified by test
using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 111.111.111.111)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = test)
)
)';