oracle 9i stream配置備記
--prepare(2 servers)
conn / as sysdba
alter system set aq_tm_processes=2 scope=both;
alter system set global_names=true scope=both;
alter system set job_queue_processes=10 scope=both;
alter system set parallel_max_servers=20 scope=both;
alter system set undo_retention=3600 scope=both;
alter system set nls_date_format='YYYY-MM-DD HH24:MI:SS' scope=spfile;
alter system set streams_pool_size=25M scope=spfile;
alter system set utl_file_dir='*' scope=spfile;
alter system set open_links=4 scope=spfile;
-----------------------------------------------------------
--restart db(2 servers)
shutdown immediate
startup
------------------------------------------------------------
--create user:strmadmin (2 servers)
create tablespace tbs_stream datafile '/ora_data/tbs_stream01.dbf' size 100m autoextend on maxsize unlimited segment space management auto;
? 將logminer的資料字典從system表空間轉移到新建的表空間,防止撐滿system表空間
SQL> execute dbms_logmnr_d.set_tablespace('tbs_stream');
? 建立Stream管理使用者
SQL> create user strmadmin identified by strmadmin default tablespace tbs_stream temporary tablespace temp;
? 授權Stream管理使用者
SQL> grant connect,resource,dba,aq_administrator_role to strmadmin;
SQL> execute DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE('strmadmin');
-----------------------------------------------------------------
-- use supplemental log
? 啟用Database 追加日誌 (主、從資料庫上操作)
SQL> alter database add supplemental log data;
? 檢查是否被啟用
SQL> Select supplemental_log_data_min from v$database;
-----------------------------------------------------------------
--create db tns
BJDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = zuoh)(PORT = 1521))
(CONNECT_DATA =
(SERVER = SHARED)
(SERVICE_NAME = bjdb)
)
)
hbDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.31.27)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = hbdb)
)
)
------------------------------------------------------------------
--create dblink
以strmadmin身份,登入主資料庫。
SQL> connect strmadmin/strmadmin
建立資料庫鏈
SQL> create database link hbdb connect to strmadmin identified by strmadmin using 'hbdb';
3.6.2建立從資料庫資料庫鏈
以strmadmin身份,登入從資料庫。
SQL> connect strmadmin/strmadmin
建立資料庫鏈
SQL> create database link bjdb connect to strmadmin identified by strmadmin using 'bjdb';
-----------------------------------------------------------
--create streams
conn
begin
dbms_streams_adm.set_up_queue(queue_table =>'bjdbc_queue_table',queue_name =>'bjdbc_queue');
dbms_streams_adm.set_up_queue(queue_table =>'bjdbr_queue_table',queue_name =>'bjdbr_queue');
end;
/
conn
begin
dbms_streams_adm.set_up_queue(queue_table =>'hbdbc_queue_table',queue_name =>'hbdbc_queue');
dbms_streams_adm.set_up_queue(queue_table =>'hbdbr_queue_table',queue_name =>'hbdbr_queue');
end;
/
---------------------------
conn
begin
dbms_streams_adm.add_schema_rules(
schema_name => 'aaa',
streams_type => 'capture',
streams_name => 'capture_bjdb',
queue_name => 'strmadmin.bjdbc_queue',
include_dml => true,
include_ddl => true,
include_tagged_lcr => false,
source_database => null,
inclusion_rule => true);
end;
/
begin
dbms_streams_adm.add_schema_propagation_rules(
schema_name => 'aaa',
streams_name => 'bjdb_to_hbdb',
source_queue_name => 'strmadmin.bjdbc_queue',
destination_queue_name => ,
include_dml => true,
include_ddl => true,
include_tagged_lcr => false,
source_database => 'bjdb',
inclusion_rule => true);
end;
/
begin
dbms_aqadm.alter_propagation_schedule(
queue_name => 'bjdbc_queue',
destination => 'hbdb',
latency => 0);
end;
/
begin
dbms_streams_adm.add_schema_rules(
schema_name =>'aaa',
streams_type =>'apply',
streams_name =>'apply_bjdb',
queue_name =>'strmadmin.bjdbr_queue',
include_dml => true,
include_ddl => true,
include_tagged_lcr => false,
source_database => 'hbdb',
inclusion_rule => true);
end;
/
---------------------------------------------------------------------
conn
begin
dbms_streams_adm.add_schema_rules(
schema_name => 'aaa',
streams_type => 'capture',
streams_name => 'capture_hbdb',
queue_name => 'strmadmin.hbdbc_queue',
include_dml => true,
include_ddl => true,
include_tagged_lcr => false,
source_database => null,
inclusion_rule => true);
end;
/
begin
dbms_streams_adm.add_schema_propagation_rules(
schema_name => 'aaa',
streams_name => 'hbdb_to_bjdb',
source_queue_name => 'strmadmin.hbdbc_queue',
destination_queue_name => ,
include_dml => true,
include_ddl => true,
include_tagged_lcr => false,
source_database => 'hbdb',
inclusion_rule => true);
end;
/
declare
iscn number;
begin
iscn:=dbms_flashback.get_system_change_number();
(
source_schema_name => 'aaa',
source_database_name => 'hbdb',
instantiation_scn => iscn);
end;
/
begin
dbms_streams_adm.add_schema_rules(
schema_name =>'aaa',
streams_type =>'apply',
streams_name =>'apply_hbdb',
queue_name =>'strmadmin.hbdbr_queue',
include_dml => true,
include_ddl => true,
include_tagged_lcr => false,
source_database => 'bjdb',
inclusion_rule => true);
end;
/
---------------------------------------------------------
--sync on bjdb server
exp file='/ora_data/aaa.dmp' object_consistent=y rows=y
imp file='/ora_data/aaa.dmp' ignore=y commit=y log='/ora_data/aaa.log' streams_instantiation=y fromuser=aaa touser=aaa
--sync on hbdb server
exp file='/ora_data/aaa.dmp' object_consistent=y rows=y
imp file='/ora_data/aaa.dmp' ignore=y commit=y log='/ora_data/aaa.log' streams_instantiation=y fromuser=aaa touser=aaa
--or
declare
iscn number;
begin
iscn:=dbms_flashback.get_system_change_number();
=> 'aaa',source_database_name => 'bjdb',instantiation_scn => iscn);
end;
----------------------------------
--start 2 dbs sync
conn
begin
dbms_apply_adm.start_apply('apply_hbdb');
end;
/
-------------------------------------------------
conn
begin
dbms_capture_adm.start_capture('capture_bjdb');
dbms_propagation_adm.start_propagation('bjdb_to_hbdb');
dbms_apply_adm.start_apply('apply_bjdb');
end;
/
----------------------------------------------------------
conn
begin
dbms_capture_adm.start_capture('capture_hbdb');
dbms_propagation_adm.start_propagation('hbdb_to_bjdb');
end;
/
-----------------------------------------------------
--test sql
select mdn, imsi from mdn_imsi;
insert into mdn_imsi (mdn,imsi) values ('bbbbb','bbbbb');
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-617908/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 9i 配置備用資料庫步驟Oracle資料庫
- Oracle Stream概述與配置Oracle
- Oracle Stream配置詳細步驟Oracle
- Oracle 9i配置Statspack工具(下)Oracle
- Oracle 9i配置Statspack工具(上)Oracle
- Oracle 9i備份和恢復Oracle
- Oracle Stream的安裝、配置和使用Oracle
- 配置oracle 9i physical standby database時,duplicate命令的執行記錄OracleDatabase
- 一步一步配置Oracle StreamOracle
- jive+oracle 9i 配置問題 急!!~~~Oracle
- ORACLE10g Stream表級複製配置Oracle
- Oracle10g新特性之stream流配置Oracle
- 企業級災備方案Oracle Stream搭建過程Oracle
- Oracle 9i統計資訊備份與恢復Oracle
- Oracle 9i R2 配置 Logical StandbyOracle
- Oracle Stream實戰(7)—測試環境準備(六)Oracle
- Oracle Stream實戰(6)—測試環境準備(五)Oracle
- Oracle Stream實戰(5)—測試環境準備(四)Oracle
- Oracle Stream實戰(4)—測試環境準備(三)Oracle
- Oracle Stream實戰(3)—測試環境準備(二)Oracle
- Oracle Stream實戰(2)—測試環境準備(一)Oracle
- 一步一步配置ORACLE STREAM【轉載】Oracle
- Oracle Stream配置詳細步驟(使用者模式)Oracle模式
- stream配置總結
- Oracle 9i的備份和恢復機制(轉)Oracle
- 區別oracle 9i 與 oracle 10g 備份表空間Oracle 10g
- ORACLE STREAM ERROROracleError
- restart oracle streamRESTOracle
- Oracle simple streamOracle
- ORACLE10g Stream使用者級複製配置Oracle
- Oracle 9i DBA Fundamentals I學習筆記(二)Oracle筆記
- Oracle stream案例分享Oracle
- oracle stream pool sizeOracle
- oracle STREAM 單向使用者配置流程步驟總結Oracle
- turbo linux ipmp配置備記Linux
- 《ORACLE 9i/10g/11g程式設計藝術》學習筆記 配置環境Oracle程式設計筆記
- ORACLE dataguar 配置筆記Oracle筆記
- Oracle 9i RAC向單例項遷移手記Oracle單例