要创建一个DB
LINK,必须先
在每个数据库服务器上设置链接字符串。
如:
在/var/opt/oracle/tnsnames.ora中有以下
一条和北京的数据库链接tobeijing,格式如下:
链接字符串的设置 |
说 明
|
tobeijing=(description= |
database link名称:tobeijing |
(address=(protocol=tcp) |
采用tcp/ip协议 |
(host=www.bj.col.com.cn) |
欲链接主机名称或IP地址 |
(port=1521)) |
网络端口1521 |
(connect_data=(sid=oracle7))) |
安装ORACLE采用的sid |
然后进入系统管理员SQL>操作符下,运行命令:
SQL>create public
database link beijing connect to scott identified by tiger
using 'tobeijing';
则创建了一个以scott用户和北京数据库的链接beijing,我们查询北京的scott数据:
SQL>select * from
emp@beijing;
这样就可以把深圳和北京scott用户的数据做成一个整体来处理。
posted on 2007-09-09 22:19
桂湖山 阅读(800)
评论(0) 编辑 收藏 引用 所属分类:
oracle_plsql