分散式資料庫概念

來源:互聯網
上載者:User

什麼是分布資料庫? 
資料物理上被存放在網路的多個節點上,邏輯上是一個整體。 
分散式資料庫的獨立性: 
分布資料的獨立性指使用者不必關心資料如何分割和儲存,只需關心他需要什麼資料 
定義資料庫鏈路 

  1. CREATE DATABASE LINK [db_link_name] CONNECT TO [user_name] IDENTIFIED BY [password] USING '[tns_name]';  
  2. 1、[DB_LINK_NAME]:是所要串連的資料庫的服務名,也就是該資料庫的真實名稱(通常就是SID)。  
  3. 2、  [USRE_NAME]:是所要串連的使用者名稱稱。  
  4. 3、  [PASSWORD]:是所要串連的使用者的密碼。  
  5. 4、[TNS_NAME]:是所要串連的資料庫的服務命名。  
  6. 例如:  
  7. SQL> create database link  l2 connect to scott identified by soctt using 'shuang';  
  8. 之前要配置好啊  
  9. 分散式資料庫查詢:  
  10. select  ename, dname  from  dept, emp@L2  where  emp.deptno=dept.deptno;  
  11. 透明存取-別名  
  12. SQL> create synonym shuang for emp@l2;  
  13. 建立遠端資料表的視圖:  
  14. create view emp                 
  15.  as                        
  16.      select * from emp1@L1       
  17.      union                     
  18.      select * from emp2@L2 ;  
  19. 分散式資料庫的其他動作:  
  20. 插入操作:  
  21. insert into emp select * from emp@L2;  
  22. 資料複製:  
  23. create table emp as select * from emp@L2;  
  24. 快照:  
  25. 定義快照維護關係表的非同步副本  
  26. 指在主表修改後的指定時間內重新整理副本,用於主表修改少,但頻繁查詢的表。  
  27. create snapshot  emp(  
  28.   refresh  start with sysdate  
  29.    next  next_day(sysdate,’Monday’)  
  30.   as  select * from emp@L1 ;  
  31. 利用觸發器實現資料的同步:  
  32. create or replace trigger update_emp after update on emp for each row  
  33. begin  
  34.     update emp@L2 set  emp.sal =:new.sal   
  35.     where emp.empno= :new.empno;  
  36. end;  

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.