Oracle MV テスト 時間優先 競合発生なし
Oracle において MV マテリアライズド・ビュー とは以下を示します。
- Oracle MV 構築手順 http://www.bishounen.sakura.ne.jp/rails/my_knowledge/show/20
マテリアライズド・ビュー タイムスタンプによるの優先順位
- タイムスタンプ競合解消メソッドを定義したオブジェクト
scott_rep.empsecond
- オブジェクトのレコードの確認
conn scott_rep/tiger select idsecond,namesecond, to_char(timestamp,'yyyy.mm.dd hh24:mi:ss') from empsecond;
マテリアライズド・ビュー テスト手順
- 現在時刻の確認
select to_char(sysdate, 'yyyy.mm.dd hh24:mi:ss') now from dual;
- 下記テスト内容をそれぞれ実施
- マスターサイト 挿入→結果:○
- レプリケーションサイト 挿入→結果:○
- マスターサイト 更新→結果:○
- レプリケーションサイト 更新→結果:○
- マスターサイト 行削除→結果:○
- レプリケーションサイト 行削除→結果:○
- (競合あり) 両サイト更新。マスターサイト表を遅くcommit。→結果:○
- (競合あり) 両サイト更新。レプリケーションサイト表を遅くcommit。→結果:○
- (競合あり) マスターサイト挿入、レプリケーションサイト挿入。レプリケーションサイト遅くcommit。→結果:競合発生
- 高速リフレッシュの実行(レプリケーションサイトで実行)
conn mviewadmin/mviewadmin execute dbms_refresh.refresh('mviewadmin.scottrep_refg');
- 競合の確認(マスターサイトで実行)
conn repadmin/repadmin select deferred_tran_id,origin_tran_db, start_time,error_msg,destination from deferror;
- 競合の確認(レプリケーションサイトで実行)
conn mviewadmin/mviewadmin select deferred_tran_id,origin_tran_db, start_time,error_msg,destination from deferror;
※下記テスト内容詳細
- マスターサイト 挿入→結果:○
conn scott_rep/tiger insert into empsecond (idsecond,namesecond) values (1200,'SMI_MAS'); commit ;
- レプリケーションサイト 挿入→結果:○
conn scott_rep/tiger insert into empsecond (idsecond,namesecond) values (2345,'SMI_REP'); commit ;
- マスターサイト 更新→結果:○
update empsecond set namesecond = 'SMI_M_UP' where idsecond = 1200 ; commit ;
- レプリケーションサイト 更新→結果:○
update empsecond set namesecond = 'SMI_RE_UP' where idsecond = 2345 ; commit ;
- マスターサイト 行削除→結果:○
delete from empsecond where idsecond = 1200 ; commit ;
- レプリケーションサイト 行削除→結果:○
delete from empsecond where idsecond = 2345 ; commit ;
- (競合あり)
両サイト更新。マスターサイト表を遅くcommit。→結果:○
■■replication update empsecond set namesecond = 'SMI_R_',timestamp=sysdate where idsecond = 1200 ; commit ; □■master update empsecond set namesecond = 'SMI_M_' where idsecond = 1200 ; commit ;
- (競合あり)
両サイト更新。レプリケーションサイト表を遅くcommit。→結果:○
□■master update empsecond set namesecond = 'SMI_M_UP5' where idsecond = 1200 ; commit ; ■■replication update empsecond set namesecond = 'SMI_R_UP2',timestamp=sysdate where idsecond = 1200 ; commit ;
- (競合あり)
マスターサイト挿入、レプリケーションサイト挿入。レプリケーションサイト遅くcommit。→結果:競合発生
□■master conn scott_rep/tiger insert into empsecond (idsecond,namesecond) values (7777,'W_MAS'); commit ; ■■replication conn scott_rep/tiger insert into empsecond (idsecond,namesecond,timestamp) values (7777,'W_REP',sysdate); commit ;
- 競合解消→マスターサイト表を削除。結果は、ロールバックしてレプリケーションサイト表もない。
□■master stop conn repadmin/repadmin exec dbms_reputil.replication_off; □■master delete conn scott_rep/tiger delete from empsecond where idsecond=7777; commit; □■master start conn repadmin/repadmin exec dbms_reputil.replication_on; □■master deferror conn repadmin/repadmin exec dbms_defer_sys.delete_error(null,null) □■master 競合の確認 conn repadmin/repadmin select deferred_tran_id,origin_tran_db, start_time,error_msg,destination from deferror;
- 競合解消→マスターサイト表を削除。結果は、ロールバックしてレプリケーションサイト表もない。
ご訪問頂き有難う御座います。
当サイトを効率良く使うためにまずは FrontPage を見て下さい。
検索方法、一覧表示などの各情報を纏めています。
当サイトの説明 → Frontpage