陳瀟



摘? 要:隨著企業對信息系統的依賴性日益增加,數據庫作為信息系統的核心承擔著重要作用。為了緩解服務器訪問壓力,提升讀寫效率,很多數據庫管理員選擇搭建服務器集群。通過數據主從復制技術可以實現集群內部服務器之間數據的同步,實現負載均衡。本文對SQL Server數據庫發布/訂閱模式下的三種同步方案進行研究,并通過事務發布方式實現數據的同步。
關鍵詞:SQL Server;數據同步;主從復制
中圖分類號:TP392? ? ?文獻標識碼:A
Research and Application of Data Synchronization Scheme Based on SQL Server
CHEN Xiao
(Xuzhou Finance and Economics Branch,Jiangsu Union Technical Institute,Xuzhou 221008,China)
Abstract:With the increasing reliance on information systems in the enterprises,database,as the core of information systems,is undertaking the extremely vital role.To alleviate the pressure of read and write access and enhance the effect of application responses,many database administrators tend to build server clusters to accomplish data synchronization between the servers and load balancing by using the technology of data master-slave replication.This paper studies three replication schemes of SQL Server database publish/subscribe model,and accomplishes data synchronization through publish/subscribe model.
Keywords:SQL Server;data synchronization;master-slave replication
1? ?引言(Introduction)
隨著企業對信息系統的依賴性日益增加,數據庫作為信息系統的核心承擔著重要作用。為了保證系統的高可用性和穩定性,很多企業擴展單臺SQL Server服務器,構建服務器集群。服務器之間數據同步是保證集群數據一致性的基礎,各服務器間通過相應的策略同步數據[1]。在業務復雜的系統中,主數據庫主要負責寫數據,從數據庫主要負責讀數據,這樣能有效地減輕單臺服務器讀寫壓力。數據同步還應用于以下場合:
(1)數據匯總。如某個公司在不同地區設置銷售分公司,利用數據同步可以將各地區銷售分表進行匯總,形成公司銷售總表。另一種情況是對水平切分(如按順序切分、Hash散列切分)的表進行數據統一,切分后可以利用數據同步進行匯總。
(2)業務拆分。根據不同的業務進行劃分。如企業可以劃分為供內網辦公用服務器,外網客戶訪問服務器,備份服務器等。利用同步方案可以保證各服務器的數據一致性。
(3)故障轉移。……