JP2004302919A - Replication system and program therefor - Google Patents

Replication system and program therefor Download PDF

Info

Publication number
JP2004302919A
JP2004302919A JP2003095662A JP2003095662A JP2004302919A JP 2004302919 A JP2004302919 A JP 2004302919A JP 2003095662 A JP2003095662 A JP 2003095662A JP 2003095662 A JP2003095662 A JP 2003095662A JP 2004302919 A JP2004302919 A JP 2004302919A
Authority
JP
Japan
Prior art keywords
data
replica
database
change
master
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2003095662A
Other languages
Japanese (ja)
Inventor
Masayuki Yamada
正幸 山田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mitsubishi Electric Information Systems Corp
Mitsubishi Electric Information Technology Corp
Original Assignee
Mitsubishi Electric Information Systems Corp
Mitsubishi Electric Information Technology Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mitsubishi Electric Information Systems Corp, Mitsubishi Electric Information Technology Corp filed Critical Mitsubishi Electric Information Systems Corp
Priority to JP2003095662A priority Critical patent/JP2004302919A/en
Publication of JP2004302919A publication Critical patent/JP2004302919A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a replication system and a program therefor which can set complex extraction conditions, customize an internal structure and lighten the load of a disk capacity of a master server, by using a proprietary replication function. <P>SOLUTION: The system comprises an extracting conditions database for storing and holding the extracting the conditions for extracting data to be registered into each replica database from a master database; an extracting means for extracting changed data to be registered into each replica database, respectively, based on the extracting conditions stored and held in the extracting condition database, when the registered data in the master database is changed; and a changed data transmitting means for transmitting the changed data to each replica terminal, in response to requests from respective replica terminals, respectively. <P>COPYRIGHT: (C)2005,JPO&NCIPI

Description

