アドバンスト・レプリケーションを使用して異なるサイト間でレプリケートされたデータベース・オブジェクトをメンテナンスしているデータベース管理者は、アドバンスト・レプリケーション環境をOracle Streams環境に移行できます。この付録では、このプロセスでの手順の概要を示し、各手順についてプロシージャと例を示して説明します。
この章の内容は次のとおりです。
関連項目: アドバンスト・レプリケーションの詳細は、『Oracle Databaseアドバンスト・レプリケーション』および『Oracle Databaseアドバンスト・レプリケーション・マネージメントAPIリファレンス』を参照してください。 |
ここでは、移行プロセスの概要を説明します。
DBMS_REPCAT.STREAMS_MIGRATION
プロシージャを使用すると、既存のアドバンスト・レプリケーション環境をOracle Streams環境に移行するSQL*Plusスクリプトを生成できます。マルチマスター・レプリケーション環境のマスター定義サイトでDBMS_REPCAT.STREAMS_MIGRATION
プロシージャを実行すると、指定した場所のファイルにSQL*Plusスクリプトが生成されます。スクリプトが生成された後、アドバンスト・レプリケーション環境の各マスター・サイトでそれを実行し、マスター・サイトごとにOracle Streams環境を設定します。レプリケーション・グループのOracle Streams環境を正常に生成するには、スクリプトの実行対象となるレプリケーション・グループに同じマスター・サイトが含まれている必要があります。レプリケーション・グループに異なるマスター・サイトが存在する場合、複数のスクリプトを生成して、各レプリケーション・グループをOracle Streamsに移行できます。
特定の管理タスクを実行するために、レプリケーション・グループのすべてのレプリケーション・アクティビティを停止または静止する必要がある場合があります。DBMS_REPCAT.STREAMS_MIGRATION
プロシージャを実行する場合は、レプリケーション・グループを静止する必要はありません。ただし、マスター・サイトで生成されたスクリプトを実行する場合は、Oracle Streamsに移行するレプリケーション・グループを静止する必要があります。レプリケーション・グループを静止してからマスター・サイトでスクリプトを実行するため、これらのサイトで既存の取得プロセス、伝播ジョブまたは適用プロセスを停止する必要はありません。
生成された移行スクリプトでは、コメントを使用して、Oracle Streamsに変換できないアドバンスト・レプリケーション要素が示されます。また、これらの要素をOracle Streamsに変換するためのスクリプトの変更に関する推奨事項も示されます。この推奨事項に基づいて、実行前にスクリプトを編集できます。必要に応じて、移行スクリプトを別の方法でカスタマイズすることもできます。
このスクリプトは、PL/SQLプロシージャおよびファンクションを実行する際、すべてのパラメータを設定します。スクリプトを生成すると、パラメータにデフォルト値が設定され、通常、これらのデフォルト値を変更する必要はありません。ただし、必要に応じてスクリプトを編集することで、これらのデフォルト・パラメータを変更できます。デフォルトに設定されるパラメータは、次のとおりです。
include_dml
include_ddl
include_tagged_lcr
スクリプトの先頭には、スクリプト内のプロシージャとファンクションが使用する名前の変数のリストが含まれます。スクリプトを生成すると、これらの変数はデフォルト値に設定され、これらの値を変更する必要はありません。ただし、必要に応じてこれらの変数のデフォルト設定を変更することができます。変数では、キュー、取得プロセス、伝播および適用プロセスの名前が指定されます。
移行スクリプトを実行すると、次のアクションが実行されます。
レプリケーション・グループにOracle Streamsに変換できない機能が含まれている場合、コメント内に警告が出力されます。
必要に応じて、DBMS_STREAMS_ADM.SET_UP_QUEUE
プロシージャを使用してANYDATA
キューが作成されます。
各表にDBMS_STREAMS_ADMIN.ADD_TABLE_PROPAGATION_RULES
プロシージャを使用して、すべてのマスター・サイト間で伝播が構成されます。
各表にDBMS_STREAMS_ADMIN.ADD_TABLE_RULES
プロシージャを使用して、各マスター・サイトで取得が構成されます。
各表にDBMS_STREAMS_ADMIN.ADD_TABLE_RULES
プロシージャを使用して、他のすべてのマスター・サイトからの変更の適用が構成されます。
オブジェクトに対する変更が適用される各サイトで、各レプリケート・オブジェクトのインスタンス化SCNが設定されます。
ソース・データベースで必要なサプリメンタル・ログ・グループが作成されます。
キー列が設定されます(存在する場合)。
移行するアドバンスト・レプリケーション環境に競合解消が構成されている場合は、競合解消が構成されます。
移行スクリプトの実行中にOracleにエラーが発生した場合、移行スクリプトは即時に終了します。このような状況が発生した場合、スクリプトを変更し、正常に実行されなかったすべてのコマンドを実行する必要があります。
移行スクリプトを使用して、更新可能なマテリアライズド・ビューを移行することはできません。アドバンスト・レプリケーション環境からOracle Streams環境への更新可能なマテリアライズド・ビューの移行は、手動で行う必要があります。
Oracle Streamsでは、次の機能はサポートされていません。
BFILE
、ROWID
データ型、およびユーザー定義型(オブジェクト型、REF
、VARRAY、ネストした表など)の列を持つ表に対する変更のレプリケーション
同期レプリケーション
現行のアドバンスト・レプリケーション環境でこれらの機能を使用している場合、環境のこれらの要素はOracle Streamsに移行できません。この場合、現時点ではOracle Streamsへの環境の移行を中止するか、またはOracle Streamsに移行できるように環境を変更します。
移行スクリプトを生成する前に、次の条件がすべて満たされていることを確認してください。
すべてのレプリケーション・グループのマスター・サイトが同じである。
移行スクリプトを生成するマスター・サイトでOracle Database 10g 以上が稼働している。
スクリプトを実行する(ただし、生成はしない)他のマスター・サイトでOracle9i リリース2(9.2)以上が稼働している。
移行スクリプトを生成するには、DBMS_REPCAT
パッケージのDBMS_REPCAT.STREAMS_MIGRATION
プロシージャを使用します。このプロシージャの構文は次のとおりです。
DBMS_REPCAT.STREAMS_MIGRATION ( gnames IN DBMS_UTILITY.NAME_ARRAY, file_location IN VARCHAR2, filename IN VARCHAR2);
DBMS_REPCAT.STREAMS_MIGRATION
プロシージャには、次のパラメータがあります。
gnames
: Oracle Streamsに移行するレプリケーション・グループのリスト。リスト内のすべてのレプリケーション・グループは、同じマスター・サイトを持つ必要があります。レプリケーション・グループのマスターが異なる場合、エラーが発生します。
file_location
: 移行スクリプトのディレクトリの場所。
filename
: 移行スクリプトの名前。
このプロシージャを実行すると、特定のレプリケーション・グループに対するOracle Streams環境を設定するスクリプトが生成されます。スクリプトをカスタマイズして、各マスター・サイトでそのスクリプトを実行することもできます。
図A-1に、この例でOracle Streamsに移行するアドバンスト・レプリケーション環境を示します。
このアドバンスト・レプリケーション環境には、次の特性があります。
orc1.example.com
データベースは、orc2.example.com
およびorc3.example.com
を含む3方向のマスター構成のマスター定義サイトです。
orc1.example.com
データベースは、mv1.example.com
マテリアライズド・ビュー・サイトのマスター・サイトです。
この環境は、3つのマスター・サイト間およびマスター・サイトとマテリアライズド・ビュー・サイトの間で、hr
スキーマのデータベース・オブジェクトに対する変更をレプリケートします。レプリケーション・グループhr_repg
は、レプリケート・オブジェクトを含んでいます。
マルチマスター環境のhr.countries
表に、競合解消が構成されています。この表では、最新のタイムスタンプによる競合解消方法によって、競合が解消されます。
mv1.example.com
サイトのマテリアライズド・ビューは更新可能です。
このアドバンスト・レプリケーション環境を構成するには、『Oracle Databaseアドバンスト・レプリケーション・マネージメントAPIリファレンス』の次の各操作に関する項で説明されているタスクを実行してください。
3つのマスター・サイトの設定
マテリアライズド・ビュー・サイトの設定(mv1.example.com
の設定のみ)
orc1.example.com
をマスター定義サイトとする3つのマスター・サイトのhr_repg
マスター・グループの作成
hr.countries
表に対するタイムスタンプによる競合解消の構成
orc1.example.com
のhr_repg
マスター・グループに基づく、mv1.example.com
のマテリアライズド・ビュー・グループの作成
このアドバンスト・レプリケーション環境の移行スクリプトを生成するには、次の手順を実行します。
次の手順を実行して、Oracle Streamsに移行するレプリケーション・グループの各マスター・サイトにOracle Streams管理者を作成します。「Oracle Streamsに移行するアドバンスト・レプリケーション環境の例」に示した環境例の場合、orc1.example.com
、orc2.example.com
およびorc3.example.com
でこれらの手順を実行してください。
ユーザーの作成、権限の付与および表領域の作成を行うことができる管理ユーザーとして接続します。
Oracle Streams管理者用の表領域を作成するか、既存の表領域を使用します。たとえば、次の文では、Oracle Streams管理者用の新規表領域が作成されます。
CREATE TABLESPACE streams_tbs DATAFILE '/usr/oracle/dbs/streams_tbs.dbf' SIZE 25 M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
Oracle Streams管理者の役割を果たす新規ユーザーを作成するか、既存のユーザーを使用します。たとえば、ユーザーstrmadmin
を作成し、このユーザーがstreams_tbs
表領域を使用するように指定するには、次の文を実行します。
CREATE USER strmadmin IDENTIFIED BY password
DEFAULT TABLESPACE streams_tbs
QUOTA UNLIMITED ON streams_tbs;
GRANT DBA TO strmadmin;
注意:
|
各マスター・サイトで、Oracle Streams管理者に必要な追加の権限を付与します。必要な権限は、個々のOracle Streams環境によって異なります。
DBMS_REPCAT.STREAMS_MIGRATION
プロシージャのfile_location
パラメータで指定したディレクトリは、PL/SQLでアクセスできる必要があります。Oracle Streams管理者が現在アクセス可能なディレクトリ・オブジェクトがマスター定義サイトにない場合は、Oracle Streams管理者として接続し、SQL文CREATE
DIRECTORY
を使用してディレクトリ・オブジェクトを作成します。
ディレクトリ・オブジェクトは、ディレクトリの別名に類似しています。たとえば、コンピュータ・システムの/usr/scripts
ディレクトリにディレクトリ・オブジェクトMIG2STR_DIR
を作成するには、次のプロシージャを実行します。
CONNECT strmadmin@orc1.example.com
Enter password: password
CREATE DIRECTORY MIG2STR_DIR AS '/usr/scripts';
関連項目: CREATE DIRECTORY 文の詳細は、『Oracle Database SQL言語リファレンス』を参照してください。 |
移行スクリプトを生成するには、マスター定義サイトでDBMS_REPCAT.STREAMS_MIGRATION
プロシージャを実行し、適切なパラメータを指定します。たとえば、次のプロシージャを実行すると、レプリケーション・グループhr_repg
を持つアドバンスト・レプリケーション環境を移行するスクリプトが生成されます。スクリプトはrep2streams.sql
という名前で、ローカル・コンピュータ・システムの/usr/scripts
ディレクトリに生成されます。このディレクトリは、ディレクトリ・オブジェクトMIG2STR_DIR
で表されます。
CONNECT strmadmin@orc1.example.com
Enter password: password
DECLARE
rep_groups DBMS_UTILITY.NAME_ARRAY;
BEGIN
rep_groups(1) := 'HR_REPG';
DBMS_REPCAT.STREAMS_MIGRATION(
gnames => rep_groups,
file_location => 'MIG2STR_DIR',
filename => 'rep2streams.sql');
END;
/
移行スクリプトの生成後、指定したディレクトリを表示して、そのスクリプトが作成されたことを確認します。必要に応じて、次の機能をサポートするように変更することができます。
加算、平均、優先グループまたはサイトの優先順位によるアドバンスト・レプリケーション競合解消方法を使用した競合解消が環境に必要な場合、ユーザー定義の競合解消方法を構成して競合を解消します。Oracle Streamsには、これらの方法と同等の競合解消方法が組み込まれていません。
ただし、移行スクリプトでは、上書き、廃棄、最大および最小の競合解消方法が自動的にサポートされます。スクリプトは最古のタイムスタンプによる方法を最小の方法に、最新のタイムスタンプによる方法を最大の方法に自動変換します。タイムスタンプ競合解消方法を使用する場合、スクリプトでは、表のタイムスタンプ列を移入するために必要なトリガーがすでに存在するとみなされます。
一意性競合の解消。
削除の競合の解消。
競合が発生した場合、複数の競合解消方法を指定した順序で実行します。Oracle Streamsでは、各列リストに指定できる競合解消方法は1つのみです。
手続き型レプリケーション。
次のような、表以外のオブジェクトに対するデータ定義言語(DDL)変更のレプリケーション。
ファンクション
索引
索引タイプ
演算子
パッケージ
パッケージ本体
プロシージャ
シノニム
トリガー
タイプ
タイプ本体
ビュー
これらのオブジェクトに対する変更は、アドバンスト・レプリケーションによってすべてのサイトでレプリケートされているため、移行スクリプトではこれらのオブジェクトを移行するためになんらかの操作を実行する必要はありません。Oracle Streams環境にDDLルールを追加することで、これらのオブジェクトの将来の変更と作成をサポートできます。
たとえば、orc1.example.com
データベースの取得プロセスstreams_capture
が、hr
スキーマのすべてのデータベース・オブジェクトに対するDDL変更を取得するように指定するには、スクリプトに次の記述を追加します。
BEGIN DBMS_STREAMS_ADM.ADD_SCHEMA_RULES( schema_name => 'hr', streams_type => 'capture', streams_name => 'streams_capture', queue_name => 'strmadmin.streams_queue', include_dml => FALSE, include_ddl => TRUE, include_tagged_lcr => FALSE, source_database => 'orc1.example.com'); END; /
include_ddl
パラメータがTRUE
に設定されていることに注意してください。このパラメータをTRUE
に設定することで、このプロシージャはhr
スキーマに対するDDL変更のスキーマ・ルールを、取得プロセスのルール・セットに追加します。このルールは、取得プロセスに対し、hr
スキーマおよびそのオブジェクトに対するDDL変更を取得するように指示します。DDL変更をレプリケートする場合、適切な伝播と適用プロセスに同様のルールを追加する必要があります。
ここでは、アドバンスト・レプリケーション環境からOracle Streams環境への移行を実行する方法について説明します。
この項の内容は、次のとおりです。
移行スクリプトを実行する前に、次の手順を完了します。
各レプリケーション・データベースで、Oracle Streamsに関連する初期化パラメータを設定し、必要に応じてデータベースを再起動します。
取得プロセスではARCHIVELOG
モードである必要があるため、各マスター・サイトがARCHIVELOG
モードで実行されていることを確認します。サンプル環境では、orc1.example.com
、orc2.example.com
およびorc3.example.com
がARCHIVELOG
モードで実行されている必要があります。データベースのログ・モードは、V$DATABASE
動的パフォーマンス・ビューのLOG_MODE
列を問い合せることで確認できます。
関連項目: ARCHIVELOG モードでデータベースを実行する方法の詳細は、『Oracle Database管理者ガイド』を参照してください。 |
各マスター・サイトで、Oracle Streams管理者から他のマスター・サイトのOracle Streams管理者へのデータベース・リンクを作成します。「Oracle Streamsに移行するアドバンスト・レプリケーション環境の例」に示した環境例の場合、次のデータベース・リンクを作成します。
CONNECT strmadmin@orc1.example.com Enter password: password CREATE DATABASE LINK orc2.example.com CONNECT TO strmadmin IDENTIFIED BY password USING 'orc2.example.com'; CREATE DATABASE LINK orc3.example.com CONNECT TO strmadmin IDENTIFIED BY password USING 'orc3.example.com'; CONNECT strmadmin@orc2.example.com Enter password: password CREATE DATABASE LINK orc1.example.com CONNECT TO strmadmin IDENTIFIED BY password USING 'orc1.example.com'; CREATE DATABASE LINK orc3.example.com CONNECT TO strmadmin IDENTIFIED BY password USING 'orc3.example.com'; CONNECT strmadmin@orc3.example.com Enter password: password CREATE DATABASE LINK orc1.example.com CONNECT TO strmadmin IDENTIFIED BY password USING 'orc1.example.com'; CREATE DATABASE LINK orc2.example.com CONNECT TO strmadmin IDENTIFIED BY password USING 'orc2.example.com';
Oracle Streamsに移行する各レプリケーション・グループのマスター定義サイトで、DBMS_REPCAT.SUSPEND_MASTER_ACTIVITY
プロシージャを実行します。
前述の環境例では、orc1.example.com
がマスター定義サイトであり、hr_repg
がOracle Streamsに移行するレプリケーション・グループです。したがって、レプリケーション管理者としてorc1.example.com
に接続し、SUSPEND_MASTER_ACTIVITY
プロシージャを実行します。
CONNECT repadmin@orc1.example.com
Enter password: password
BEGIN
DBMS_REPCAT.SUSPEND_MASTER_ACTIVITY (
gname => 'hr_repg');
END;
/
マスター・グループが静止されるまで、次の手順に進まないでください。マスター・グループの状態を確認するには、DBA_REPGROUP
データ・ディクショナリ・ビューのSTATUS
列を問い合せます。
移行を行うには、次の手順を実行します。
前述の環境例では、SQL*Plusでorc1.example.com
、orc2.example.com
およびorc3.example.com
にOracle Streams管理者strmadmin
として接続し、移行スクリプトrep2streams.sql
を実行します。
CONNECT strmadmin@orc1.example.com Enter password: password SET ECHO ON SPOOL rep2streams.out @rep2streams.sql CONNECT strmadmin@orc2.example.com Enter password: password SET ECHO ON SPOOL rep2streams.out @rep2streams.sql CONNECT strmadmin@orc3.example.com Enter password: password SET ECHO ON SPOOL rep2streams.out @rep2streams.sql
各サイトでスプール・ファイルをチェックして、エラーがないことを確認します。エラーがある場合は、正常に実行されなかった手順が実行されるようにスクリプトを変更し、スクリプトを再実行する必要があります。前述の環境例では、スプール・ファイルは各マスター・サイトのrep2streams.out
です。
移行プロセスを完了するには、次の手順を実行します。
レプリケーション管理者としてマスター定義サイトに接続し、DBMS_REPCAT.DROP_MASTER_REPGROUP
プロシージャを実行して、Oracle Streamsへの移行が正常に終了したレプリケーション・グループを削除します。
注意: DROP_MASTER_REPGROUP プロシージャのdrop_contents パラメータがFALSE に設定されていることを確認してください。TRUE に設定されている場合、レプリケートされたデータベース・オブジェクトが削除されます。 |
CONNECT repadmin@orc1.example.com
Enter password: password
BEGIN
DBMS_REPCAT.DROP_MASTER_REPGROUP (
gname => 'hr_repg',
drop_contents => FALSE,
all_sites => TRUE);
END;
/
各データベースで移行済のレプリケーション・グループが削除されていることを確認するには、DBA_REPGROUP
データ・ディクショナリ・ビューのGNAME
列を問い合せます。移行済のレプリケーション・グループがどのデータベースの問合せでも出力されないことを確認する必要があります。
レプリケーション管理者が不要になった場合、このユーザーも削除できます。
注意: Oracle Streamsの設定後は、アドバンスト・レプリケーションのアクティビティを再開しないでください。 |
Oracle Streams管理者として接続中に次の問合せを実行すると、各サイトの適用プロセスの名前を表示できます。
SELECT APPLY_NAME FROM DBA_APPLY;
適用プロセス名がわかっている場合、Oracle Streams管理者として接続中にDBMS_APPLY_ADM
パッケージのSTART_APPLY
プロシージャを実行することで、各適用プロセスを起動できます。たとえば、次のプロシージャを実行すると、適用プロセスapply_from_orc2
がorc1.example.com
で起動されます。
CONNECT strmadmin@orc1.example.com
Enter password: password
BEGIN
DBMS_APPLY_ADM.START_APPLY(
apply_name => 'apply_from_orc2');
END;
/
新しいOracle Streams環境のすべてのデータベースで各適用プロセスを起動してください。
Oracle Streams管理者として接続中に次の問合せを実行すると、各サイトの取得プロセスの名前を表示できます。
SELECT CAPTURE_NAME FROM DBA_CAPTURE;
取得プロセス名がわかっている場合、Oracle Streams管理者として接続中にDBMS_CAPTURE_ADM
パッケージのSTART_CAPTURE
プロシージャを実行することで、各取得プロセスを起動できます。たとえば、次のプロシージャを実行すると、取得プロセスstreams_capture
がorc1.example.com
で起動されます。
CONNECT strmadmin@orc1.example.com
Enter password: password
BEGIN
DBMS_CAPTURE_ADM.START_CAPTURE(
capture_name => 'streams_capture');
END;
/
新しいOracle Streams環境のすべてのデータベースで各取得プロセスを起動してください。
1つ以上のマテリアライズド・ビュー・グループで、Oracle Streamsに移行したマスター・グループが使用されていた場合、マスター・グループを再作成して、そのマテリアライズド・ビュー・グループを保持する必要があります。したがって、マテリアライズド・ビュー・グループのマスター・サイトとして機能している各データベースは、そのマテリアライズド・ビュー・グループのマテリアライズド・ビューで使用されている表を含む単一マスター構成のレプリケーション・グループのマスター定義サイトとなる必要があります。
Oracle Streamsに移行された元のレプリケーション・グループと同様のレプリケーション・グループを作成するには、レプリケーション・マネージメントAPIを使用します。新しいレプリケーション・グループは、同じレプリケーション・グループ名、オブジェクト、競合解消方法およびキー列を持ちます。既存のマテリアライズド・ビュー・グループを保持するには、マテリアライズド・ビュー・グループのマスター・グループが含まれていた各マスター・サイトでそれぞれのマスター・グループを再作成し、マスター・グループでマスター・レプリケーション・オブジェクトを再作成して、マスター・グループのレプリケーション・サポートを再生成し、マスター・グループのレプリケーション・アクティビティを再開する必要があります。
たとえば、次のアドバンスト・レプリケーション環境を考えます。
2つのマスター・サイトmdb1.example.com
およびmdb2.example.com
に、レプリケーション・グループrg1
が存在します。mdb1.example.com
データベースはマスター定義サイトであり、rg1
レプリケーション・グループのオブジェクトはmdb1.example.com
とmdb2.example.com
の間でレプリケートされます。
mdb1.example.com
のrg1
レプリケーション・グループは、mv1.example.com
のmvg1
マテリアライズド・ビュー・グループのマスター・グループです。
mdb2.example.com
のrg1
レプリケーション・グループは、mv2.example.com
のmvg2
マテリアライズド・ビュー・グループのマスター・グループです。
rg1
レプリケーション・グループがmdb1.example.com
とmdb2.example.com
の両方でOracle Streamsに移行され、mv1.example.com
のマテリアライズド・ビュー・グループmvg1
およびmv2.example.com
のマテリアライズド・ビュー・グループmvg2
を保持する場合、Oracle Streamsへの移行後に、mdb1.example.com
とmdb2.example.com
でrg1
レプリケーション・グループを再作成する必要があります。単一マスター環境で、mdb1.example.com
とmdb2.example.com
の両方がrg1
レプリケーション・グループのマスター定義サイトになるように構成します。
マテリアライズド・ビュー・サイトでマテリアライズド・ビュー・グループを削除または再作成する必要はありません。新しいマスター・レプリケーション・グループが元のレプリケーション・グループと同様である場合、マテリアライズド・ビュー・グループに影響はありません。各マスター・オブジェクトのレプリケーション・サポートの生成が完了するまで、これらのマテリアライズド・ビュー・グループをリフレッシュしないでください(この項の手順3を参照)。また、各マスター・オブジェクトのレプリケーション・サポートの生成が完了するまで、更新可能なマテリアライズド・ビューを持つマテリアライズド・ビュー・サイトで遅延トランザクション・キューをプッシュしないでください。
「Oracle Streamsに移行するアドバンスト・レプリケーション環境の例」に示した環境例では、orc1.example.com
のhr_repg
レプリケーション・グループのみがmv1.example.com
のマテリアライズド・ビュー・グループのマスター・グループでした。mv1.example.com
のこのマテリアライズド・ビュー・グループを保持するには、レプリケーション管理者として接続中に次の手順を実行します。
orc1.example.com
でマスター・グループhr_repg
を作成します。
CONNECT repadmin@orc1.example.com
Enter password: password
BEGIN
DBMS_REPCAT.CREATE_MASTER_REPGROUP (
gname => 'hr_repg');
END;
/
hr_repg
マスター・グループにhrスキーマの表を追加します。これらの表は、mv1.example.com
のマテリアライズド・ビューのマスター表です。
BEGIN DBMS_REPCAT.CREATE_MASTER_REPOBJECT ( gname => 'hr_repg', type => 'TABLE', oname => 'countries', sname => 'hr', use_existing_object => TRUE, copy_rows => FALSE); END; / BEGIN DBMS_REPCAT.CREATE_MASTER_REPOBJECT ( gname => 'hr_repg', type => 'TABLE', oname => 'departments', sname => 'hr', use_existing_object => TRUE, copy_rows => FALSE); END; / BEGIN DBMS_REPCAT.CREATE_MASTER_REPOBJECT ( gname => 'hr_repg', type => 'TABLE', oname => 'employees', sname => 'hr', use_existing_object => TRUE, copy_rows => FALSE); END; / BEGIN DBMS_REPCAT.CREATE_MASTER_REPOBJECT ( gname => 'hr_repg', type => 'TABLE', oname => 'jobs', sname => 'hr', use_existing_object => TRUE, copy_rows => FALSE); END; / BEGIN DBMS_REPCAT.CREATE_MASTER_REPOBJECT ( gname => 'hr_repg', type => 'TABLE', oname => 'job_history', sname => 'hr', use_existing_object => TRUE, copy_rows => FALSE); END; / BEGIN DBMS_REPCAT.CREATE_MASTER_REPOBJECT ( gname => 'hr_repg', type => 'TABLE', oname => 'locations', sname => 'hr', use_existing_object => TRUE, copy_rows => FALSE); END; / BEGIN DBMS_REPCAT.CREATE_MASTER_REPOBJECT ( gname => 'hr_repg', type => 'TABLE', oname => 'regions', sname => 'hr', use_existing_object => TRUE, copy_rows => FALSE); END; /
hr_repg
マスター・グループの各オブジェクトのレプリケーション・サポートを生成します。
BEGIN DBMS_REPCAT.GENERATE_REPLICATION_SUPPORT ( sname => 'hr', oname => 'countries', type => 'TABLE'); END; / BEGIN DBMS_REPCAT.GENERATE_REPLICATION_SUPPORT ( sname => 'hr', oname => 'departments', type => 'TABLE'); END; / BEGIN DBMS_REPCAT.GENERATE_REPLICATION_SUPPORT ( sname => 'hr', oname => 'employees', type => 'TABLE'); END; / BEGIN DBMS_REPCAT.GENERATE_REPLICATION_SUPPORT ( sname => 'hr', oname => 'jobs', type => 'TABLE'); END; / BEGIN DBMS_REPCAT.GENERATE_REPLICATION_SUPPORT ( sname => 'hr', oname => 'job_history', type => 'TABLE'); END; / BEGIN DBMS_REPCAT.GENERATE_REPLICATION_SUPPORT ( sname => 'hr', oname => 'locations', type => 'TABLE'); END; / BEGIN DBMS_REPCAT.GENERATE_REPLICATION_SUPPORT ( sname => 'hr', oname => 'regions', type => 'TABLE'); END; /
hr_repg
マスター・グループのマスター・アクティビティを再開します。
BEGIN DBMS_REPCAT.RESUME_MASTER_ACTIVITY ( gname => 'hr_repg'); END; /
注意: レプリケーション・グループをOracle Streamsに移行した後にこれらのログを手動で削除した場合を除き、hr_repg マスター・グループに追加した表ごとにマテリアライズド・ビュー・ログが存在します。マテリアライズド・ビュー・ログが存在しない場合は、これらのログを作成する必要があります。 |
環境に対して生成されたスクリプトの例を次に示します。
The following is an example script generated for the environment: ---------------------------------------------------------- -- Migration Script Generated on 12-JUN-05 by user STRMADMIN. -- ---------------------------------------------------------- ---------------------------------------------------------- -- ************** Notes and Assumptions ************** -- -- -- 1. The Oracle Streams Administrator is "strmadmin". -- The user "strmadmin" must be created and granted the -- required privileges before running the script. -- -- 2. Names of queue tables, queues, capture processes -- propagation jobs, and apply processes will be the -- same at all sites. If the DBA wants different names, -- he must edit the script manually before running it -- at each master site. -- -- 3. Archive logging must be enabled at all sites before -- running the script. -- -- 4. Users must set up database links for queue to queue -- propagation, if needed. -- -- 5. Repgroups must be quiesced before running the script. ---------------------------------------------------------- set pagesize 1000 set echo on set serveroutput on whenever sqlerror exit sql.sqlcode; -- -- Raise error if Repgroups are not Quiesced. -- declare repgroup_status VARCHAR2(10); begin select status into repgroup_status from dba_repcat where gname = 'HR_REPG'; if (repgroup_status != 'QUIESCED') THEN raise_application_error(-20000, 'ORA-23310: object group "HR_REPG" is not quiesced.'); end if; exception when no_data_found then null; end; / ------------------------------- -- Queue Owner ------------------------------- -- streams queue owner at ORC1.EXAMPLE.COM define QUEUE_OWNER_ORC1 = strmadmin -- streams queue owner at ORC2.EXAMPLE.COM define QUEUE_OWNER_ORC2 = strmadmin -- streams queue owner at ORC3.EXAMPLE.COM define QUEUE_OWNER_ORC3 = strmadmin ------------------------------- -- Queue Table ------------------------------- -- streams queue table at ORC1.EXAMPLE.COM define QUEUE_TABLE_ORC1 = streams_queue_table -- streams queue table at ORC2.EXAMPLE.COM define QUEUE_TABLE_ORC2 = streams_queue_table -- streams queue table at ORC3.EXAMPLE.COM define QUEUE_TABLE_ORC3 = streams_queue_table ------------------------------- -- Queue ------------------------------- -- streams queue at ORC1.EXAMPLE.COM define QUEUE_ORC1 = streams_queue -- streams queue at ORC2.EXAMPLE.COM define QUEUE_ORC2 = streams_queue -- streams queue at ORC3.EXAMPLE.COM define QUEUE_ORC3 = streams_queue ------------------------------- -- Propagation names ------------------------------- -- propagation process to ORC1.EXAMPLE.COM define PROP_ORC1 = prop_to_ORC1 -- propagation process to ORC2.EXAMPLE.COM define PROP_ORC2 = prop_to_ORC2 -- propagation process to ORC3.EXAMPLE.COM define PROP_ORC3 = prop_to_ORC3 ------------------------------- -- Capture Process ------------------------------- -- capture process to be used or created at the local site define CAPTURE_NAME = streams_capture ------------------------------- -- Apply processes ------------------------------- -- apply process for applying LCRs from ORC1.EXAMPLE.COM define APPLY_ORC1 = apply_from_ORC1 -- apply process for applying LCRs from ORC2.EXAMPLE.COM define APPLY_ORC2 = apply_from_ORC2 -- apply process for applying LCRs from ORC3.EXAMPLE.COM define APPLY_ORC3 = apply_from_ORC3 -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- DEPT_LOCATION_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_JOB_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_MANAGER_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- INSERT_TIME of type TRIGGER belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_EMPLOYEE_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_JOB_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- LOC_COUNTRY_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- DEPT_LOCATION_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_JOB_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_MANAGER_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- INSERT_TIME of type TRIGGER belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_EMPLOYEE_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_JOB_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- LOC_COUNTRY_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- DEPT_LOCATION_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_JOB_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_MANAGER_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- INSERT_TIME of type TRIGGER belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_EMPLOYEE_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_JOB_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- LOC_COUNTRY_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- DEPT_LOCATION_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_JOB_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_MANAGER_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- INSERT_TIME of type TRIGGER belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_EMPLOYEE_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_JOB_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- LOC_COUNTRY_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- DEPT_LOCATION_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_JOB_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_MANAGER_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- INSERT_TIME of type TRIGGER belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_EMPLOYEE_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_JOB_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- LOC_COUNTRY_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- DEPT_LOCATION_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_JOB_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_MANAGER_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- INSERT_TIME of type TRIGGER belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_EMPLOYEE_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_JOB_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- LOC_COUNTRY_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- DEPT_LOCATION_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_JOB_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- EMP_MANAGER_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- INSERT_TIME of type TRIGGER belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_EMPLOYEE_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- JHIST_JOB_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- -- -- ** WARNING ** -- -- Oracle Streams does not support the repobject -- LOC_COUNTRY_IX of type INDEX belonging to repgroup HR_REPG. -- The user can add DDL rules to the Oracle Streams environment -- to support creation or any future modifications -- of this type of object. -- ------------------------------- -- Setup Queue ------------------------------- variable local_db varchar2(128); variable local_queue_table varchar2(30); variable local_queue varchar2(30); variable local_queue_owner varchar2(30); -- get the local database name declare global_name varchar2(128); begin select global_name into :local_db from global_name; dbms_output.put_line('The local database name is: ' || :local_db); end; / -- get the local queue table and queue name begin if :local_db = 'ORC1.EXAMPLE.COM' then :local_queue_table := '&QUEUE_TABLE_ORC1'; :local_queue := '&QUEUE_ORC1'; :local_queue_owner := '&QUEUE_OWNER_ORC1'; elsif :local_db = 'ORC2.EXAMPLE.COM' then :local_queue_table := '&QUEUE_TABLE_ORC2'; :local_queue := '&QUEUE_ORC2'; :local_queue_owner := '&QUEUE_OWNER_ORC2'; elsif :local_db = 'ORC3.EXAMPLE.COM' then :local_queue_table := '&QUEUE_TABLE_ORC3'; :local_queue := '&QUEUE_ORC3'; :local_queue_owner := '&QUEUE_OWNER_ORC3'; end if; dbms_output.put_line('The local queue owner is: ' || :local_queue_owner); dbms_output.put_line('The local queue table is: ' || :local_queue_table); dbms_output.put_line('The local queue name is: ' || :local_queue); end; / begin dbms_streams_adm.set_up_queue( queue_table => :local_queue_table, storage_clause => NULL, queue_name => :local_queue, queue_user => :local_queue_owner, comment => 'streams_comment'); end; / ------------------------------- -- Set Instantiation SCN ------------------------------- variable flashback_scn number; begin select dbms_flashback.get_system_change_number into :flashback_scn from dual; dbms_output.put_line('local flashback SCN is: ' || :flashback_scn); end; / -- -- Setup instantiation SCN for ORC1.EXAMPLE.COM -- begin -- -- HR_REPG : Set instantiation SCN for "HR"."COUNTRIES" at -- ORC1.EXAMPLE.COM -- if (:local_db != 'ORC1.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC1.EXAMPLE.COM( source_object_name => '"HR"."COUNTRIES"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / begin -- -- HR_REPG : Set instantiation SCN for "HR"."DEPARTMENTS" at -- ORC1.EXAMPLE.COM -- if (:local_db != 'ORC1.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC1.EXAMPLE.COM( source_object_name => '"HR"."DEPARTMENTS"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / begin -- -- HR_REPG : Set instantiation SCN for "HR"."EMPLOYEES" at -- ORC1.EXAMPLE.COM -- if (:local_db != 'ORC1.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC1.EXAMPLE.COM( source_object_name => '"HR"."EMPLOYEES"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / begin -- -- HR_REPG : Set instantiation SCN for "HR"."JOBS" at -- ORC1.EXAMPLE.COM -- if (:local_db != 'ORC1.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC1.EXAMPLE.COM( source_object_name => '"HR"."JOBS"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / begin -- -- HR_REPG : Set instantiation SCN for "HR"."JOB_HISTORY" at -- ORC1.EXAMPLE.COM -- if (:local_db != 'ORC1.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC1.EXAMPLE.COM( source_object_name => '"HR"."JOB_HISTORY"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / begin -- -- HR_REPG : Set instantiation SCN for "HR"."LOCATIONS" at -- ORC1.EXAMPLE.COM -- if (:local_db != 'ORC1.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC1.EXAMPLE.COM( source_object_name => '"HR"."LOCATIONS"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / begin -- -- HR_REPG : Set instantiation SCN for "HR"."REGIONS" at -- ORC1.EXAMPLE.COM -- if (:local_db != 'ORC1.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC1.EXAMPLE.COM( source_object_name => '"HR"."REGIONS"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / -- -- Setup instantiation SCN for ORC2.EXAMPLE.COM -- begin -- -- HR_REPG : Set instantiation SCN for "HR"."COUNTRIES" at -- ORC2.EXAMPLE.COM -- if (:local_db != 'ORC2.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC2.EXAMPLE.COM( source_object_name => '"HR"."COUNTRIES"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / begin -- -- HR_REPG : Set instantiation SCN for "HR"."DEPARTMENTS" at -- ORC2.EXAMPLE.COM -- if (:local_db != 'ORC2.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC2.EXAMPLE.COM( source_object_name => '"HR"."DEPARTMENTS"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / begin -- -- HR_REPG : Set instantiation SCN for "HR"."EMPLOYEES" at -- ORC2.EXAMPLE.COM -- if (:local_db != 'ORC2.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC2.EXAMPLE.COM( source_object_name => '"HR"."EMPLOYEES"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / begin -- -- HR_REPG : Set instantiation SCN for "HR"."JOBS" at -- ORC2.EXAMPLE.COM -- if (:local_db != 'ORC2.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC2.EXAMPLE.COM( source_object_name => '"HR"."JOBS"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / begin -- -- HR_REPG : Set instantiation SCN for "HR"."JOB_HISTORY" at -- ORC2.EXAMPLE.COM -- if (:local_db != 'ORC2.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC2.EXAMPLE.COM( source_object_name => '"HR"."JOB_HISTORY"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / begin -- -- HR_REPG : Set instantiation SCN for "HR"."LOCATIONS" at -- ORC2.EXAMPLE.COM -- if (:local_db != 'ORC2.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC2.EXAMPLE.COM( source_object_name => '"HR"."LOCATIONS"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / begin -- -- HR_REPG : Set instantiation SCN for "HR"."REGIONS" at -- ORC2.EXAMPLE.COM -- if (:local_db != 'ORC2.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC2.EXAMPLE.COM( source_object_name => '"HR"."REGIONS"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / -- -- Setup instantiation SCN for ORC3.EXAMPLE.COM -- begin -- -- HR_REPG : Set instantiation SCN for "HR"."COUNTRIES" at -- ORC3.EXAMPLE.COM -- if (:local_db != 'ORC3.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC3.EXAMPLE.COM( source_object_name => '"HR"."COUNTRIES"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / begin -- -- HR_REPG : Set instantiation SCN for "HR"."DEPARTMENTS" at -- ORC3.EXAMPLE.COM -- if (:local_db != 'ORC3.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC3.EXAMPLE.COM( source_object_name => '"HR"."DEPARTMENTS"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / begin -- -- HR_REPG : Set instantiation SCN for "HR"."EMPLOYEES" at -- ORC3.EXAMPLE.COM -- if (:local_db != 'ORC3.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC3.EXAMPLE.COM( source_object_name => '"HR"."EMPLOYEES"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / begin -- -- HR_REPG : Set instantiation SCN for "HR"."JOBS" at -- ORC3.EXAMPLE.COM -- if (:local_db != 'ORC3.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC3.EXAMPLE.COM( source_object_name => '"HR"."JOBS"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / begin -- -- HR_REPG : Set instantiation SCN for "HR"."JOB_HISTORY" at -- ORC3.EXAMPLE.COM -- if (:local_db != 'ORC3.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC3.EXAMPLE.COM( source_object_name => '"HR"."JOB_HISTORY"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / begin -- -- HR_REPG : Set instantiation SCN for "HR"."LOCATIONS" at -- ORC3.EXAMPLE.COM -- if (:local_db != 'ORC3.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC3.EXAMPLE.COM( source_object_name => '"HR"."LOCATIONS"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / begin -- -- HR_REPG : Set instantiation SCN for "HR"."REGIONS" at -- ORC3.EXAMPLE.COM -- if (:local_db != 'ORC3.EXAMPLE.COM') then dbms_apply_adm.set_table_instantiation_scn@ORC3.EXAMPLE.COM( source_object_name => '"HR"."REGIONS"', source_database_name => :local_db, instantiation_scn => :flashback_scn, apply_database_link => NULL); end if; end; / ------------------------------- -- Setup Propagation ------------------------------- -- -- Propagation from local queue to ORC1.EXAMPLE.COM -- begin if :local_db != 'ORC1.EXAMPLE.COM' then -- -- HR_REPG: Propagate "COUNTRIES" from local queue to ORC1 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."COUNTRIES"', streams_name => '&PROP_ORC1', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC1' || '.' || '&QUEUE_ORC1' || '@ORC1.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / begin if :local_db != 'ORC1.EXAMPLE.COM' then -- -- HR_REPG: Propagate "DEPARTMENTS" from local queue to ORC1 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."DEPARTMENTS"', streams_name => '&PROP_ORC1', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC1' || '.' || '&QUEUE_ORC1' || '@ORC1.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / begin if :local_db != 'ORC1.EXAMPLE.COM' then -- -- HR_REPG: Propagate "EMPLOYEES" from local queue to ORC1 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."EMPLOYEES"', streams_name => '&PROP_ORC1', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC1' || '.' || '&QUEUE_ORC1' || '@ORC1.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / begin if :local_db != 'ORC1.EXAMPLE.COM' then -- -- HR_REPG: Propagate "JOBS" from local queue to ORC1 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."JOBS"', streams_name => '&PROP_ORC1', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC1' || '.' || '&QUEUE_ORC1' || '@ORC1.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / begin if :local_db != 'ORC1.EXAMPLE.COM' then -- -- HR_REPG: Propagate "JOB_HISTORY" from local queue to ORC1 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."JOB_HISTORY"', streams_name => '&PROP_ORC1', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC1' || '.' || '&QUEUE_ORC1' || '@ORC1.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / begin if :local_db != 'ORC1.EXAMPLE.COM' then -- -- HR_REPG: Propagate "LOCATIONS" from local queue to ORC1 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."LOCATIONS"', streams_name => '&PROP_ORC1', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC1' || '.' || '&QUEUE_ORC1' || '@ORC1.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / begin if :local_db != 'ORC1.EXAMPLE.COM' then -- -- HR_REPG: Propagate "REGIONS" from local queue to ORC1 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."REGIONS"', streams_name => '&PROP_ORC1', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC1' || '.' || '&QUEUE_ORC1' || '@ORC1.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / -- -- Propagation from local queue to ORC2.EXAMPLE.COM -- begin if :local_db != 'ORC2.EXAMPLE.COM' then -- -- HR_REPG: Propagate "COUNTRIES" from local queue to ORC2 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."COUNTRIES"', streams_name => '&PROP_ORC2', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC2' || '.' || '&QUEUE_ORC2' || '@ORC2.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / begin if :local_db != 'ORC2.EXAMPLE.COM' then -- -- HR_REPG: Propagate "DEPARTMENTS" from local queue to ORC2 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."DEPARTMENTS"', streams_name => '&PROP_ORC2', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC2' || '.' || '&QUEUE_ORC2' || '@ORC2.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / begin if :local_db != 'ORC2.EXAMPLE.COM' then -- -- HR_REPG: Propagate "EMPLOYEES" from local queue to ORC2 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."EMPLOYEES"', streams_name => '&PROP_ORC2', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC2' || '.' || '&QUEUE_ORC2' || '@ORC2.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / begin if :local_db != 'ORC2.EXAMPLE.COM' then -- -- HR_REPG: Propagate "JOBS" from local queue to ORC2 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."JOBS"', streams_name => '&PROP_ORC2', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC2' || '.' || '&QUEUE_ORC2' || '@ORC2.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / begin if :local_db != 'ORC2.EXAMPLE.COM' then -- -- HR_REPG: Propagate "JOB_HISTORY" from local queue to ORC2 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."JOB_HISTORY"', streams_name => '&PROP_ORC2', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC2' || '.' || '&QUEUE_ORC2' || '@ORC2.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / begin if :local_db != 'ORC2.EXAMPLE.COM' then -- -- HR_REPG: Propagate "LOCATIONS" from local queue to ORC2 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."LOCATIONS"', streams_name => '&PROP_ORC2', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC2' || '.' || '&QUEUE_ORC2' || '@ORC2.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / begin if :local_db != 'ORC2.EXAMPLE.COM' then -- -- HR_REPG: Propagate "REGIONS" from local queue to ORC2 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."REGIONS"', streams_name => '&PROP_ORC2', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC2' || '.' || '&QUEUE_ORC2' || '@ORC2.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / -- -- Propagation from local queue to ORC3.EXAMPLE.COM -- begin if :local_db != 'ORC3.EXAMPLE.COM' then -- -- HR_REPG: Propagate "COUNTRIES" from local queue to ORC3 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."COUNTRIES"', streams_name => '&PROP_ORC3', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC3' || '.' || '&QUEUE_ORC3' || '@ORC3.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / begin if :local_db != 'ORC3.EXAMPLE.COM' then -- -- HR_REPG: Propagate "DEPARTMENTS" from local queue to ORC3 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."DEPARTMENTS"', streams_name => '&PROP_ORC3', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC3' || '.' || '&QUEUE_ORC3' || '@ORC3.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / begin if :local_db != 'ORC3.EXAMPLE.COM' then -- -- HR_REPG: Propagate "EMPLOYEES" from local queue to ORC3 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."EMPLOYEES"', streams_name => '&PROP_ORC3', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC3' || '.' || '&QUEUE_ORC3' || '@ORC3.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / begin if :local_db != 'ORC3.EXAMPLE.COM' then -- -- HR_REPG: Propagate "JOBS" from local queue to ORC3 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."JOBS"', streams_name => '&PROP_ORC3', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC3' || '.' || '&QUEUE_ORC3' || '@ORC3.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / begin if :local_db != 'ORC3.EXAMPLE.COM' then -- -- HR_REPG: Propagate "JOB_HISTORY" from local queue to ORC3 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."JOB_HISTORY"', streams_name => '&PROP_ORC3', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC3' || '.' || '&QUEUE_ORC3' || '@ORC3.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / begin if :local_db != 'ORC3.EXAMPLE.COM' then -- -- HR_REPG: Propagate "LOCATIONS" from local queue to ORC3 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."LOCATIONS"', streams_name => '&PROP_ORC3', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC3' || '.' || '&QUEUE_ORC3' || '@ORC3.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / begin if :local_db != 'ORC3.EXAMPLE.COM' then -- -- HR_REPG: Propagate "REGIONS" from local queue to ORC3 -- dbms_streams_adm.add_table_propagation_rules( table_name => '"HR"."REGIONS"', streams_name => '&PROP_ORC3', source_queue_name => :local_queue_owner || '.' || :local_queue, destination_queue_name => '&QUEUE_OWNER_ORC3' || '.' || '&QUEUE_ORC3' || '@ORC3.EXAMPLE.COM', include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end if; end; / ------------------------------- -- Setup Capture ------------------------------- begin -- -- HR_REPG : Add "COUNTRIES" -- dbms_streams_adm.add_table_rules( table_name => '"HR"."COUNTRIES"', streams_type => 'CAPTURE', streams_name => '&CAPTURE_NAME', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end; / begin -- -- HR_REPG : Add "DEPARTMENTS" -- dbms_streams_adm.add_table_rules( table_name => '"HR"."DEPARTMENTS"', streams_type => 'CAPTURE', streams_name => '&CAPTURE_NAME', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end; / begin -- -- HR_REPG : Add "EMPLOYEES" -- dbms_streams_adm.add_table_rules( table_name => '"HR"."EMPLOYEES"', streams_type => 'CAPTURE', streams_name => '&CAPTURE_NAME', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end; / begin -- -- HR_REPG : Add "JOBS" -- dbms_streams_adm.add_table_rules( table_name => '"HR"."JOBS"', streams_type => 'CAPTURE', streams_name => '&CAPTURE_NAME', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end; / begin -- -- HR_REPG : Add "JOB_HISTORY" -- dbms_streams_adm.add_table_rules( table_name => '"HR"."JOB_HISTORY"', streams_type => 'CAPTURE', streams_name => '&CAPTURE_NAME', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end; / begin -- -- HR_REPG : Add "LOCATIONS" -- dbms_streams_adm.add_table_rules( table_name => '"HR"."LOCATIONS"', streams_type => 'CAPTURE', streams_name => '&CAPTURE_NAME', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end; / begin -- -- HR_REPG : Add "REGIONS" -- dbms_streams_adm.add_table_rules( table_name => '"HR"."REGIONS"', streams_type => 'CAPTURE', streams_name => '&CAPTURE_NAME', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => :local_db); end; / ------------------------------- -- Setup Apply ------------------------------- -- -- Setup Apply from ORC1.EXAMPLE.COM -- begin -- -- HR_REPG : Add "COUNTRIES" to apply rules for apply from -- ORC1.EXAMPLE.COM -- if(:local_db != 'ORC1.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."COUNTRIES"', streams_type => 'APPLY', streams_name => '&APPLY_ORC1', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC1.EXAMPLE.COM'); end if; end; / begin -- -- HR_REPG : Add "DEPARTMENTS" to apply rules for apply from -- ORC1.EXAMPLE.COM -- if(:local_db != 'ORC1.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."DEPARTMENTS"', streams_type => 'APPLY', streams_name => '&APPLY_ORC1', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC1.EXAMPLE.COM'); end if; end; / begin -- -- HR_REPG : Add "EMPLOYEES" to apply rules for apply from -- ORC1.EXAMPLE.COM -- if(:local_db != 'ORC1.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."EMPLOYEES"', streams_type => 'APPLY', streams_name => '&APPLY_ORC1', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC1.EXAMPLE.COM'); end if; end; / begin -- -- HR_REPG : Add "JOBS" to apply rules for apply from -- ORC1.EXAMPLE.COM -- if(:local_db != 'ORC1.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."JOBS"', streams_type => 'APPLY', streams_name => '&APPLY_ORC1', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC1.EXAMPLE.COM'); end if; end; / begin -- -- HR_REPG : Add "JOB_HISTORY" to apply rules for apply from -- ORC1.EXAMPLE.COM -- if(:local_db != 'ORC1.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."JOB_HISTORY"', streams_type => 'APPLY', streams_name => '&APPLY_ORC1', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC1.EXAMPLE.COM'); end if; end; / begin -- -- HR_REPG : Add "LOCATIONS" to apply rules for apply from -- ORC1.EXAMPLE.COM -- if(:local_db != 'ORC1.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."LOCATIONS"', streams_type => 'APPLY', streams_name => '&APPLY_ORC1', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC1.EXAMPLE.COM'); end if; end; / begin -- -- HR_REPG : Add "REGIONS" to apply rules for apply from -- ORC1.EXAMPLE.COM -- if(:local_db != 'ORC1.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."REGIONS"', streams_type => 'APPLY', streams_name => '&APPLY_ORC1', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC1.EXAMPLE.COM'); end if; end; / -- -- Setup Apply from ORC2.EXAMPLE.COM -- begin -- -- HR_REPG : Add "COUNTRIES" to apply rules for apply from -- ORC2.EXAMPLE.COM -- if(:local_db != 'ORC2.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."COUNTRIES"', streams_type => 'APPLY', streams_name => '&APPLY_ORC2', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC2.EXAMPLE.COM'); end if; end; / begin -- -- HR_REPG : Add "DEPARTMENTS" to apply rules for apply from -- ORC2.EXAMPLE.COM -- if(:local_db != 'ORC2.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."DEPARTMENTS"', streams_type => 'APPLY', streams_name => '&APPLY_ORC2', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC2.EXAMPLE.COM'); end if; end; / begin -- -- HR_REPG : Add "EMPLOYEES" to apply rules for apply from -- ORC2.EXAMPLE.COM -- if(:local_db != 'ORC2.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."EMPLOYEES"', streams_type => 'APPLY', streams_name => '&APPLY_ORC2', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC2.EXAMPLE.COM'); end if; end; / begin -- -- HR_REPG : Add "JOBS" to apply rules for apply from -- ORC2.EXAMPLE.COM -- if(:local_db != 'ORC2.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."JOBS"', streams_type => 'APPLY', streams_name => '&APPLY_ORC2', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC2.EXAMPLE.COM'); end if; end; / begin -- -- HR_REPG : Add "JOB_HISTORY" to apply rules for apply from -- ORC2.EXAMPLE.COM -- if(:local_db != 'ORC2.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."JOB_HISTORY"', streams_type => 'APPLY', streams_name => '&APPLY_ORC2', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC2.EXAMPLE.COM'); end if; end; / begin -- -- HR_REPG : Add "LOCATIONS" to apply rules for apply from -- ORC2.EXAMPLE.COM -- if(:local_db != 'ORC2.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."LOCATIONS"', streams_type => 'APPLY', streams_name => '&APPLY_ORC2', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC2.EXAMPLE.COM'); end if; end; / begin -- -- HR_REPG : Add "REGIONS" to apply rules for apply from -- ORC2.EXAMPLE.COM -- if(:local_db != 'ORC2.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."REGIONS"', streams_type => 'APPLY', streams_name => '&APPLY_ORC2', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC2.EXAMPLE.COM'); end if; end; / -- -- Setup Apply from ORC3.EXAMPLE.COM -- begin -- -- HR_REPG : Add "COUNTRIES" to apply rules for apply from -- ORC3.EXAMPLE.COM -- if(:local_db != 'ORC3.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."COUNTRIES"', streams_type => 'APPLY', streams_name => '&APPLY_ORC3', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC3.EXAMPLE.COM'); end if; end; / begin -- -- HR_REPG : Add "DEPARTMENTS" to apply rules for apply from -- ORC3.EXAMPLE.COM -- if(:local_db != 'ORC3.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."DEPARTMENTS"', streams_type => 'APPLY', streams_name => '&APPLY_ORC3', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC3.EXAMPLE.COM'); end if; end; / begin -- -- HR_REPG : Add "EMPLOYEES" to apply rules for apply from -- ORC3.EXAMPLE.COM -- if(:local_db != 'ORC3.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."EMPLOYEES"', streams_type => 'APPLY', streams_name => '&APPLY_ORC3', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC3.EXAMPLE.COM'); end if; end; / begin -- -- HR_REPG : Add "JOBS" to apply rules for apply from -- ORC3.EXAMPLE.COM -- if(:local_db != 'ORC3.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."JOBS"', streams_type => 'APPLY', streams_name => '&APPLY_ORC3', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC3.EXAMPLE.COM'); end if; end; / begin -- -- HR_REPG : Add "JOB_HISTORY" to apply rules for apply from -- ORC3.EXAMPLE.COM -- if(:local_db != 'ORC3.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."JOB_HISTORY"', streams_type => 'APPLY', streams_name => '&APPLY_ORC3', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC3.EXAMPLE.COM'); end if; end; / begin -- -- HR_REPG : Add "LOCATIONS" to apply rules for apply from -- ORC3.EXAMPLE.COM -- if(:local_db != 'ORC3.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."LOCATIONS"', streams_type => 'APPLY', streams_name => '&APPLY_ORC3', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC3.EXAMPLE.COM'); end if; end; / begin -- -- HR_REPG : Add "REGIONS" to apply rules for apply from -- ORC3.EXAMPLE.COM -- if(:local_db != 'ORC3.EXAMPLE.COM') then dbms_streams_adm.add_table_rules( table_name => '"HR"."REGIONS"', streams_type => 'APPLY', streams_name => '&APPLY_ORC3', queue_name => :local_queue_owner || '.' || :local_queue, include_dml => TRUE, include_ddl => FALSE, include_tagged_lcr => FALSE, source_database => 'ORC3.EXAMPLE.COM'); end if; end; / ------------------------------- -- Add Supplemental Log Groups ------------------------------- -- -- ** NOTE ** -- -- The primary key columns must be supplementally logged. -- alter database add supplemental log data (primary key) columns; -- -- ** NOTE ** -- -- The unique key columns must be supplementally logged. -- alter database add supplemental log data (unique index) columns; -- -- ** NOTE ** -- -- All the columns in a column group that is assigned an Oracle Streams -- supported update conflict handler must be supplementally logged. -- -- Supplementally log columns in column group 'COUNTRIES_TIMESTAMP_CG' -- that is assigned the LATEST TIMESTAMP update conflict resolution method. alter table "HR"."COUNTRIES" add supplemental log group COUNTRIES_LogGrp1 ( "COUNTRY_NAME" ,"REGION_ID" ,"TIMESTAMP" ); ------------------------------- -- Setup Conflict Resolution ------------------------------- -- -- ** WARNING ** -- -- Oracle Streams does not support LATEST TIMESTAMP -- conflict resolution method. -- Changing LATEST TIMESTAMP to MAXIMUM as -- they handle the conflicts in a similar manner. -- declare cols dbms_utility.name_array; begin cols(1) := 'COUNTRY_NAME'; cols(2) := 'REGION_ID'; cols(3) := 'TIMESTAMP'; dbms_apply_adm.set_update_conflict_handler( object_name => 'HR.COUNTRIES', method_name => 'MAXIMUM', resolution_column => 'TIMESTAMP', column_list => cols); end; / ------------------------------- -- Verify Oracle Streams Setup ------------------------------- -- Verify creation of queues select * from dba_queues where name = upper(:local_queue) and owner = upper(:local_queue_owner) and queue_table = upper(:local_queue_table) order by name; -- Verify creation of capture_process select * from dba_capture where capture_name = upper('&CAPTURE_NAME'); -- Verify creation of apply processes select * from dba_apply where apply_name IN ( upper('&APPLY_ORC1'), upper('&APPLY_ORC2'), upper('&APPLY_ORC3') ) order by apply_name; -- Verify propagation processes select * from dba_propagation where propagation_name IN ( upper('&PROP_ORC1'), upper('&PROP_ORC2'), upper('&PROP_ORC3') ) order by propagation_name; -- Verify Oracle Streams rules select * from dba_streams_table_rules where streams_name = upper('&CAPTURE_NAME'); select * from dba_streams_table_rules where streams_name IN ( upper('&APPLY_ORC1'), upper('&APPLY_ORC2'), upper('&APPLY_ORC3') ) order by source_database; select * from dba_streams_table_rules where streams_name IN ( upper('&PROP_ORC1'), upper('&PROP_ORC2'), upper('&PROP_ORC3') ) order by source_database; -- Do not resume Repcat activity once Oracle Streams is set up. -- Drop all the repgroups that have been migrated to Oracle Streams. -- Start apply and capture processes at all sites.