参考链接
oracle中的database link如何使用——百度经验@wangzhiqing999
oracle中的database link如何使用
如何创建
oracle sql创建
-- Drop existing old database link
--DBLINK_test是database link的名称
drop database link DBLINK_test;
-- Create new database link
-- other_db 为用户名 pwd为密码
create database link DBLINK_test
connect to other_db IDENTIFIED BY pwd
using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)';
--查询 database link
select * from dba_db_links;
如果创建全局dblink,必须使用systm或sys用户,在database前加public
create public database link DBLINK_test
connect to other_db IDENTIFIED BY pwd
using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)';
通过plsql创建
image.pngimage.png
如何使用
--user_tables 是DBLINK_test所链接的用户的表
select * from user_tables@DBLINK_test;
网友评论