链接字符串的设置说 明
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用户的数据做成一个整体来处理。
为
了使有关分布式操作更透明,ORACLE数据库里有同义词的对象synonym
SQL>create synonym bjscottemp for emp@beijing;
于是就可以用bjscottemp来替代带@符号的分布式链接操作emp@beijing。
查看所有的数据库
链接,进入系统管理员SQL>操作符下,运行命令:
SQL>select owner,object_name from dba_objects where object_type=''''DATABASE LINK'''';
建ORACLE快照日志: SQL>create snapshot log on table3 with primary key;
建快照: SQL>create snapshot table3beijing refresh force start with sysdate next sysdate+1/24 with primary key as select * from table3@beijing;
ORACLE的快照刷新方式refresh有三种:
fast
快速刷新,用snapshot log,只更新时间段变动部分
complete
完全刷新,运行SQL语句
force
自动判断刷新,介于fast和complete之间