【0001】
【発明の属する技術分野】
本発明は、RDBMS(Relational Database System:関係データベースシステム)に用いるレプリケーションシステム及びレプリケーションシステム用プログラムに関する。
【0002】
【従来の技術】
図7は、従来のレプリケーションシステムのハードウェア構成及びデータの流れを概略的に示す図である。ここでは、RDBMSの一製品であるOracle(登録商標)のレプリケーションシステムで用いられているレプリケーション機能(スナップショット)について説明する。
【0003】
図7に示すように、マスタサーバ1とスナップショット端末2〜4はネットワーク(図示せず)で接続されている。マスタサーバ1とスナップショット端末2〜4にはマスタData Base1A(以下、DBと略す)とスナップショットDB2A〜4Aがそれぞれ配設され、マスタサーバ1でデータが変更されると、データの変更分がスナップショット端末2〜4に伝送され、スナップショットDB2A〜4Aの登録内容が変更される。
【0004】
具体的には、マスタサーバ1は、データの変更分で構成されるスナップショットログ1aを生成する。スナップショットログ1aは各スナップショット端末2〜4にスナップショット2a〜4a(2a、3a、4a)として伝送される。
マスタサーバ1はマスタDB1Aのデータ内容を変更する度に、変更データをスナップショットログ1aとして出力する。スナップショット端末2〜4は、定期的にマスタサーバ1のスナップショットログ1aを読み込んでスナップショット2a〜4aを変更(リフレッシュ)する(例えば特許文献1参照。)。
【0005】
【特許文献1】
特開2002−116939号公報(第3−第6頁、第1図)
【0006】
【発明が解決しようとする課題】
しかしながら、従来のレプリケーションシステムには下記のような課題があった。
各スナップショット端末2〜4はそれぞれ異なるデータを有している場合が多い。このような場合において、スナップショット2a〜4aの抽出条件をある程度設定することはできるが、複雑な抽出条件を設定することはできなかった。このため、スナップショット2a〜4aはマスタDB1Aの単純なコピーとなっていた。
【0007】
また、上述したようにスナップショットログ1aはマスタサーバ一つにつき一種類であるため、各スナップショット端末2〜4は不要なデータまで取り込まなければならず、リフレッシュ時間が長くなっていた。これは、特に低速な回線を使用した場合に顕著であった。
【0008】
スナップショットログ1aは全スナップショット端末2〜4でのリフレッシュが行われない限り削除されることはない。このため、リフレッシュを定期的に行わないスナップショット端末2〜4があると、マスタサーバ1のスナップショットログ1aが保持される期間が長くなり、マスタサーバ1のディスク容量が圧迫されていた。
【0009】
本発明は、以上のような課題を解決するためになされたもので、特に、Oracleが持つレプリケーション機能を使用せずに、独自のレプリケーション機能を使用することにより、複雑な抽出条件の設定や内部構造のカスタマイズを可能とし、マスタサーバのディスク容量の負担が軽いレプリケーションシステム及びレプリケーションシステム用プログラムを提供することを目的とする。
【0010】
【課題を解決するための手段】
本発明のレプリケーションシステムは、マスタデータベースが接続されたマスタサーバと、このマスタサーバにネットワークを通じて接続され、マスタデータベースの登録データと同一のデータを登録する複数のレプリカデータベースが接続されたレプリカ端末とを備える関係データベースシステムに用いられるレプリケーションシステムであって、各レプリカデータベースに登録するデータをマスタデータベースから抽出するための抽出条件を記憶保持する抽出条件データベースと、マスタデータベースの登録データが変更されると、前記抽出条件データベースに記憶保持された抽出条件に基づき、各レプリカデータベースに登録すべき変更データを抽出する抽出手段と、各レプリカ端末からの要求に応じ、前記変更データを各レプリカ端末に伝送する変更データ伝送手段とを備える。
【0011】
また、前記抽出手段によって抽出された変更データの削除処理をレプリカ端末から受けると、当該変更データをマスタサーバ側で削除する変更データ削除手段をさらに備える。
【0012】
また、各変更データには端末ID及びデータ識別番号が付されており、前記変更データ削除手段は、端末ID及びデータ識別番号で特定した変更データを削除する。
【0013】
また、マスタデータベースへの登録データの変更が削除処理、挿入処理または更新処理のいずれの処理によって行われたかに基づき、レプリカデータベースへの変更データの登録処理方法である変更モードを判定する変更モード判定手段をさらに備える。
【0014】
また、前記変更モード判定手段は、当該変更データの変更モードが挿入処理であると判定した場合は、レプリカデータベース内に同一のキーを有するデータがあるか否かを判定し、同一キーのデータがないと判定した場合は変更モードを挿入処理とし、同一キーのデータがあると判定した場合は、変更モードを更新処理とする。
【0015】
また、前記変更モード判定手段は、当該変更データの変更モードが更新処理であると判定した場合は、レプリカデータベース内に同一のキーを有するデータがあるか否かを判定し、同一キーのデータがあると判定した場合は変更モードを更新処理とし、同一キーのデータがないと判定した場合は、変更モードを挿入処理とする。
【0016】
本発明のレプリケーションシステム用プログラムは、マスタデータベースが接続されたマスタサーバと、このマスタサーバにネットワークを通じて接続され、マスタデータベースの登録データと同一のデータを登録する複数のレプリカデータベースが接続されたレプリカ端末とを備える関係データベースシステムに用いられるレプリケーションシステム用プログラムであって、コンピュータに、マスタデータベースの登録データが変更されると、各レプリカデータベースに登録するデータをマスタデータベースから抽出するための抽出条件を記憶保持する抽出条件データベースに記憶保持された抽出条件に基づき、各レプリカデータベースに登録すべき変更データを抽出する抽出手段、及び、各レプリカ端末からの要求に応じ、前記変更データを各レプリカ端末に伝送する変更データ伝送手段として機能させるプログラムである。
【0017】
【発明の実施の形態】
以下、図面と共に本発明によるレプリケーションシステム及びレプリケーションシステム用プログラムをOracleのRDBMSに適用した好適な実施の形態について詳細に説明する。
図1は、本発明のレプリケーションシステムのハードウェア構成及びデータの流れを概略的に示す図である。
【0018】
図1に示すように、マスタサーバ11は図示しないネットワークを通じてレプリカ端末12〜14と接続されている。マスタサーバ11は、マスタDB11A及び抽出条件DB11Bを備え、各レプリカ端末12〜14は、レプリカDB12A〜14Aを備える。
各レプリカDB12A〜14Aに登録されているデータはそれぞれ異なるが、マスタDB11Aには、レプリカDB12A〜14Aに登録されている全てのデータと同一のデータが登録されている。
【0019】
また、抽出条件DB11Bには、マスタDB11A内の登録データから、各レプリカDB12A〜14A内に登録されているデータを抽出するための抽出条件が予め登録されている。この抽出条件は、複数の検索条件(SELECT文)の組み合わせや条件文等の判断ロジックによって構成されている。
レプリカDB12A〜14Aのデータ内容は、それぞれの抽出条件に基づき、マスタDB11Aのデータ内容の変更に合わせて変更(このレプリカDBの登録データの「変更」のことを「リフレッシュ」と称する)される。
【0020】
本発明のレプリケーションシステムにおいて、マスタDB11Aのデータ内容が変更されると、マスタDB11Aの登録内容が変更された場合に、マスタサーバ11は、データベーストリガ機能を利用し、抽出条件DB11Bから各レプリカ端末12〜14用の抽出条件を読み出し、読み出した抽出条件に基づいてマスタDB11Aから変更されたデータを抽出することにより変更データであるレプリカログ11a〜11cを生成する。この抽出・生成処理はマスタサーバ11の抽出手段としての機能によって行われる。
各レプリカログ11a〜11cは、各レプリカ端末12〜14に対応した識別子である端末IDを有している。
【0021】
マスタサーバ11は、各レプリカ端末12〜14からの要求に応じてレプリカログ11a〜11cを伝送する。これはマスタサーバ11の変更データ送信手段としての機能によって実行される。レプリカログ11a〜11cを取り込んだレプリカ端末12〜14は、それぞれ予め設定されたタイミングでレプリカDB12A〜14Aのデータ内容をリフレッシュし、リフレッシュ後にマスタサーバ11のレプリカログ11a〜11cを削除する。
【0022】
図2は、本発明のレプリケーションシステムで用いるレプリカログのテーブル構成を示す図である。
図2に示すように、レプリカログは、端末ID、変更モード、マスタテーブルレイアウト、変更時刻及びSEQで構成されるテーブル(このテーブルを以下では、レプリカログテーブルと称する)を備える。
【0023】
端末IDとは、変更されたレコードを参照するレプリカ端末を識別するための識別子である。変更モードとは、Insert(挿入)によるマスタデータの変更(Iと略す)、Update(更新)によるマスタデータの変更(Uと略す)、Delete(削除)によるマスタデータの変更(Dと略す)のいずれかを指す。この変更モードは、マスタサーバ11の変更モード判定手段としての機能によって判定され、マスタDB11Aの登録データ(マスタデータ)が、挿入、更新または削除のいずれの処理によって変更されたかによって決定される。
【0024】
マスタテーブルレイアウトとは、マスタDB11Aで変更されたデータ(変更分)を格納する領域である。この領域には、変更データの他に後述するマスタのプライマリキーも格納される。変更時刻とは、変更処理が行われた日付と時刻である。また、SEQとは、レプリカログテーブルにデータが出力される毎にインクリメントされ、過去のログ・レコードも含めて絶対に重複しないように時系列的に採番される番号(データ識別番号)である。
【0025】
このような構造を有するレプリカログ11a〜11cには、各レプリカ端末12〜14毎にマスタDB11Aの変更分が時系列的に格納される。このとき、「端末ID+マスタデータのプライマリキー」をプライマリとして変更されたレコードの最後の状態のみを格納する。
【0026】
本発明のレプリケーションシステムにおける変更処理を基本的変更処理と例外的変更処理に分けて説明する。この変更処理は、上述したレプリカログ11a〜11cを用いてレプリカDB12A〜14Aのデータ内容に挿入(Insert)、更新(Update)または削除(Delete)のいずれかを行う処理によって構成される。
【0027】
基本的変更処理は、レプリカログ11a〜11cのテーブル(レプリカログテーブル)の変更モードに従い、レプリカDB12A〜14Aの登録内容に対して、以下のI、UまたはDの変更処理を行う処理である。
I:マスタテーブルレイアウトの値でレプリカテーブルに挿入する。
U:マスタテーブルレイアウトの値でレプリカテーブルを更新する。
D:マスタテーブルのプライマリキーでレプリカテーブルを削除する。
【0028】
変更処理は、原則としてレプリカログテーブルの変更モードに従って処理されるが、マスタDB11AとレプリカDB12A〜14Aとのデータ内容の整合性を保持する為に、例外として下記の例外的変更処理を行う。
なお、例外的変更処理の説明では、マスタサーバ11とレプリカ端末12との間における処理を例として挙げるが、マスタサーバ11とレプリカ端末13との間、及び、マスタサーバ11とレプリカ端末14との間における処理も同様である。
【0029】
第1例外的変更処理
変更モードが”I”でもレプリカDB12A内に同一のプライマリキーのレコードが存在する場合は更新処理に切り替えて処理を行う。
第2例外的変更処理
変更モードが”U”でもレプリカDB12A内に同一のプライマリキーのレコードが存在しなければ挿入処理に切り替えて処理を行う。
【0030】
上述のような例外的変更処理は障害対策ではなく、定常的に発生する問題に対応するためのものである。
具体的には図3に示す以下のような例で発生する。
図3(a)は、第1例外的変更処理を行う場合におけるレプリカログテーブルの構成を示す図である。
【0031】
図3(a)において、「キーA」と示すものがプライマリキーである。
マスタサーバ11は、同一のプライマリキーのレコードに対して常に最新の変更分のレプリカログテーブルのデータ内容(ログ)しか残さない。このため、マスタサーバ11が▲1▼のレプリカログテーブルを抽出し、レプリカ端末12がレプリカログ11aを取り込まないうちに次の▲2▼のレプリカログテーブルを抽出した場合は、レプリカ端末12は▲1▼のレプリカログテーブルの内容をレプリカDB12Aに反映しないうちに▲2▼のレプリカログテーブルのデータ内容(ログ)によってリフレッシュされてしまい、▲1▼のレプリカログテーブルのデータ内容がレプリカログとして残らない。
【0032】
このとき、▲2▼のレプリカログテーブルに従って挿入処理を行うと、レプリカDB12A内には▲1▼のレプリカログテーブルによる削除処理が行われないまま(すなわち、削除処理が行われずにデータが残ったまま)のプライマリキーが「キーA」のレコードが存在しているので、挿入処理を行うことができず、一意制約でエラーとなってしまう。このため、このような場合はリフレッシュの変更モードを更新処理に切り替えて行う。これが第1例外的変更処理である。
【0033】
図3(b)は、第2例外的変更処理を行う場合におけるレプリカログテーブルの構成を示す図である。
上述したように、マスタサーバ11は、同一のプライマリキーのレコードに対して常に最新の変更分のレプリカログテーブルのデータ内容(ログ)しか残さない。このため、マスタサーバ11が▲1▼のレプリカログテーブルを抽出し、レプリカ端末12がレプリカログ11aを取り込まないうちに次の▲2▼のレプリカログテーブルを抽出した場合は、レプリカ端末12は▲1▼のレプリカログテーブルの内容をレプリカDB12Aに反映しないうちに▲2▼のレプリカログテーブルのデータ内容(ログ)によってリフレッシュされてしまい、▲1▼のレプリカログテーブルのデータ内容がレプリカログとして残らない。
【0034】
このとき、▲2▼のレプリカログテーブルのデータ内容(ログ)に従って更新処理を行うと、レプリカDB12Aには▲1▼のレプリカログテーブルによる挿入処理が行われないまま▲2▼のレプリカログテーブルにより更新処理が行われることになる。レプリカDB12A内にはプライマリキーが「キーA」のレコードは存在しないので、処理内容は0件の更新処理となってしまう。従って、このような場合は更新処理に代えて挿入処理を行うこととする。これが第2例外的変更処理である。
【0035】
図4は、本発明のレプリケーションシステムにおけるログ削除処理を行う場合におけるマスタDB側のレプリカログの構成を示す図である。
マスタDB11A内のログテーブルは、レプリカ端末12側におけるリフレッシュの完了後に削除される。ログテーブルの削除は、リフレッシュが終了したレプリカ端末12から削除要求を受けることによって行われる。これはマスタサーバ11の変更データ削除手段としての機能により実行される処理である。
基本的に、リフレッシュを行ったレプリカ端末12の端末IDのログテーブルを削除するが、端末IDのみで特定したログテーブルを削除するのではなく、「端末ID」と「SEQ」の双方を用いて特定したログテーブルを削除する。
【0036】
このように、「端末ID」と「SEQ」の双方を用いて削除処理を行い、最終的にリフレッシュが行われたログテーブルのSEQ以下のSEQを有するログテーブル(図4では▲1▼のログテーブル)のみを削除し、▲2▼のログテーブルは次回のリフレッシュ時にレプリカDB12Aに反映させることにより、リフレッシュの開始時点でマスタサーバ11側に▲1▼のログテーブルのみが存在し、リフレッシュの途中あるいはリフレッシュの完了からログテーブルの削除処理までの間に▲2▼のログテーブルが発生した場合に、リフレッシュの完了後に端末IDだけで特定したログテーブルを特定して削除処理を行ってしまうことにより、▲2▼のログテーブルのデータ内容(ログ)がレプリカDB12Aに反映されないまま▲2▼のログテーブルが削除され、マスタDB11AとレプリカDB12A〜14Aとのデータ内容に不整合が生じることを防止することができる。
【0037】
以上のような機能を有する本発明のレプリケーションシステムにおけるマスタサーバ側及びレプリカ端末側における処理手順は以下の通りである。
図5は、本発明のレプリケーションシステムにおけるマスタサーバ側における処理手順を示すフローチャートである。この処理手順は、本発明のレプリケーションシステムに用いるプログラムによって実行されるものである。
【0038】
図5に示すように、まず、Oracleのデータベーストリガ機能が起動することにより、マスタサーバ11における処理がスタートする。
ステップS1において、マスタDB11Aで変更されたデータ(変更分)の出力先を特定する端末IDを特定する。これはレプリカログテーブルの出力を要求してきたレプリカ端末(12〜14のうちのいずれか)の端末IDとなる。
ステップS2では、変更モードが削除処理(D)、挿入処理(I)または更新処理(U)のいずれであるかを判定する。これは、マスタDB11Aにおけるレプリカログ11a〜11cの変更モードに基づく判定となる。
【0039】
ステップS2において、削除処理(D)であると判定した場合は、フローはステップS3に進行し、レプリカログテーブルに削除処理を実行するためのデータ内容(ログ)をステップS1で特定した端末IDによって表されるレプリカ端末12〜14のいずれかに出力する。これでステップS3は終了する。
【0040】
ステップS2において、挿入処理(I)であると判定した場合は、フローはステップS4に進行し、レプリカDB12A内に同一のプライマリキーのレコードが存在するか否かを判定する。
ステップS4において、レプリカDB12A内に同一のプライマリキーのレコードが存在すると判定した場合は、フローはステップS5に進行し、レプリカログテーブルに挿入処理を実行するためのデータ内容(ログ)をステップS1で特定した端末IDによって表されるレプリカ端末12〜14のいずれかに出力する。これでステップS5は終了する。
【0041】
一方、ステップS4において、レプリカDB12A内に同一のプライマリキーのレコードが存在しないと判定した場合は、フローは後述するステップS7に進行し、更新処理を行う。こうして第1例外的変更処理が行われる。
【0042】
ステップS2において、更新処理(U)であると判定した場合は、フローはステップS6に進行し、レプリカDB12A内に同一のプライマリキーのレコードが存在するか否かを判定する。
ステップS6において、レプリカDB12A内に同一のプライマリキーのレコードが存在すると判定した場合は、フローはステップS7に進行し、レプリカログテーブルに更新処理を実行するためのデータ内容(ログ)をステップS1で特定した端末IDによって表されるレプリカ端末12〜14のいずれかに出力する。これでステップS7は終了する。
【0043】
一方、ステップS6において、レプリカDB12A内に同一のプライマリキーのレコードが存在しないと判定した場合は、フローは前述したステップS5に進行し、挿入処理を行う。こうして第2例外的変更処理が行われる。
以上でマスタサーバ11側における処理は終了する。
【0044】
図6は、本発明のレプリケーションシステムにおけるレプリカ端末側における処理手順を示すフローチャートである。この処理手順は、本発明のレプリケーションシステムに用いるプログラムによって実行されるものである。
【0045】
図6において、レプリカ端末側で予め設定された時間、または、任意の時間において起動の指令を受けた際にレプリカ端末側における処理がスタートする。
まず、ステップS11において、マスタサーバ11にアクセスし、マスタDB11A内に自端末の端末IDを有するレプリカログテーブルが存在するか否かを判定する。
【0046】
自端末の端末IDを有するレプリカログテーブルが存在すると判定した場合は、フローはステップS12に進行し、そのレプリカログテーブルに含まれる変更モードが削除処理(D)、挿入処理(I)または更新処理(U)のいずれであるかを判定する。
【0047】
ステップS12において、変更モードが削除処理(D)であると判定した場合は、フローはステップS13に進行し、自端末のレプリカDB内のログテーブルのレコードを削除する。これにより、削除処理によるリフレッシュが完了する。ログテーブルのレコードの削除処理が終了すると、フローはステップS16に進行し、マスタサーバ11にアクセスし、この処理に対応するレプリカログを削除する。
ステップS16が終了すると、フローが終了する。
【0048】
ステップS12において、変更モードが挿入処理(I)であると判定した場合は、フローはステップS14に進行し、自端末のレプリカDB内のログテーブルのレコードを挿入する。
ログテーブルのレコードの挿入処理が終了すると、フローはステップS16に進行し、マスタサーバ11にアクセスし、この処理に対応するレプリカログを削除する。
ステップS16が終了すると、フローが終了する。
【0049】
ステップS12において、変更モードが更新処理(U)であると判定した場合は、フローはステップS15に進行し、自端末のレプリカDB内のログテーブルのレコードを更新する。
ログテーブルのレコードの更新処理が終了すると、フローはステップS16に進行し、マスタサーバ11にアクセスし、この処理に対応するレプリカログを削除する。
ステップS16が終了すると、フローが終了する。
【0050】
なお、以上の説明では、本発明のレプリケーションシステム及びレプリケーションシステム用プログラムをOracleのRBDMSに適用した場合について説明したが、本発明のレプリケーションシステム及びレプリケーションシステム用プログラムは、Oracle以外のRBDMSにも適用できるものである。
【0051】
以上、本発明のレプリケーションシステム及びこれに用いるプログラムによれば、レプリカ端末毎に複雑なレプリカ抽出条件を設定することができる。このため、各レプリカ端末は、自端末のレプリカログのみを取り込めばよいので、従来のように不要なデータまで含まれたログを読み込む必要が無くなり、リフレッシュ時間を大幅に短縮できる。
【0052】
また、変更データをマスタサーバ側で削除する変更データ削除手段を備え、レプリカ端末毎にレプリカログを作成し、各レプリカ端末がリフレッシュを行えば、そのレプリカログを削除するので、従来のようにリフレッシュを行わない端末が一つだけあるために長期にわたって膨大な容量を有するログをメインサーバ側で保持する必要が無くなり、メインサーバ側におけるディスク容量を節約できる。また、マスタサーバに対する最後の変更内容のみが出力されることによってもディスク容量を節約できる。
【0053】
また、各端末ID及びデータ識別番号で特定した変更データを削除するので、マスタDB11AとレプリカDB12A〜14Aとのデータ内容に不整合が生じることを防止することができる。
【0054】
また、マスタデータベースへの登録データの変更が削除処理、挿入処理または更新処理のいずれの処理によって行われたかに基づき、レプリカデータベースへの変更データの登録処理方法である変更モードを判定する変更モード判定手段をさらに備えるので、マスタDBとレプリカDB間におけるデータの不整合を抑制したレプリケーションシステムを提供することができる。
【0055】
また、前記変更モード判定手段は、当該変更データの変更モードが挿入処理であると判定した場合は、レプリカデータベース内に同一のキーを有するデータがあるか否かを判定し、同一キーのデータがないと判定した場合は変更モードを挿入処理とし、同一キーのデータがあると判定した場合は、変更モードを更新処理とするので、マスタDBとレプリカDB間におけるデータの不整合を抑制したレプリケーションシステムを提供することができる。
【0056】
また、前記変更モード判定手段は、当該変更データの変更モードが更新処理であると判定した場合は、レプリカデータベース内に同一のキーを有するデータがあるか否かを判定し、同一キーのデータがあると判定した場合は変更モードを更新処理とし、同一キーのデータがないと判定した場合は、変更モードを挿入処理とするので、リフレッシュが行われる前にレプリカログの内容が変わった場合でも、マスタDBとレプリカDB間におけるデータの不整合を抑制したレプリケーションシステムを提供することができる。
【0057】
また、本発明のレプリケーションシステム用プログラムは、マスタデータベースが接続されたマスタサーバと、このマスタサーバにネットワークを通じて接続され、マスタデータベースの登録データと同一のデータを登録する複数のレプリカデータベースが接続されたレプリカ端末とを備える関係データベースシステムに用いられるレプリケーションシステム用プログラムであって、コンピュータに、マスタデータベースの登録データが変更されると、各レプリカデータベースに登録するデータをマスタデータベースから抽出するための抽出条件を記憶保持する抽出条件データベースに記憶保持された抽出条件に基づき、各レプリカデータベースに登録すべき変更データを抽出する抽出手段、及び、各レプリカ端末からの要求に応じ、前記変更データを各レプリカ端末に伝送する変更データ伝送手段として機能させるためのプログラムであるので、レプリカ端末毎に複雑なレプリカ抽出条件を設定することができ、また、各レプリカ端末は、自端末のレプリカログのみを取り込めばよいので、従来のように不要なデータまで含まれたログを読み込む必要が無くなり、リフレッシュ時間を大幅に短縮できるレプリケーションシステム用プログラムを提供することができる。
【0058】
【発明の効果】
本発明のレプリケーションシステムは、マスタデータベースが接続されたマスタサーバと、このマスタサーバにネットワークを通じて接続され、マスタデータベースの登録データと同一のデータを登録する複数のレプリカデータベースが接続されたレプリカ端末とを備える関係データベースシステムに用いられるレプリケーションシステムであって、各レプリカデータベースに登録するデータをマスタデータベースから抽出するための抽出条件を記憶保持する抽出条件データベースと、マスタデータベースの登録データが変更されると、前記抽出条件データベースに記憶保持された抽出条件に基づき、各レプリカデータベースに登録すべき変更データを抽出する抽出手段と、各レプリカ端末からの要求に応じ、前記変更データを各レプリカ端末に伝送する変更データ伝送手段とを備えるので、レプリカ端末毎に複雑なレプリカ抽出条件を設定することができる。このため、各レプリカ端末は、自端末のレプリカログのみを取り込めばよいので、従来のように不要なデータまで含まれたログを読み込む必要が無くなり、リフレッシュ時間を大幅に短縮できる。
【図面の簡単な説明】
【図1】本発明のレプリケーションシステムのハードウェア構成及びデータの流れを概略的に示す図である。
【図2】本発明のレプリケーションシステムで用いるレプリカログのテーブル構成を示す図である。
【図3】本発明のレプリカエーションシステムにおける第1例外的変更処理及び第2例外的変更処理を行う場合におけるレプリカログテーブルの構成を示す図である。
【図4】本発明のレプリケーションシステムにおけるログ削除処理を行う場合におけるレプリカDB内のログテーブルの構成を示す図である。
【図5】本発明のレプリケーションシステムにおけるマスタサーバ側における処理手順を示すフローチャートである。
【図6】本発明のレプリケーションシステムにおけるレプリカ端末側における処理手順を示すフローチャートである。
【図7】従来のレプリケーションシステムのハードウェア構成及びデータの流れを概略的に示す図である。
【符号の説明】
11 マスタサーバ、11A マスタDB、11a、11b、11c レプリカログ、11B 抽出条件DB、12、13、14 レプリカ端末、12A、13A、14A レプリカDB。
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a replication system and a program for a replication system used for an RDBMS (Relational Database System).
[0002]
[Prior art]
FIG. 7 is a diagram schematically showing a hardware configuration and a data flow of a conventional replication system. Here, a replication function (snapshot) used in a replication system of Oracle (registered trademark) which is a product of the RDBMS will be described.
[0003]
As shown in FIG. 7, the master server 1 and the snapshot terminals 2 to 4 are connected by a network (not shown). A master Data Base 1A (hereinafter abbreviated as DB) and snapshot DBs 2A to 4A are arranged in the master server 1 and the snapshot terminals 2 to 4, respectively. The contents are transmitted to the snapshot terminals 2 to 4, and the registered contents of the snapshot DBs 2A to 4A are changed.
[0004]
Specifically, the master server 1 generates a snapshot log 1a composed of the changed data. The snapshot log 1a is transmitted to each of the snapshot terminals 2 to 4 as snapshots 2a to 4a (2a, 3a, 4a).
Each time the master server 1 changes the data content of the master DB 1A, it outputs the changed data as a snapshot log 1a. The snapshot terminals 2 to 4 periodically read the snapshot log 1a of the master server 1 and change (refresh) the snapshots 2a to 4a (for example, see Patent Document 1).
[0005]
[Patent Document 1]
JP-A-2002-116939 (pages 3 to 6, FIG. 1)
[0006]
[Problems to be solved by the invention]
However, the conventional replication system has the following problems.
Each of the snapshot terminals 2 to 4 often has different data. In such a case, the extraction conditions for the snapshots 2a to 4a can be set to some extent, but complicated extraction conditions cannot be set. For this reason, the snapshots 2a to 4a are simple copies of the master DB 1A.
[0007]
Further, as described above, since one type of the snapshot log 1a is provided for each master server, each of the snapshot terminals 2 to 4 has to capture unnecessary data, and the refresh time is long. This was remarkable especially when a low-speed line was used.
[0008]
The snapshot log 1a is not deleted unless refresh is performed on all the snapshot terminals 2 to 4. For this reason, if there are the snapshot terminals 2 to 4 that do not periodically refresh, the period during which the snapshot log 1 a of the master server 1 is held becomes longer, and the disk capacity of the master server 1 is reduced.
[0009]
The present invention has been made in order to solve the above-described problems. In particular, by using a unique replication function without using the replication function of Oracle, it is possible to set complicated extraction conditions and internal processing. It is an object of the present invention to provide a replication system and a program for a replication system which enables customization of the structure and has a light load on the disk capacity of the master server.
[0010]
[Means for Solving the Problems]
The replication system of the present invention includes a master server connected to a master database, and a replica terminal connected to the master server through a network and connected to a plurality of replica databases that register the same data as the registered data of the master database. An extraction condition database that stores and retains extraction conditions for extracting data to be registered in each replica database from the master database, and a registered data of the master database is changed. Extracting means for extracting change data to be registered in each replica database based on the extraction conditions stored and held in the extraction condition database; and transmitting the change data to each replica terminal in response to a request from each replica terminal. And a changing data transmission means for transmitting to.
[0011]
Further, the information processing apparatus further includes a change data deletion unit that deletes the change data on the master server side when receiving a process of deleting the change data extracted by the extraction unit from the replica terminal.
[0012]
Each change data is provided with a terminal ID and a data identification number, and the change data deletion means deletes the change data specified by the terminal ID and the data identification number.
[0013]
Further, a change mode determination for determining a change mode, which is a method of registering change data in the replica database, based on whether the change of the registration data in the master database is performed by a deletion process, an insertion process, or an update process. Means are further provided.
[0014]
Further, when the change mode determination means determines that the change mode of the change data is the insertion process, the change mode determination means determines whether there is data having the same key in the replica database, and determines whether the data of the same key exists. When it is determined that there is no data, the change mode is set as the insertion process, and when it is determined that there is data of the same key, the change mode is set as the update process.
[0015]
Further, when the change mode determination means determines that the change mode of the change data is an update process, the change mode determination means determines whether there is data having the same key in the replica database, and determines whether the data of the same key exists. If it is determined that the data exists, the change mode is set to the update process. If it is determined that there is no data of the same key, the change mode is set to the insert process.
[0016]
A replication system program according to the present invention includes a master server connected to a master database, and a replica terminal connected to the master server via a network and connected to a plurality of replica databases that register the same data as the registered data of the master database. And a computer for storing extraction conditions for extracting data to be registered in each replica database from the master database when registration data of the master database is changed. Extraction means for extracting change data to be registered in each replica database based on the extraction conditions stored in the held extraction condition database, and the change data in response to a request from each replica terminal. Which is a program to function as a changing data transmission means for transmitting to each replica terminal.
[0017]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, a preferred embodiment in which a replication system and a program for a replication system according to the present invention are applied to an Oracle RDBMS will be described in detail with reference to the drawings.
FIG. 1 is a diagram schematically showing a hardware configuration and a data flow of a replication system according to the present invention.
[0018]
As shown in FIG. 1, the master server 11 is connected to replica terminals 12 to 14 via a network (not shown). The master server 11 includes a master DB 11A and an extraction condition DB 11B, and each of the replica terminals 12 to 14 includes replica DBs 12A to 14A.
Although the data registered in each of the replica DBs 12A to 14A is different, the same data as all the data registered in the replica DBs 12A to 14A is registered in the master DB 11A.
[0019]
Further, in the extraction condition DB 11B, extraction conditions for extracting data registered in each of the replica DBs 12A to 14A from registered data in the master DB 11A are registered in advance. This extraction condition is constituted by a combination of a plurality of search conditions (SELECT sentences) and a decision logic such as a conditional sentence.
The data contents of the replica DBs 12A to 14A are changed according to the change of the data contents of the master DB 11A based on the respective extraction conditions ("change" of the registered data of the replica DB is called "refresh").
[0020]
In the replication system of the present invention, when the data content of the master DB 11A is changed, when the registered content of the master DB 11A is changed, the master server 11 uses the database trigger function to extract each replica terminal 12 from the extraction condition DB 11B. 14 are extracted, and changed data is extracted from the master DB 11A based on the read extraction conditions to generate replica logs 11a to 11c as changed data. This extraction / generation processing is performed by the function of the master server 11 as an extraction unit.
Each of the replica logs 11a to 11c has a terminal ID which is an identifier corresponding to each of the replica terminals 12 to 14.
[0021]
The master server 11 transmits replica logs 11a to 11c in response to requests from the replica terminals 12 to 14. This is executed by the function of the master server 11 as a change data transmitting unit. The replica terminals 12 to 14 that have taken in the replica logs 11a to 11c refresh the data contents of the replica DBs 12A to 14A at preset timings, and delete the replica logs 11a to 11c of the master server 11 after the refresh.
[0022]
FIG. 2 is a diagram showing a table configuration of a replica log used in the replication system of the present invention.
As shown in FIG. 2, the replica log includes a table including a terminal ID, a change mode, a master table layout, a change time, and an SEQ (hereinafter, this table is referred to as a replica log table).
[0023]
The terminal ID is an identifier for identifying a replica terminal that refers to the changed record. The change mode refers to a change of master data (abbreviated as I) by Insert (insertion), a change of master data (abbreviated as U) by Update (update), and a change of master data (abbreviated as D) by Delete (deletion). Point to either. The change mode is determined by the function of the master server 11 as a change mode determining unit, and is determined by whether the registration data (master data) of the master DB 11A has been changed by insertion, update, or deletion.
[0024]
The master table layout is an area for storing data (changes) changed in the master DB 11A. In this area, in addition to the change data, a master primary key to be described later is also stored. The change time is the date and time when the change process was performed. The SEQ is a number (data identification number) that is incremented every time data is output to the replica log table and is numbered in chronological order so that duplicate data including past log records are not duplicated. .
[0025]
In the replica logs 11a to 11c having such a structure, the changes of the master DB 11A are stored in time series for each of the replica terminals 12 to 14. At this time, only the last state of the record changed with “terminal ID + primary key of master data” as primary is stored.
[0026]
The change processing in the replication system of the present invention will be described separately for basic change processing and exceptional change processing. This change processing is configured by processing to insert (Insert), update (Update) or delete (Delete) the data contents of the replica DBs 12A to 14A using the above-described replica logs 11a to 11c.
[0027]
The basic change process is a process of performing the following I, U, or D change process on the registered contents of the replica DBs 12A to 14A in accordance with the change mode of the tables (replica log tables) of the replica logs 11a to 11c.
I: Insert into the replica table with the value of the master table layout.
U: Update the replica table with the values of the master table layout.
D: Delete the replica table using the primary key of the master table.
[0028]
The change processing is performed in principle according to the change mode of the replica log table, but the following exceptional change processing is performed as an exception in order to maintain consistency of the data contents of the master DB 11A and the replica DBs 12A to 14A.
In the description of the exceptional change process, a process between the master server 11 and the replica terminal 12 will be described as an example, but a process between the master server 11 and the replica terminal 13 and between the master server 11 and the replica terminal 14 will be described. The same applies to the processing between the two.
[0029]
First exceptional change processing
Even if the change mode is "I", if a record with the same primary key exists in the replica DB 12A, the processing is switched to the update processing and the processing is performed.
Second exceptional change process
Even if the change mode is “U”, if there is no record of the same primary key in the replica DB 12A, the processing is switched to the insertion processing.
[0030]
The exceptional change processing as described above is not a countermeasure for a failure, but is for dealing with a problem that constantly occurs.
Specifically, it occurs in the following example shown in FIG.
FIG. 3A is a diagram illustrating the configuration of the replica log table when performing the first exceptional change process.
[0031]
In FIG. 3A, what is indicated as "key A" is a primary key.
The master server 11 always leaves only the data contents (log) of the replica log table for the latest change for the record of the same primary key. Therefore, if the master server 11 extracts the replica log table of (1) and the replica terminal 12 extracts the next replica log table of (2) before taking in the replica log 11a, the replica terminal 12 returns to (1). Before the content of the replica log table of 1) is reflected in the replica DB 12A, the data is refreshed by the data content (log) of the replica log table of 2), and the data content of the replica log table of 1) remains as a replica log. Absent.
[0032]
At this time, if the insertion processing is performed according to the replica log table of (2), the deletion processing by the replica log table of (1) is not performed in the replica DB 12A (that is, the data remains without being deleted. Since there is a record whose primary key is “key A”, the insertion process cannot be performed and an error occurs due to the unique constraint. Therefore, in such a case, the refresh change mode is switched to the update process. This is the first exceptional change process.
[0033]
FIG. 3B is a diagram illustrating the configuration of the replica log table when the second exceptional change process is performed.
As described above, the master server 11 always keeps only the data contents (log) of the replica log table for the latest change for the record of the same primary key. Therefore, if the master server 11 extracts the replica log table of (1) and the replica terminal 12 extracts the next replica log table of (2) before taking in the replica log 11a, the replica terminal 12 returns to (1). Before the content of the replica log table of 1) is reflected in the replica DB 12A, the data is refreshed by the data content (log) of the replica log table of 2), and the data content of the replica log table of 1) remains as a replica log. Absent.
[0034]
At this time, when the update process is performed in accordance with the data content (log) of the replica log table of (2), the replica DB 12A uses the replica log table of (2) without performing the insert process by the replica log table of (1). Update processing will be performed. Since there is no record having the primary key “Key A” in the replica DB 12A, the processing content is 0 update processing. Therefore, in such a case, insertion processing is performed instead of update processing. This is the second exceptional change process.
[0035]
FIG. 4 is a diagram showing the configuration of a replica log on the master DB side when performing log deletion processing in the replication system of the present invention.
The log table in the master DB 11A is deleted after the refresh on the replica terminal 12 side is completed. The deletion of the log table is performed by receiving a deletion request from the replica terminal 12 whose refresh has been completed. This is a process executed by the function of the master server 11 as a change data deleting unit.
Basically, the log table of the terminal ID of the replica terminal 12 that has been refreshed is deleted. However, instead of deleting the log table specified only by the terminal ID, using both the “terminal ID” and “SEQ” Delete the specified log table.
[0036]
As described above, the deletion process is performed using both the “terminal ID” and the “SEQ”, and the log table having the SEQ equal to or less than the SEQ of the log table finally refreshed (in FIG. 4, the log of (1)). Table), and the log table of (2) is reflected in the replica DB 12A at the next refresh, so that only the log table of (1) exists on the master server 11 side at the start of the refresh, and the middle of the refresh Alternatively, if the log table of (2) occurs between the completion of the refresh and the log table deletion processing, the log table specified by only the terminal ID is specified and the deletion processing is performed after the completion of the refresh. The log of (2) without reflecting the data content (log) of the log table of (2) in the replica DB 12A Buru is deleted, it is possible to prevent the inconsistencies in the data content of the master DB11A and Replica DB12A~14A.
[0037]
The processing procedure on the master server side and the replica terminal side in the replication system of the present invention having the above functions is as follows.
FIG. 5 is a flowchart showing a processing procedure on the master server side in the replication system of the present invention. This processing procedure is executed by a program used for the replication system of the present invention.
[0038]
As shown in FIG. 5, first, when the database trigger function of Oracle is activated, the processing in the master server 11 is started.
In step S1, a terminal ID for specifying an output destination of data (change) changed in the master DB 11A is specified. This is the terminal ID of the replica terminal (any of 12 to 14) that has requested the output of the replica log table.
In step S2, it is determined whether the change mode is a delete process (D), an insert process (I), or an update process (U). This is a determination based on the change mode of the replica logs 11a to 11c in the master DB 11A.
[0039]
If it is determined in step S2 that the process is the deletion process (D), the flow proceeds to step S3, and the data content (log) for executing the deletion process in the replica log table is determined by the terminal ID specified in step S1. It outputs to any of the represented replica terminals 12-14. This ends step S3.
[0040]
If it is determined in step S2 that the processing is the insertion processing (I), the flow proceeds to step S4, and it is determined whether or not a record of the same primary key exists in the replica DB 12A.
If it is determined in step S4 that there is a record with the same primary key in the replica DB 12A, the flow proceeds to step S5, and the data content (log) for executing the insertion process in the replica log table is stored in step S1. Output to any of the replica terminals 12 to 14 represented by the specified terminal ID. This ends step S5.
[0041]
On the other hand, if it is determined in step S4 that there is no record with the same primary key in the replica DB 12A, the flow proceeds to step S7 described below to perform an update process. Thus, the first exceptional change processing is performed.
[0042]
If it is determined in step S2 that the process is an update process (U), the flow proceeds to step S6, and determines whether or not a record with the same primary key exists in the replica DB 12A.
If it is determined in step S6 that there is a record with the same primary key in the replica DB 12A, the flow proceeds to step S7, where the data contents (log) for executing the update process in the replica log table are stored in step S1. Output to any of the replica terminals 12 to 14 represented by the specified terminal ID. This ends step S7.
[0043]
On the other hand, if it is determined in step S6 that no record with the same primary key exists in the replica DB 12A, the flow proceeds to step S5 described above, and insert processing is performed. Thus, the second exceptional change process is performed.
Thus, the processing on the master server 11 side ends.
[0044]
FIG. 6 is a flowchart showing a processing procedure on the replica terminal side in the replication system of the present invention. This processing procedure is executed by a program used for the replication system of the present invention.
[0045]
In FIG. 6, when a start command is received at a preset time or at an arbitrary time on the replica terminal side, processing on the replica terminal side starts.
First, in step S11, the master server 11 is accessed, and it is determined whether a replica log table having the terminal ID of the own terminal exists in the master DB 11A.
[0046]
If it is determined that there is a replica log table having the terminal ID of the own terminal, the flow proceeds to step S12, and the change mode included in the replica log table is the deletion process (D), the insertion process (I), or the update process. (U) is determined.
[0047]
If it is determined in step S12 that the change mode is the deletion process (D), the flow proceeds to step S13, and the record of the log table in the replica DB of the terminal is deleted. Thereby, the refresh by the deletion process is completed. When the process of deleting the records in the log table ends, the flow proceeds to step S16, accesses the master server 11, and deletes the replica log corresponding to this process.
When step S16 ends, the flow ends.
[0048]
If it is determined in step S12 that the change mode is the insertion process (I), the flow proceeds to step S14, where a record of the log table in the replica DB of the terminal is inserted.
When the process of inserting the record in the log table ends, the flow proceeds to step S16, accesses the master server 11, and deletes the replica log corresponding to this process.
When step S16 ends, the flow ends.
[0049]
If it is determined in step S12 that the change mode is the update process (U), the flow proceeds to step S15, and the record of the log table in the replica DB of the terminal is updated.
When the update processing of the record in the log table ends, the flow proceeds to step S16, accesses the master server 11, and deletes the replica log corresponding to this processing.
When step S16 ends, the flow ends.
[0050]
In the above description, a case has been described in which the replication system and the replication system program of the present invention are applied to Oracle's RBDMS. However, the replication system and the replication system program of the present invention can also be applied to RBDMS other than Oracle. Things.
[0051]
As described above, according to the replication system of the present invention and the program used therein, it is possible to set complicated replica extraction conditions for each replica terminal. For this reason, since each replica terminal only needs to take in the replica log of its own terminal, there is no need to read a log including unnecessary data as in the related art, and the refresh time can be greatly reduced.
[0052]
In addition, a change data deletion unit for deleting change data on the master server side is provided, a replica log is created for each replica terminal, and when each replica terminal refreshes, the replica log is deleted. Since there is only one terminal that does not perform the log processing, it is not necessary to hold a log having a huge capacity for a long time on the main server side, and the disk capacity on the main server side can be saved. Further, the disk capacity can be saved also by outputting only the last change content to the master server.
[0053]
Further, since the change data specified by each terminal ID and data identification number is deleted, it is possible to prevent inconsistency in the data contents between the master DB 11A and the replica DBs 12A to 14A.
[0054]
Further, a change mode determination for determining a change mode, which is a method of registering change data in the replica database, based on whether the change of the registration data in the master database is performed by a deletion process, an insertion process, or an update process. Since the apparatus further includes means, it is possible to provide a replication system in which data inconsistency between the master DB and the replica DB is suppressed.
[0055]
Further, when the change mode determination means determines that the change mode of the change data is the insertion process, the change mode determination means determines whether there is data having the same key in the replica database, and determines whether the data of the same key exists. If it is determined that there is no data, the change mode is set to the insertion processing, and if it is determined that there is data of the same key, the change mode is set to the update processing. Therefore, a replication system that suppresses data inconsistency between the master DB and the replica DB. Can be provided.
[0056]
Further, when the change mode determination means determines that the change mode of the change data is an update process, the change mode determination means determines whether there is data having the same key in the replica database, and determines whether the data of the same key exists. If it is determined that there is, the change mode is set as the update process, and if it is determined that there is no data of the same key, the change mode is set as the insert process, so even if the content of the replica log changes before the refresh is performed, It is possible to provide a replication system that suppresses data inconsistency between the master DB and the replica DB.
[0057]
The program for a replication system according to the present invention includes a master server connected to a master database, a plurality of replica databases connected to the master server via a network, and registering the same data as the registered data of the master database. A program for a replication system used in a relational database system having a replica terminal, wherein, when registration data of a master database is changed in a computer, extraction conditions for extracting data to be registered in each replica database from the master database Extracting means for extracting change data to be registered in each replica database based on the extraction conditions stored in the extraction condition database storing and holding the data, and changing the data in response to a request from each replica terminal. Since this is a program for functioning as a modified data transmission means for transmitting data to each replica terminal, complex replica extraction conditions can be set for each replica terminal, and each replica terminal can store its own replica log. Since it is only necessary to capture only the data, it is not necessary to read a log including unnecessary data unlike the related art, and it is possible to provide a replication system program that can greatly reduce the refresh time.
[0058]
【The invention's effect】
The replication system of the present invention includes a master server connected to a master database, and a replica terminal connected to the master server through a network and connected to a plurality of replica databases that register the same data as the registered data of the master database. An extraction condition database that stores and retains extraction conditions for extracting data to be registered in each replica database from the master database, and a registered data of the master database is changed. Extracting means for extracting change data to be registered in each replica database based on the extraction conditions stored and held in the extraction condition database; and transmitting the change data to each replica terminal in response to a request from each replica terminal. Because and a changing data transmission means for transmitting, it is possible to set up complex replica extraction condition for each replica terminal. For this reason, since each replica terminal only needs to take in the replica log of its own terminal, there is no need to read a log including unnecessary data as in the related art, and the refresh time can be greatly reduced.
[Brief description of the drawings]
FIG. 1 is a diagram schematically showing a hardware configuration and a data flow of a replication system according to the present invention.
FIG. 2 is a diagram showing a table configuration of a replica log used in the replication system of the present invention.
FIG. 3 is a diagram illustrating a configuration of a replica log table when performing a first exceptional change process and a second exceptional change process in the replication system of the present invention.
FIG. 4 is a diagram showing a configuration of a log table in a replica DB when performing log deletion processing in the replication system of the present invention.
FIG. 5 is a flowchart showing a processing procedure on the master server side in the replication system of the present invention.
FIG. 6 is a flowchart showing a processing procedure on the replica terminal side in the replication system of the present invention.
FIG. 7 is a diagram schematically showing a hardware configuration and a data flow of a conventional replication system.
[Explanation of symbols]
11 master server, 11A master DB, 11a, 11b, 11c replica log, 11B extraction condition DB, 12, 13, 14 replica terminal, 12A, 13A, 14A replica DB.

