zoukankan      html  css  js  c++  java
  • Oracle得知(十五):分布式数据库


    --分布式数据库的独立性:分布数据的独立性指用户不必关心数据怎样切割和存储,仅仅需关心他须要什么数据。

    --本地操作 SQL> sqlplus scott/tiger --远程操作 SQL> sqlplus scott/tiger@192.168.1.217:1521/orcl --分布式操作 SQL> --创建数据库链路l2(须要权限); SQL> --remoteorcl服务命名(在net manager里配置):配置跟远程server的数据库的连接协议、主机名(ip地址)、port号等 SQL> create database link l2 connect to scott identified by tiger using 'remoteorcl'; SQL> --在分布式数据库中运行查询 SQL> select ename,dname 2 from dept, emp@L2 --通过数据库链路L2查询emp表 3 where emp.deptno=dept.deptno; SQL> --为emp@L2创建同义词 SQL> create SYNONYM remoteemp for emp@L2; SQL> --使用同义词进行查询 SQL> select ename,dname 2 from dept, remoteemp --使用同义词 3 where remoteemp.deptno=dept.deptno; create view emp as select * from emp1@L1 --指向上海的链路 union select * from emp2@L2; --指向北京的链路 select * from emp; --从上海和北京的数据库查询 --分布式数据库的跨界点更新:快照;触发器。 --快照:定义快照维护关系表的异步副本(创建在备份端) --指在主表改动后的指定时间内刷新副本,用于主表改动少。但频繁查询的表 create snapshot emp --创建快照 refresh start with sysdate --第一次更新 next next_day(sysdate,’Monday’) --下次更新时间 as select * from emp@L1; --更新内容 --触发器(创建在主数据库上) SQL> --利用触发器实现数据的同步更新(以下的代码仅仅实现了薪水更新触发器) SQL> create or replace trigger syncsal 2 after update 3 on emp 4 for each row 5 begin 6 update remoteemp set sal=:new.sal where empno=:new.empno; 7 8 end; 9 /



    版权声明:本文博主原创文章。博客,未经同意不得转载。

  • 相关阅读:
    Cannot complete this action,please try again. Correlation ID :bd640a9d-4c19-doff-2fe0-6ce1104b59ae
    我的工作流为什么启动不了
    关于IE下复选框的样式问题
    使用SharePoint rest语法返回已上传的SharePoint Excel 文件
    Running the complier from the Command Line
    关于inline
    来到坡国
    在oracle Virtual Box 虚拟机中搭建hadoop1.2.1完全分布式环境(转自康哥的博客)
    hadoop调试
    linux相关指令学习
  • 原文地址:https://www.cnblogs.com/lcchuguo/p/4866074.html
Copyright © 2011-2022 走看看