oracle 10g stream weihu

imlihj2007發表於2013-05-03

1 啟動apply,propagation和capture程式的語句
exec dbms_capture_adm.start_capture(capture_name=>'CAPTURE_DB1_STRM');
exec dbms_apply_adm.start_apply(apply_name=>'APPLY_DB2_STRM');
exec dbms_propagation_adm.start_propagation('PROP_DB1_TO_DB2_STRM');

2 停止apply,propagation和capture程式的語句
exec dbms_capture_adm.stop_capture(capture_name=>'CAPTURE_DB1_STRM');
exec dbms_apply_adm.stop_apply(apply_name=>'APPLY_DB2_STRM');
exec dbms_propagation_adm.stop_propagation('PROP_DB1_TO_DB2_STRM');

3 刪除apply,propagation和capture流及佇列和相應的規則集和規則的語句
exec dbms_capture_adm.stop_capture('capture_cap1_strm');
exec dbms_capture_adm.drop_capture('capture_cap1_strm');

exec dbms_propagation_adm.stop_propagation('prop_cap1_to_app1_strm');
exec dbms_propagation_adm.drop_propagation(propagation_name=> 'prop_cap1_to_app1_strm',drop_unused_rule_sets=> true);

exec dbms_apply_adm.stop_apply('apply_app1_strm');
exec dbms_apply_adm.drop_apply('apply_app1_strm');

exec dbms_aqadm.stop_queue(queue_name => 'capture_cap1_qn');
exec dbms_aqadm.drop_queue(queue_name => 'capture_cap1_qn');
exec dbms_aqadm.drop_queue_table(queue_table => 'capture_cap1_qt');
?
begin
(
object_name => 'SCOTT.BONUS1',
object_type => 'TABLE',
operation_name => 'INSERT',
user_procedure => null,
apply_name => 'APPLY_APP1_STRM',
assemble_lobs => true);
end;
/

8.4 在本地資料庫中清除整個流配置
exec dbms_streams_adm.remove_streams_configuration;
注:此語句及其危險,並且有時也不見得能徹底清除所有的與流有關的物件。

------------------------------------------------------------------------------------------------------------
8.5 資料庫級例項化過程
declare
iscn number; -- Variable to hold instantiation SCN value
begin
iscn := dbms_flashback.get_system_change_number();

(source_database_name => 'rep1',
instantiation_scn => iscn ,
recursive =>true
);
end;
/

8.6 使用者級例項化過程
declare
iscn number; -- Variable to hold instantiation SCN value
begin
iscn := dbms_flashback.get_system_change_number ();

(source_schema_name => 'SCOTT',
source_database_name => 'REP1',
instantiation_scn => iscn,
recursive => true);
end;
/

庫表級例項化過程
declare
iscn number; -- Variable to hold instantiation SCN value
begin
iscn := dbms_flashback.get_system_change_number ();

(source_object_name => 'SCOTT.BONUS',
source_database_name => 'REP1',
instantiation_scn => iscn);
end;
/
-----------------------------------------------------------------------------------
8.20 清除指定應用程式的錯誤佇列
EXEC DBMS_APPLY_ADM.DELETE_ALL_ERRORS(apply_name =>'APPLY_DB2_STRM');
8.21 清除錯誤佇列中指定應用事務的錯誤
EXEC DBMS_APPLY_ADM.DELETE_ERROR(local_transaction_id=>'5.4.312');
8.22 重新應用錯誤佇列中指定的出錯事務
EXEC DBMS_APPLY_ADM.EXECUTE_ERROR(local_transaction_id =>'5.23.1004', execute_as_user =>FALSE,user_procedure =>NULL);
注:execute_as_user =>FALSE表示在原有應用事務環境執行。
8.23 重新應用錯誤佇列中所有出錯事務
EXEC DBMS_APPLY_ADM.EXECUTE_ALL_ERRORS(apply_name=>'APPLY_DB2_STRM',execute_as_user=>FALSE);
-------------------------------------------------------------------------------
Streams配置和管理的相關package
dbms_steams_adm
dbms_capture_adm
dbms_propagation_adm
dbms_apply_adm
dbms_rule_adm

Streams主要相關資料字典
dba_streams_administrator
dba_capture
dba_capture_parameters
dba_propagation
dba_registered_archived_log
dba_apply
dba_apply_confict_columns
dba_apply_dml_handlers
dba_apply_enqueue
dba_apply_error
dba_apply_execute
dba_apply_parameters
dba_apply_progress
dba_rules
dba_rule_sets
dba_rule_set_rules
select * from V$STREAMS_CAPTURE
V$STREAMS_POOL_ADVICE
V$STREAMS_TRANSACTION
V$PROPAGATION_RECEIVER
V$PROPAGATION_SENDER
V$STREAMS_APPLY_COORDINATOR
V$STREAMS_APPLY_READER
V$STREAMS_APPLY_SERVER


select * from dba_capture
select * from dba_rule_set_rules

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9879835/viewspace-1060462/,如需轉載,請註明出處,否則將追究法律責任。

相關文章