Claims (7)

マスタデータベースが接続されたマスタサーバと、このマスタサーバにネットワークを通じて接続され、マスタデータベースの登録データと同一のデータを登録する複数のレプリカデータベースが接続されたレプリカ端末とを備える関係データベースシステムに用いられるレプリケーションシステムであって、
各レプリカデータベースに登録するデータをマスタデータベースから抽出するための抽出条件を記憶保持する抽出条件データベースと、
マスタデータベースの登録データが変更されると、前記抽出条件データベースに記憶保持された抽出条件に基づき、各レプリカデータベースに登録すべき変更データを抽出する抽出手段と、
各レプリカ端末からの要求に応じ、前記変更データを各レプリカ端末に伝送する変更データ伝送手段とを備えるレプリケーションシステム。
Used in a relational database system comprising a master server to which a master database is connected, and a replica terminal connected to the master server through a network and connected to a plurality of replica databases for registering the same data as the registration data of the master database. A replication system,
An extraction condition database that stores and retains extraction conditions for extracting data to be registered in each replica database from the master database;
When registration data of the master database is changed, extraction means for extracting change data to be registered in each replica database based on the extraction conditions stored in the extraction condition database,
A replication system comprising: a change data transmitting unit that transmits the change data to each replica terminal in response to a request from each replica terminal.
前記抽出手段によって抽出された変更データの削除処理をレプリカ端末から受けると、当該変更データをマスタサーバ側で削除する変更データ削除手段をさらに備えることを特徴とする請求項1に記載のレプリケーションシステム。2. The replication system according to claim 1, further comprising a change data deletion unit that deletes the change data on the master server side when receiving a deletion process of the change data extracted by the extraction unit from the replica terminal. 各変更データには端末ID及びデータ識別番号が付されており、前記変更データ削除手段は、端末ID及びデータ識別番号で特定した変更データを削除することを特徴とする請求項2に記載のレプリケーションシステム。3. The replication according to claim 2, wherein each change data is provided with a terminal ID and a data identification number, and the change data deletion unit deletes the change data specified by the terminal ID and the data identification number. system. マスタデータベースへの登録データの変更が削除処理、挿入処理または更新処理のいずれの処理によって行われたかに基づき、レプリカデータベースへの変更データの登録処理方法である変更モードを判定する変更モード判定手段をさらに備えることを特徴とする請求項1ないし3のいずれか一項に記載のレプリケーションシステム。A change mode determining unit that determines a change mode, which is a method of registering change data in the replica database, based on whether the change of the registration data in the master database is performed by a deletion process, an insertion process, or an update process. The replication system according to any one of claims 1 to 3, further comprising: 前記変更モード判定手段は、当該変更データの変更モードが挿入処理であると判定した場合は、レプリカデータベース内に同一のキーを有するデータがあるか否かを判定し、同一キーのデータがないと判定した場合は変更モードを挿入処理とし、同一キーのデータがあると判定した場合は、変更モードを更新処理とすることを特徴とする請求項4に記載のレプリケーションシステム。When the change mode determination unit determines that the change mode of the change data is the insertion process, the change mode determination unit determines whether there is data having the same key in the replica database. 5. The replication system according to claim 4, wherein when it is determined, the change mode is an insertion process, and when it is determined that there is data of the same key, the change mode is an update process. 前記変更モード判定手段は、当該変更データの変更モードが更新処理であると判定した場合は、レプリカデータベース内に同一のキーを有するデータがあるか否かを判定し、同一キーのデータがあると判定した場合は変更モードを更新処理とし、同一キーのデータがないと判定した場合は、変更モードを挿入処理とすることを特徴とする請求項4に記載のレプリケーションシステム。When the change mode determination unit determines that the change mode of the change data is the update process, the change mode determination unit determines whether there is data having the same key in the replica database. 5. The replication system according to claim 4, wherein when it is determined that the change mode is the update processing, and when it is determined that there is no data of the same key, the change mode is the insertion processing. マスタデータベースが接続されたマスタサーバと、このマスタサーバにネットワークを通じて接続され、マスタデータベースの登録データと同一のデータを登録する複数のレプリカデータベースが接続されたレプリカ端末とを備える関係データベースシステムに用いられるレプリケーションシステム用プログラムであって、コンピュータに、
マスタデータベースの登録データが変更されると、各レプリカデータベースに登録するデータをマスタデータベースから抽出するための抽出条件を記憶保持する抽出条件データベースに記憶保持された抽出条件に基づき、各レプリカデータベースに登録すべき変更データを抽出する抽出手段、及び、
各レプリカ端末からの要求に応じ、前記変更データを各レプリカ端末に伝送する変更データ伝送手段
として機能させるためのレプリケーションシステム用プログラム。
Used in a relational database system comprising a master server to which a master database is connected, and a replica terminal connected to the master server through a network and connected to a plurality of replica databases for registering the same data as the registration data of the master database. A program for a replication system, wherein a computer
When the registration data in the master database is changed, the extraction conditions for extracting the data to be registered in each replica database from the master database are stored and retained. The extraction conditions are registered in each replica database based on the extraction conditions stored in the database. Extraction means for extracting change data to be provided; and
A program for a replication system for functioning as change data transmission means for transmitting the change data to each replica terminal in response to a request from each replica terminal.
JP2003095662A 2003-03-31 2003-03-31 Replication system and program therefor Pending JP2004302919A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003095662A JP2004302919A (en) 2003-03-31 2003-03-31 Replication system and program therefor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003095662A JP2004302919A (en) 2003-03-31 2003-03-31 Replication system and program therefor

Publications (1)

Publication Number Publication Date
JP2004302919A true JP2004302919A (en) 2004-10-28

Family

ID=33407938

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003095662A Pending JP2004302919A (en) 2003-03-31 2003-03-31 Replication system and program therefor

Country Status (1)

Country Link
JP (1) JP2004302919A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100587695C (en) * 2006-08-29 2010-02-03 国际商业机器公司 Method for replicating and synchronizing a plurality of data sets using master data set
WO2021126586A1 (en) * 2019-12-16 2021-06-24 Stripe, Inc. Global heterogeneous data mirroring

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100587695C (en) * 2006-08-29 2010-02-03 国际商业机器公司 Method for replicating and synchronizing a plurality of data sets using master data set
WO2021126586A1 (en) * 2019-12-16 2021-06-24 Stripe, Inc. Global heterogeneous data mirroring
US11755228B1 (en) 2019-12-16 2023-09-12 Stripe, Inc. Global heterogeneous data mirroring

Similar Documents

Publication Publication Date Title
CA3121919C (en) System and method for augmenting database applications with blockchain technology
JP4880668B2 (en) Apparatus and method for identifying asynchronous data in a redundant data store and for resynchronizing it
US11841844B2 (en) Index update pipeline
US7383293B2 (en) Database backup system using data and user-defined routines replicators for maintaining a copy of database on a secondary server
US7702640B1 (en) Stratified unbalanced trees for indexing of data items within a computer system
US9411866B2 (en) Replication mechanisms for database environments
EP1462960A2 (en) Consistency unit replication in application-defined systems
CN110249321A (en) For the system and method that capture change data use from distributed data source for heterogeneous target
US20090210429A1 (en) System and method for asynchronous update of indexes in a distributed database
US10754854B2 (en) Consistent query of local indexes
US20090012932A1 (en) Method and System For Data Storage And Management
US20150347250A1 (en) Database management system for providing partial re-synchronization and partial re-synchronization method of using the same
CN111797121B (en) Strong consistency query method, device and system of read-write separation architecture service system
US8843449B2 (en) Unobtrusive copies of actively used compressed indices
CN109189852A (en) A kind of method that data are synchronous and the device synchronous for data
JP2001511552A (en) Database Method
EP4170509A1 (en) Method for playing back log on data node, data node, and system
CN111522880A (en) Method for improving data read-write performance based on mysql database cluster
US20220035786A1 (en) Distributed database management system with dynamically split b-tree indexes
US20140156595A1 (en) Synchronisation system and method
KR102038529B1 (en) System for processing real-time data modification of in-memory database
CN109902127B (en) Historical state data processing method and device, computer equipment and storage medium
CN113656384B (en) Data processing method, distributed database system, electronic device and storage medium
CN114741453A (en) Method, system and computer readable storage medium for data synchronization
JP3612449B2 (en) Master-slave relationship information synchronization method in distributed database system