SlideShare una empresa de Scribd logo
1 de 16
Descargar para leer sin conexión
配置 Oracle 10g 双向流
       复制


     by Maclean.liu
           liu.maclean@gmail.com
       www.oracledatabase12g.com
About Me

l Email:liu.maclean@gmail.com
l Blog:www.oracledatabase12g.com
l Oracle Certified Database Administrator Master 10g
and 11g
l Over 6 years experience with Oracle DBA technology
l Over 7 years experience with Linux technology
l Member Independent Oracle Users Group
l Member All China Users Group
l Presents for advanced Oracle topics: RAC,
DataGuard, Performance Tuning and Oracle Internal.
构建 Oracle 双向流复制是一个十分复杂的过程,我写这个文档的目的是尽量有条理地列出所需做的工作,帮助
DBA 更有效的建设流复制环境。




1.以 scott 模式为复制示例,一般只要在创建数据库时选择了安装 sample schema,都会存在该 scott 模式;至少
保证源库中存在该 schema,以便可以初始化到目标库中。
2.在源和目标 2 个数据库中创建 strmadmin 流管理用户,当然你也可以选用其他名字。同时在 2 个库中都要创建
streams 使用的表空间,以便让 logmnr 使用它:



CREATE TABLESPACE streams_tbs DATAFILE 'XXXXXX' SIZE 100M REUSE AUTOEXTEND ON MAXSIZE
UNLIMITED;


/* 10g r2 中 logmnr 默认使用 SYSAUX 表空间 */


exec DBMS_LOGMNR_D.SET_TABLESPACE ('streams_tbs');


/* 创建完表空间后,接着要创建 strmadmin 用户 */


CREATE USER strmadmin IDENTIFIED BY strmadmin
DEFAULT TABLESPACE streams_tbs
QUOTA UNLIMITED ON streams_tbs;


GRANT DBA TO strmadmin;


BEGIN
DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE(
grantee => 'strmadmin',
grant_privileges => true);
END;
/


/* 可以通过查询 dba_streams_administrator 视图检查用户是否正确授予流管理权限 */


SQL> SELECT * FROM dba_streams_administrator;


USERNAME                         LOC ACC
------------------------------ --- ---
MACLEAN                          YES YES
STRMADMIN                        YES YES
3.在 2 边数据库中都需要设置合理的实例初始化参数,我们以 10g release2 为例:




参数名与推荐值:_job_queue_interval = 1
描述:job 的队列的扫描参数,默认为 5,即 5s 扫描一次
出于何种考虑:设置较小的_job_queue_interval 有利于 propagation 作业
如何设置:alter system set "_job_queue_interval"=1 scope=spfile;


/* 注意 scope=spfile 的参数都需要重启实例方能生效 */


参数名与推荐值:COMPATIBLE>= 10.2.0.0
描述:数据库版本兼容性参数,以前介绍过,不再展开
出于何种考虑:10g release2 的部分 Streams 新特性要求该参数至少为 10.2.0.0 或更高
如何设置:只有从较低版本升级到 10g r2 的数据库需要设置该参数,
alter system set compatible="10.2.0.0" scope=spfile;


参数名与推荐值:GLOBAL_NAMES=true
描述:指定是否要求 database link 名与数据库全局名一致,默认为 FALSE 也就是不需要一致
出于何种考虑:帮助我们准确识别 database link 和数据库的关系,避免误操作
如何设置:alter system set global_names=true scope=spfile;


参数名与推荐值:job_queue_processes>4
描述:指定了实例中 job 队列进程的数量(如 J000…J999).
出于何种考虑:该参数控制了实例中能够并行运行的 job 的最大值,应设一个大于已配置的 propagations
数量的值,同时也要考虑到可能还有其他数据库作业
如何设置:alter system set job_queue_processes=15;


参数名与推荐值:PARALLEL_MAX_SERVERS
描述:指定了实例中最大并行进程的数量
出于何种考虑:
在 Streams 环境中,capture 进程和 apply 进程都会用到多个并行进程。
设置该初始化参数为适当值(10*CPU#)以保证总是有足够的可用并行进程;
每多一个 capture 或 apply 进程,则有必要为该参数+2 再加上加入的 capture 或 apply 进程的并行度 parallelism
参数。
如何设置:
alter system set PARALLEL_MAX_SERVERS=40;


参数名与推荐值:REMOTE_ARCHIVE_ENABLE
描述:指定是否将归档日志传送到远程目的地
出于何种考虑:只有 downstream capture 时会用到,不展开
参数名与推荐值:SGA_MAX_SIZE
描述:设置合理的 SGA 内存最大值
出于何种考虑:常见参数,不展开


参数名与推荐值:SGA_TARGET=0
描述:disable 掉 10g 中的 Automatic Shared Memory Management.
出于何种考虑:Oracle 推荐在 stream 环境中手动指定 streams_pool 和 shared_pool 的大小而不使用 10g 中的内
存自动管理特性
如何设置:
alter system set sga_target=0;


参数名与推荐值:调优 STREAMS_POOL_SIZE
描述:
为流池指定大小。流池包括了缓存的队列消息。此外,流池也会被用于并行 capture 和 apply 的内部通信。
建议参考 V$STREAMS_POOL_ADVICE 视图的信息判断最佳大小,避免 spill 溢出
出于何种考虑:
该参数可以动态修改。若该参数归零则实例中 streams 相关的进程和作业都将无法运行。流池的大小受到以下因素的影
响:
1.capture 进程的并行度,每增加一个 capture 进程有必要为流池增加 10MB 的大小;
此外当 capture 参数 PARALLELISM 大于 1 时,有必要为流池增加 10Mb*parallelism 的大小;
举例来说,若某 capture 进程的并行度 parallelism 设置为 3,则需要为 Streams 池增加 30Mb。
2.apply 进程的并行度,每增加一个 apply 进程有必要为 streams pool 增加 1MB;
此外当 apply 进程的并行度大于 1 时,为 streams pool 增加 1Mb*parallelism 的大小;
举例来说某 apply 进程的 parallelism 被设置为 5,则需要为 streams 池增加 5Mb。
3.Logical Change Records(LCRS)被存储在 buffered queues 缓存队列中;
适当增加 Streams pool 大小以适应源库和目标库上数据复制的数据量;
Oracle 建议在低负载的数据库上最小设置 Streams pool 为 256Mb,而在活跃度高的 OLTP 环境中设置为 500Mb;
通过 V$STREAMS_POOL_ADVISE 视图给出的建议进一步调整 Streams Pool 的大小
到一个合理值以避免过多的缓存队列溢出到磁盘上。


如何设置:
select * from v$streams_pool_advice;
/* 查询 v$streams_pool_advice 视图了解不同 streams_Pool_size 情况下的 estd_spill_time */


alter system set streams_pool_size=500M;




完成以上设置后建议重启实例以便让全部参数生效,2 边都要做。
4.为 scott schema 下的对象创建追加日志(supplemental log),可以使用 dbms_capture_adm 包的
prepare_schema_instantiation 存储过程为指定模式创建追加日志:



NAME

 prepare_schema_instantiation()
FUNCTION

 prepare a schema for instantiation
PARAMETERS

 schema_name            - (IN)    the name of the schema to prepare

 supplemental_logging   - (IN)    supplemental logging level

                  ('NONE', 'KEYS', or 'ALL')
NOTES

 KEYS means PRIMARY KEY, UNIQUE INDEX, and FOREIGN KEY levels combined.
----------------------------------------------------------------------------*/

 PROCEDURE prepare_schema_instantiation(

 schema_name            IN VARCHAR2,

 supplemental_logging   IN VARCHAR2 DEFAULT 'KEYS');


/* 其默认 supplemental_logging 选项为 Key,即为 PRIMARY KEY, UNIQUE INDEX, and FOREIGN KEY 等键

  创建 IMPLICIT 的追加日志 */


/* 在 10g 或以上版本中 prepare_xxx_instantiation 存储过程也会隐式地创建追加日志组了
(In versions 10g and above,prepare_xxx_instantiation procedure implicitly creates
supplemenal log groups.
Type of supplemental logging that is enabled implicitly using this command can be checked
using the sql in the following link to the documentation. However, additional
supplemental
logging might need to be enabled depending on the requirements as mentioned above)。
可以通过以下查询了解其追加日志组的属性:
SELECT SCHEMA_NAME,

   SUPPLEMENTAL_LOG_DATA_PK log_pk,

   SUPPLEMENTAL_LOG_DATA_FK log_fk,

   SUPPLEMENTAL_LOG_DATA_UI log_ui,

   SUPPLEMENTAL_LOG_DATA_ALL log_all

 FROM DBA_CAPTURE_PREPARED_SCHEMAS;


SCHEMA_NAME                      LOG_PK   LOG_FK   LOG_UI   LOG_ALL
------------------------------ -------- -------- -------- --------
SCOTT                            IMPLICIT IMPLICIT IMPLICIT NO
5.在源库上创建到目标库 strmadmin 用户的 database link:



conn strmadmin/strmadmin;
Connected.


create database link clinicb.rh3.oracle.com connect to strmadmin identified by strmadmin
using 'clinicb.rh3.oracle.com';
Database link created.
/* 其中 clinicb.rh3.oracle.com 为目标库的全局数据库名,clinicb 为 db_name,rh3.oracle.com 为
domain_name */




在目标库上创建到源库 strmadmin 用户的 database link:



conn strmadmin/strmadmin;
Connected.


create database link clinica.rh2.oracle.com connect to strmadmin identified by strmadmin
using 'clinica.rh2.oracle.com';
Database link created.


/* 其中 clinica.rh2.oracle.com 为源库的全局数据库名,clinica 为数据库名,rh2.oracle.com 为
domain_name */




6.在源库中分别为 capture 和 apply 创建队列 queue:



begin
dbms_streams_adm.set_up_queue(
queue_table => 'apply_srctab',
queue_name => 'apply_src',
queue_user => 'strmadmin');
end;
/
PL/SQL procedure successfully completed.


begin
dbms_streams_adm.set_up_queue(
queue_table => 'capture_srctab',
queue_name => 'capture_src',
queue_user => 'strmadmin');
end;
/
PL/SQL procedure successfully completed.


在目标库分别为 capture 和 apply 创建队列 queue:



conn strmadmin/strmadmin@clinicb.rh3.oracle.com
Connected.


begin
dbms_streams_adm.set_up_queue(
queue_table => 'apply_desttab',
queue_name => 'apply_dest',
queue_user => 'strmadmin');
end;
/


PL/SQL procedure successfully completed.


begin
dbms_streams_adm.set_up_queue(
queue_table => 'capture_desttab',
queue_name => 'capture_dest',
queue_user => 'strmadmin');
end;
/


PL/SQL procedure successfully completed.




8.在源库 clinica 上为 scott 模式创建 capture process:



conn strmadmin/strmadmin@clinica.rh2.oracle.com
Connected.


begin
dbms_streams_adm.add_schema_rules (
schema_name => 'scott',
streams_type => 'capture',
streams_name => 'captures_src',
queue_name => 'capture_src',
include_dml => true,
include_ddl => true,
inclusion_rule => true);
end;
/
PL/SQL procedure successfully completed.




9.在源库 clinica 上创建 apply process:




conn strmadmin/strmadmin@clinica.rh2.oracle.com
Connected.


begin
dbms_streams_adm.add_schema_rules (
schema_name => 'scott',
streams_type => 'apply',
streams_name => 'applys_src',
queue_name => 'apply_src',
include_dml => true,
include_ddl => true,
source_database => 'clinicb.rh3.oracle.com');
end;
/


PL/SQL procedure successfully completed.




10.若需要在源库中解决冲突处理,则有必要设置 conflict handlers,可以参考这个 streams 文件链
接:http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14228/conflict.htm




11.在源库 clinica 上配置 propagation process:



conn strmadmin/strmadmin@clinica.rh2.oracle.com
Connected.


begin
dbms_streams_adm.add_schema_propagation_rules (
schema_name => 'scott',
streams_name => 'prop_src_to_dest',
source_queue_name => 'capture_src',
destination_queue_name => 'apply_dest@clinicb.rh3.oracle.com',
include_dml => true,
include_ddl => true,
source_database => 'clinica.rh2.oracle.com');
end;
/


PL/SQL procedure successfully completed.




12.在目标库 clinicb 上配置 capture process:



conn strmadmin/strmadmin@clinicb.rh3.oracle.com
Connected.


begin
dbms_streams_adm.add_schema_rules (
schema_name => 'scott',
streams_type => 'capture',
streams_name => 'captures_dest',
queue_name => 'capture_dest',
include_dml => true,
include_ddl => true);
end;
/
PL/SQL procedure successfully completed.




13.在原库 clinica 上以目标库 clinicb 的 SCN 设置模式实例化 SCN(schema instantiation SCN):



conn strmadmin/strmadmin@clinicb.rh3.oracle.com
Connected.


declare
v_scn number;
begin
v_scn := dbms_flashback.get_system_change_number();
dbms_apply_adm.set_schema_instantiation_scn@clinica.rh2.oracle.com(
source_schema_name => 'scott',
source_database_name => 'clinicb.rh3.oracle.com',
instantiation_scn => v_scn,
recursive => true);
end;
/




14.在目标库 clinicb 上配置 apply process:




conn strmadmin/strmadmin@clinicb.rh3.oracle.com
Connected.


begin
dbms_streams_adm.add_schema_rules (
schema_name => 'scott',
streams_type => 'apply',
streams_name => 'applys_dest',
queue_name => 'apply_dest',
include_dml => true,
include_ddl => true,
source_database => 'clinica.rh2.oracle.com');
end;
/
PL/SQL procedure successfully completed.




15.在目标库上配置 propagation process:



conn strmadmin/strmadmin@clinicb.rh3.oracle.com
Connected.


begin
dbms_streams_adm.add_schema_propagation_rules (
schema_name => 'scott',
streams_name => 'prop_dest_to_src',
source_queue_name => 'capture_dest',
destination_queue_name => 'apply_src@clinica.rh2.oracle.com',
include_dml => true,
include_ddl => true,
source_database => 'clinicb.rh3.oracle.com');
end;
/
PL/SQL procedure successfully completed.




16.在目标库上初始化 scott 模式下的对象,有多种方法可以完成初始化。若对象均不存在,在可以使用
export/import 导入导出工具完成 instantiation,若对象均已经存在,则直接使用
dbms_apply_adm.set_schema_instantiation_scn 存储过程。
我们的环境中 scott 模式已存在于目标库中:



conn strmadmin/strmadmin@clinica.rh2.oracle.com
Connected.


declare
v_scn number;
begin
v_scn := dbms_flashback.get_system_change_number();
dbms_apply_adm.set_schema_instantiation_scn@clinicb.rh3.oracle.com(
source_schema_name => 'scott',
source_database_name => 'clinica.rh2.oracle.com',
instantiation_scn => v_scn,
recursive => true);
end;
/
PL/SQL procedure successfully completed.




17.若需要在目标库中解决冲突处理,则有必要设置 conflict handlers,可以参考这个 streams 文件链接:
http://download-east.oracle.com/docs/cd/B19306_01/server. 102/b14228/conflict.htm




18.在目标库中启动 capture 和 apply 进程:



启动 Apply:
/* 以 disable_on_erro 参数为'N'启动 apply 进程,即便遭遇错误,apply 也会继续处理 LCR */


conn strmadmin/strmadmin@clinicb.rh3.oracle.com
Connected.


begin
dbms_apply_adm.set_parameter (
apply_name => 'applys_dest',
parameter => 'disable_on_error',
value => 'N');
end;
/
PL/SQL procedure successfully completed.


exec dbms_apply_adm.start_apply (apply_name=> 'applys_dest');
PL/SQL procedure successfully completed.


在目标库中启动 capture process:



exec dbms_capture_adm.start_capture (capture_name=>'captures_dest');


PL/SQL procedure successfully completed.




19.同样的在源库启动 capture 和 apply 进程:



begin
dbms_apply_adm.set_parameter (
apply_name => 'applys_src',
parameter => 'disable_on_error',
value => 'N');
end;
/


PL/SQL procedure successfully completed.


exec dbms_apply_adm.start_apply (apply_name=> 'applys_src');


PL/SQL procedure successfully completed.


在源库启动 capture:
exec dbms_capture_adm.start_capture (capture_name=>'captures_src');


PL/SQL procedure successfully completed.
20.测试双向流复制是否成功:



测试 ddl 语句:


SQL> conn scott/tiger@clinica.rh2.oracle.com
Connected.
SQL> create table test_streams(t1 int);


Table created.


SQL> conn scott/tiger@clinicb.rh3.oracle.com
Connected.
SQL> desc test_streams;

Name                                      Null?    Type

----------------------------------------- -------- ----------------------------

T1                                                 NUMBER(38)


SQL> create table anti_test(t1 int);


Table created.


SQL> conn scott/tiger@clinica.rh2.oracle.com
Connected.
SQL> desc anti_test;

Name                                      Null?    Type

----------------------------------------- -------- ----------------------------

T1                                                 NUMBER(38)


/* ddl 语句双向复制成功 */


测试 dml 语句:
SQL> conn scott/tiger@clinica.rh2.oracle.com
Connected.
SQL> desc emp;

Name                                      Null?    Type

----------------------------------------- -------- ----------------------------

EMPNO                                     NOT NULL NUMBER(4)

ENAME                                              VARCHAR2(10)

JOB                                                VARCHAR2(9)

MGR                                                NUMBER(4)
HIREDATE                                       DATE

SAL                                            NUMBER(7,2)

COMM                                           NUMBER(7,2)

DEPTNO                                         NUMBER(2)


SQL> update emp set sal=sal+50;


14 rows updated.


SQL> commit;


Commit complete.


SQL> select sum(sal) from emp;


 SUM(SAL)
----------

  29725


SQL> conn scott/tiger@clinicb.rh3.oracle.com
Connected.
SQL> select sum(sal) from emp;


 SUM(SAL)
----------

  29725


SQL> update emp set sal=sal+50;


14 rows updated.


SQL> commit;


Commit complete.


SQL> select sum(sal) from emp;


 SUM(SAL)
----------

  30425
SQL>   conn scott/tiger@clinica.rh2.oracle.com
Connected.
SQL> select sum(sal) from emp;


 SUM(SAL)
----------

   30425


/* dml 语句双向复制成功 */




Reference:
Oracle Streams Replication Example:http://prodlife.wordpress.com/2008/02/21/oracle-streams-replication-
example/
Oracle Streams: Recommendations for Heartbeat table:http://ksadba.wordpress.com/2008/07/02/oracle-
streams-recommendations-for-heartbeat-table/




© 2010, www.oracledatabase12g.com. 版权所有.文章允许转载,但必须以链接方式注明源地址,否则追求法律责
任.

Más contenido relacionado

La actualidad más candente

7, OCP - configure database for backup and recovery
7, OCP - configure database for backup and recovery7, OCP - configure database for backup and recovery
7, OCP - configure database for backup and recoveryted-xu
 
Essential oracle security internal for dba
Essential oracle security internal for dbaEssential oracle security internal for dba
Essential oracle security internal for dbamaclean liu
 
了解Oracle critical patch update
了解Oracle critical patch update了解Oracle critical patch update
了解Oracle critical patch updatemaclean liu
 
A.oracle 查询结果的缓存问题
A.oracle 查询结果的缓存问题A.oracle 查询结果的缓存问题
A.oracle 查询结果的缓存问题WASecurity
 
PostgreSQL 9 Standby
PostgreSQL 9 StandbyPostgreSQL 9 Standby
PostgreSQL 9 StandbyMarch Liu
 
TomCat迁移步骤简述以及案例
TomCat迁移步骤简述以及案例TomCat迁移步骤简述以及案例
TomCat迁移步骤简述以及案例maclean liu
 
Puppet安装测试
Puppet安装测试Puppet安装测试
Puppet安装测试Yiwei Ma
 
My sql 同步
My sql 同步My sql 同步
My sql 同步Yiwei Ma
 
【诗檀软件 郭兆伟-技术报告】跨国企业级Oracle数据库备份策略
【诗檀软件 郭兆伟-技术报告】跨国企业级Oracle数据库备份策略【诗檀软件 郭兆伟-技术报告】跨国企业级Oracle数据库备份策略
【诗檀软件 郭兆伟-技术报告】跨国企业级Oracle数据库备份策略maclean liu
 
dbdao.com 汪伟华 my-sql-replication复制高可用配置方案
dbdao.com 汪伟华 my-sql-replication复制高可用配置方案dbdao.com 汪伟华 my-sql-replication复制高可用配置方案
dbdao.com 汪伟华 my-sql-replication复制高可用配置方案maclean liu
 
Oracle试题Exam Adminv1.1
Oracle试题Exam Adminv1.1Oracle试题Exam Adminv1.1
Oracle试题Exam Adminv1.1Zianed Hou
 
Hadoop基线选定
Hadoop基线选定Hadoop基线选定
Hadoop基线选定baggioss
 
Mysql展示功能与源码对应
Mysql展示功能与源码对应Mysql展示功能与源码对应
Mysql展示功能与源码对应zhaolinjnu
 
Puppet安装总结
Puppet安装总结Puppet安装总结
Puppet安装总结Yiwei Ma
 
手机之家的数据访问层实践
手机之家的数据访问层实践手机之家的数据访问层实践
手机之家的数据访问层实践guestf5121c
 
Oracle 資料庫檔案介紹
Oracle 資料庫檔案介紹Oracle 資料庫檔案介紹
Oracle 資料庫檔案介紹Chien Chung Shen
 

La actualidad más candente (19)

7, OCP - configure database for backup and recovery
7, OCP - configure database for backup and recovery7, OCP - configure database for backup and recovery
7, OCP - configure database for backup and recovery
 
Essential oracle security internal for dba
Essential oracle security internal for dbaEssential oracle security internal for dba
Essential oracle security internal for dba
 
了解Oracle critical patch update
了解Oracle critical patch update了解Oracle critical patch update
了解Oracle critical patch update
 
A.oracle 查询结果的缓存问题
A.oracle 查询结果的缓存问题A.oracle 查询结果的缓存问题
A.oracle 查询结果的缓存问题
 
PostgreSQL 9 Standby
PostgreSQL 9 StandbyPostgreSQL 9 Standby
PostgreSQL 9 Standby
 
Oracle Tablespace介紹
Oracle Tablespace介紹Oracle Tablespace介紹
Oracle Tablespace介紹
 
TomCat迁移步骤简述以及案例
TomCat迁移步骤简述以及案例TomCat迁移步骤简述以及案例
TomCat迁移步骤简述以及案例
 
Puppet安装测试
Puppet安装测试Puppet安装测试
Puppet安装测试
 
My sql 同步
My sql 同步My sql 同步
My sql 同步
 
【诗檀软件 郭兆伟-技术报告】跨国企业级Oracle数据库备份策略
【诗檀软件 郭兆伟-技术报告】跨国企业级Oracle数据库备份策略【诗檀软件 郭兆伟-技术报告】跨国企业级Oracle数据库备份策略
【诗檀软件 郭兆伟-技术报告】跨国企业级Oracle数据库备份策略
 
dbdao.com 汪伟华 my-sql-replication复制高可用配置方案
dbdao.com 汪伟华 my-sql-replication复制高可用配置方案dbdao.com 汪伟华 my-sql-replication复制高可用配置方案
dbdao.com 汪伟华 my-sql-replication复制高可用配置方案
 
Oracle试题Exam Adminv1.1
Oracle试题Exam Adminv1.1Oracle试题Exam Adminv1.1
Oracle试题Exam Adminv1.1
 
Hadoop基线选定
Hadoop基线选定Hadoop基线选定
Hadoop基线选定
 
Mysql展示功能与源码对应
Mysql展示功能与源码对应Mysql展示功能与源码对应
Mysql展示功能与源码对应
 
Puppet安装总结
Puppet安装总结Puppet安装总结
Puppet安装总结
 
Oracle 資料庫建立
Oracle 資料庫建立Oracle 資料庫建立
Oracle 資料庫建立
 
手机之家的数据访问层实践
手机之家的数据访问层实践手机之家的数据访问层实践
手机之家的数据访问层实践
 
Oracle Instance 介紹
Oracle Instance 介紹Oracle Instance 介紹
Oracle Instance 介紹
 
Oracle 資料庫檔案介紹
Oracle 資料庫檔案介紹Oracle 資料庫檔案介紹
Oracle 資料庫檔案介紹
 

Destacado

诗檀软件 Oracle开发优化基础
诗檀软件 Oracle开发优化基础 诗檀软件 Oracle开发优化基础
诗檀软件 Oracle开发优化基础 maclean liu
 
SDN 2010: Using Social Nodes to Design Services_Eleanor Davies
SDN 2010: Using Social Nodes to Design Services_Eleanor DaviesSDN 2010: Using Social Nodes to Design Services_Eleanor Davies
SDN 2010: Using Social Nodes to Design Services_Eleanor DaviesEleanor Davies
 
Purpose & Standards Energy Field
Purpose & Standards Energy FieldPurpose & Standards Energy Field
Purpose & Standards Energy FieldMario Pinardo
 
Managing expectations can we really call on our big blue brother- busch
Managing expectations  can we really call on our big blue brother- buschManaging expectations  can we really call on our big blue brother- busch
Managing expectations can we really call on our big blue brother- buschLeishman Associates
 
Understanding the wealth-creating potential of relationships :: Kredible.net ...
Understanding the wealth-creating potential of relationships :: Kredible.net ...Understanding the wealth-creating potential of relationships :: Kredible.net ...
Understanding the wealth-creating potential of relationships :: Kredible.net ...Jukka Huhtamäki
 
New Zealand Franchising Confidence Index | July 2013
New Zealand Franchising Confidence Index | July 2013New Zealand Franchising Confidence Index | July 2013
New Zealand Franchising Confidence Index | July 2013Franchize Consultants
 
Decommissioning and dismantling of the moata reactor a radiation protection ...
Decommissioning and dismantling of the moata reactor  a radiation protection ...Decommissioning and dismantling of the moata reactor  a radiation protection ...
Decommissioning and dismantling of the moata reactor a radiation protection ...Leishman Associates
 
Some key considerations relating anastas
Some key considerations relating anastasSome key considerations relating anastas
Some key considerations relating anastasLeishman Associates
 
Kutná hora ii.
Kutná hora ii.Kutná hora ii.
Kutná hora ii.AlfickaH
 
Comprehensive Soldier Fitness Concept- Baker
Comprehensive Soldier Fitness Concept- BakerComprehensive Soldier Fitness Concept- Baker
Comprehensive Soldier Fitness Concept- BakerLeishman Associates
 
Vie Politique : Marine le Pen
Vie Politique : Marine le PenVie Politique : Marine le Pen
Vie Politique : Marine le PenKantar
 
Poliittisen viestinnän sisäpiirit Twitterissä
Poliittisen viestinnän sisäpiirit TwitterissäPoliittisen viestinnän sisäpiirit Twitterissä
Poliittisen viestinnän sisäpiirit TwitterissäJukka Huhtamäki
 
Skills & Habits Energy Field
Skills & Habits Energy FieldSkills & Habits Energy Field
Skills & Habits Energy FieldMario Pinardo
 
Example of-child-protection-policy-for-voluntary-organisations
Example of-child-protection-policy-for-voluntary-organisationsExample of-child-protection-policy-for-voluntary-organisations
Example of-child-protection-policy-for-voluntary-organisationsMarivic Aloc
 
【Ask maclean技术分享oracle数据库优化】awr鹰眼系列awr报告全面指标分析
【Ask maclean技术分享oracle数据库优化】awr鹰眼系列awr报告全面指标分析【Ask maclean技术分享oracle数据库优化】awr鹰眼系列awr报告全面指标分析
【Ask maclean技术分享oracle数据库优化】awr鹰眼系列awr报告全面指标分析maclean liu
 
Towards a Quality Framework for Online Educator Professional Development Acti...
Towards a Quality Framework for Online Educator Professional Development Acti...Towards a Quality Framework for Online Educator Professional Development Acti...
Towards a Quality Framework for Online Educator Professional Development Acti...Stefaan Vande Walle
 

Destacado (20)

诗檀软件 Oracle开发优化基础
诗檀软件 Oracle开发优化基础 诗檀软件 Oracle开发优化基础
诗檀软件 Oracle开发优化基础
 
Melide
MelideMelide
Melide
 
SDN 2010: Using Social Nodes to Design Services_Eleanor Davies
SDN 2010: Using Social Nodes to Design Services_Eleanor DaviesSDN 2010: Using Social Nodes to Design Services_Eleanor Davies
SDN 2010: Using Social Nodes to Design Services_Eleanor Davies
 
Purpose & Standards Energy Field
Purpose & Standards Energy FieldPurpose & Standards Energy Field
Purpose & Standards Energy Field
 
Bolum3111
Bolum3111Bolum3111
Bolum3111
 
Managing expectations can we really call on our big blue brother- busch
Managing expectations  can we really call on our big blue brother- buschManaging expectations  can we really call on our big blue brother- busch
Managing expectations can we really call on our big blue brother- busch
 
Understanding the wealth-creating potential of relationships :: Kredible.net ...
Understanding the wealth-creating potential of relationships :: Kredible.net ...Understanding the wealth-creating potential of relationships :: Kredible.net ...
Understanding the wealth-creating potential of relationships :: Kredible.net ...
 
New Zealand Franchising Confidence Index | July 2013
New Zealand Franchising Confidence Index | July 2013New Zealand Franchising Confidence Index | July 2013
New Zealand Franchising Confidence Index | July 2013
 
Decommissioning and dismantling of the moata reactor a radiation protection ...
Decommissioning and dismantling of the moata reactor  a radiation protection ...Decommissioning and dismantling of the moata reactor  a radiation protection ...
Decommissioning and dismantling of the moata reactor a radiation protection ...
 
Some key considerations relating anastas
Some key considerations relating anastasSome key considerations relating anastas
Some key considerations relating anastas
 
Kutná hora ii.
Kutná hora ii.Kutná hora ii.
Kutná hora ii.
 
Comprehensive Soldier Fitness Concept- Baker
Comprehensive Soldier Fitness Concept- BakerComprehensive Soldier Fitness Concept- Baker
Comprehensive Soldier Fitness Concept- Baker
 
Permen tahun2013 nomor81a
Permen tahun2013 nomor81aPermen tahun2013 nomor81a
Permen tahun2013 nomor81a
 
Vie Politique : Marine le Pen
Vie Politique : Marine le PenVie Politique : Marine le Pen
Vie Politique : Marine le Pen
 
Poliittisen viestinnän sisäpiirit Twitterissä
Poliittisen viestinnän sisäpiirit TwitterissäPoliittisen viestinnän sisäpiirit Twitterissä
Poliittisen viestinnän sisäpiirit Twitterissä
 
Skills & Habits Energy Field
Skills & Habits Energy FieldSkills & Habits Energy Field
Skills & Habits Energy Field
 
Example of-child-protection-policy-for-voluntary-organisations
Example of-child-protection-policy-for-voluntary-organisationsExample of-child-protection-policy-for-voluntary-organisations
Example of-child-protection-policy-for-voluntary-organisations
 
【Ask maclean技术分享oracle数据库优化】awr鹰眼系列awr报告全面指标分析
【Ask maclean技术分享oracle数据库优化】awr鹰眼系列awr报告全面指标分析【Ask maclean技术分享oracle数据库优化】awr鹰眼系列awr报告全面指标分析
【Ask maclean技术分享oracle数据库优化】awr鹰眼系列awr报告全面指标分析
 
Towards a Quality Framework for Online Educator Professional Development Acti...
Towards a Quality Framework for Online Educator Professional Development Acti...Towards a Quality Framework for Online Educator Professional Development Acti...
Towards a Quality Framework for Online Educator Professional Development Acti...
 
Metodos de Programacion en Restauracio_Tesis
Metodos de Programacion en Restauracio_TesisMetodos de Programacion en Restauracio_Tesis
Metodos de Programacion en Restauracio_Tesis
 

Similar a 配置Oracle 10g 双向流复制

Install Oracle11g For Aix 5 L
Install Oracle11g For Aix 5 LInstall Oracle11g For Aix 5 L
Install Oracle11g For Aix 5 Lheima911
 
Oraliux+mysql5单机多实例安装文档
Oraliux+mysql5单机多实例安装文档Oraliux+mysql5单机多实例安装文档
Oraliux+mysql5单机多实例安装文档xuebao_zx
 
数据库性能诊断的七种武器
数据库性能诊断的七种武器数据库性能诊断的七种武器
数据库性能诊断的七种武器Leyi (Kamus) Zhang
 
开源应用日志收集系统
开源应用日志收集系统开源应用日志收集系统
开源应用日志收集系统klandor
 
为10g rac cluster添加节点
为10g rac cluster添加节点为10g rac cluster添加节点
为10g rac cluster添加节点maclean liu
 
使用Nginx轻松实现开源负载均衡
使用Nginx轻松实现开源负载均衡使用Nginx轻松实现开源负载均衡
使用Nginx轻松实现开源负载均衡cachowu
 
3, OCP - instance management
3, OCP - instance management3, OCP - instance management
3, OCP - instance managementted-xu
 
2, OCP - installing and creating a database
2, OCP - installing and creating a database2, OCP - installing and creating a database
2, OCP - installing and creating a databaseted-xu
 
Mysql proxy cluster
Mysql proxy clusterMysql proxy cluster
Mysql proxy clusterYiwei Ma
 
Django development
Django developmentDjango development
Django developmentloveyudu
 
Mysql mmm安装指南(翻译)
Mysql mmm安装指南(翻译)Mysql mmm安装指南(翻译)
Mysql mmm安装指南(翻译)Yiwei Ma
 
Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)
Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)
Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)acqua young
 
Itpub电子杂志(第五期)
Itpub电子杂志(第五期)Itpub电子杂志(第五期)
Itpub电子杂志(第五期)yiditushe
 
Lucene 全文检索实践
Lucene 全文检索实践Lucene 全文检索实践
Lucene 全文检索实践yiditushe
 
12, OCP - performance tuning
12, OCP - performance tuning12, OCP - performance tuning
12, OCP - performance tuningted-xu
 
Nginx使用和模块开发
Nginx使用和模块开发Nginx使用和模块开发
Nginx使用和模块开发qingpiao1983
 
Nginx+常见应用技术指南
Nginx+常见应用技术指南Nginx+常见应用技术指南
Nginx+常见应用技术指南andy54321
 
8, lamp
8, lamp8, lamp
8, lampted-xu
 

Similar a 配置Oracle 10g 双向流复制 (20)

Install Oracle11g For Aix 5 L
Install Oracle11g For Aix 5 LInstall Oracle11g For Aix 5 L
Install Oracle11g For Aix 5 L
 
Oraliux+mysql5单机多实例安装文档
Oraliux+mysql5单机多实例安装文档Oraliux+mysql5单机多实例安装文档
Oraliux+mysql5单机多实例安装文档
 
数据库性能诊断的七种武器
数据库性能诊断的七种武器数据库性能诊断的七种武器
数据库性能诊断的七种武器
 
开源应用日志收集系统
开源应用日志收集系统开源应用日志收集系统
开源应用日志收集系统
 
为10g rac cluster添加节点
为10g rac cluster添加节点为10g rac cluster添加节点
为10g rac cluster添加节点
 
使用Nginx轻松实现开源负载均衡
使用Nginx轻松实现开源负载均衡使用Nginx轻松实现开源负载均衡
使用Nginx轻松实现开源负载均衡
 
3, OCP - instance management
3, OCP - instance management3, OCP - instance management
3, OCP - instance management
 
2, OCP - installing and creating a database
2, OCP - installing and creating a database2, OCP - installing and creating a database
2, OCP - installing and creating a database
 
Mysql proxy cluster
Mysql proxy clusterMysql proxy cluster
Mysql proxy cluster
 
Django development
Django developmentDjango development
Django development
 
Mysql mmm安装指南(翻译)
Mysql mmm安装指南(翻译)Mysql mmm安装指南(翻译)
Mysql mmm安装指南(翻译)
 
Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)
Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)
Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)
 
Asm+aix
Asm+aixAsm+aix
Asm+aix
 
Itpub电子杂志(第五期)
Itpub电子杂志(第五期)Itpub电子杂志(第五期)
Itpub电子杂志(第五期)
 
Lucene 全文检索实践
Lucene 全文检索实践Lucene 全文检索实践
Lucene 全文检索实践
 
12, OCP - performance tuning
12, OCP - performance tuning12, OCP - performance tuning
12, OCP - performance tuning
 
Nginx使用和模块开发
Nginx使用和模块开发Nginx使用和模块开发
Nginx使用和模块开发
 
Nginx+常见应用技术指南
Nginx+常见应用技术指南Nginx+常见应用技术指南
Nginx+常见应用技术指南
 
8, lamp
8, lamp8, lamp
8, lamp
 
运维自动化
运维自动化运维自动化
运维自动化
 

Más de maclean liu

Oracle専用データ復旧ソフトウェアprm dulユーザーズ・マニュアル
Oracle専用データ復旧ソフトウェアprm dulユーザーズ・マニュアルOracle専用データ復旧ソフトウェアprm dulユーザーズ・マニュアル
Oracle専用データ復旧ソフトウェアprm dulユーザーズ・マニュアルmaclean liu
 
基于Oracle 12c data guard & far sync的低资源消耗两地三数据中心容灾方案
基于Oracle 12c data guard & far sync的低资源消耗两地三数据中心容灾方案基于Oracle 12c data guard & far sync的低资源消耗两地三数据中心容灾方案
基于Oracle 12c data guard & far sync的低资源消耗两地三数据中心容灾方案maclean liu
 
PRM DUL Oracle Database Health Check
PRM DUL Oracle Database Health CheckPRM DUL Oracle Database Health Check
PRM DUL Oracle Database Health Checkmaclean liu
 
Vbox virtual box在oracle linux 5 - shoug 梁洪响
Vbox virtual box在oracle linux 5 - shoug 梁洪响Vbox virtual box在oracle linux 5 - shoug 梁洪响
Vbox virtual box在oracle linux 5 - shoug 梁洪响maclean liu
 
【诗檀软件】Mysql高可用方案
【诗檀软件】Mysql高可用方案【诗檀软件】Mysql高可用方案
【诗檀软件】Mysql高可用方案maclean liu
 
Shoug at apouc2015 4min pitch_biotwang_v2
Shoug at apouc2015 4min pitch_biotwang_v2Shoug at apouc2015 4min pitch_biotwang_v2
Shoug at apouc2015 4min pitch_biotwang_v2maclean liu
 
Apouc 4min pitch_biotwang_v2
Apouc 4min pitch_biotwang_v2Apouc 4min pitch_biotwang_v2
Apouc 4min pitch_biotwang_v2maclean liu
 
使用Oracle osw analyzer工具分析oswbb日志,并绘制系统性能走势图1
使用Oracle osw analyzer工具分析oswbb日志,并绘制系统性能走势图1使用Oracle osw analyzer工具分析oswbb日志,并绘制系统性能走势图1
使用Oracle osw analyzer工具分析oswbb日志,并绘制系统性能走势图1maclean liu
 
Orclrecove 1 pd-prm-dul testing for oracle database recovery_20141030_biot_wang
Orclrecove 1 pd-prm-dul testing for oracle database recovery_20141030_biot_wangOrclrecove 1 pd-prm-dul testing for oracle database recovery_20141030_biot_wang
Orclrecove 1 pd-prm-dul testing for oracle database recovery_20141030_biot_wangmaclean liu
 
诗檀软件 – Oracle数据库修复专家 oracle数据块损坏知识2014-10-24
诗檀软件 – Oracle数据库修复专家 oracle数据块损坏知识2014-10-24诗檀软件 – Oracle数据库修复专家 oracle数据块损坏知识2014-10-24
诗檀软件 – Oracle数据库修复专家 oracle数据块损坏知识2014-10-24maclean liu
 
追求Jdbc on oracle最佳性能?如何才好?
追求Jdbc on oracle最佳性能?如何才好?追求Jdbc on oracle最佳性能?如何才好?
追求Jdbc on oracle最佳性能?如何才好?maclean liu
 
使用Virtual box在oracle linux 5.7上安装oracle database 11g release 2 rac的最佳实践
使用Virtual box在oracle linux 5.7上安装oracle database 11g release 2 rac的最佳实践使用Virtual box在oracle linux 5.7上安装oracle database 11g release 2 rac的最佳实践
使用Virtual box在oracle linux 5.7上安装oracle database 11g release 2 rac的最佳实践maclean liu
 
Prm dul is an oracle database recovery tool database
Prm dul is an oracle database recovery tool   databasePrm dul is an oracle database recovery tool   database
Prm dul is an oracle database recovery tool databasemaclean liu
 
Oracle prm dul, jvm and os
Oracle prm dul, jvm and osOracle prm dul, jvm and os
Oracle prm dul, jvm and osmaclean liu
 
Oracle dba必备技能 使用os watcher工具监控系统性能负载
Oracle dba必备技能   使用os watcher工具监控系统性能负载Oracle dba必备技能   使用os watcher工具监控系统性能负载
Oracle dba必备技能 使用os watcher工具监控系统性能负载maclean liu
 
Parnassus data recovery manager for oracle database user guide v0.3
Parnassus data recovery manager for oracle database user guide v0.3Parnassus data recovery manager for oracle database user guide v0.3
Parnassus data recovery manager for oracle database user guide v0.3maclean liu
 
Oracle prm安装说明
Oracle prm安装说明Oracle prm安装说明
Oracle prm安装说明maclean liu
 
诗檀软件 Oracle数据块损坏知识
诗檀软件 Oracle数据块损坏知识诗檀软件 Oracle数据块损坏知识
诗檀软件 Oracle数据块损坏知识maclean liu
 
Oracle prm数据库恢复工具与asm
Oracle prm数据库恢复工具与asmOracle prm数据库恢复工具与asm
Oracle prm数据库恢复工具与asmmaclean liu
 
Prm 一个oracle数据库灾难恢复救护车工具
Prm 一个oracle数据库灾难恢复救护车工具Prm 一个oracle数据库灾难恢复救护车工具
Prm 一个oracle数据库灾难恢复救护车工具maclean liu
 

Más de maclean liu (20)

Oracle専用データ復旧ソフトウェアprm dulユーザーズ・マニュアル
Oracle専用データ復旧ソフトウェアprm dulユーザーズ・マニュアルOracle専用データ復旧ソフトウェアprm dulユーザーズ・マニュアル
Oracle専用データ復旧ソフトウェアprm dulユーザーズ・マニュアル
 
基于Oracle 12c data guard & far sync的低资源消耗两地三数据中心容灾方案
基于Oracle 12c data guard & far sync的低资源消耗两地三数据中心容灾方案基于Oracle 12c data guard & far sync的低资源消耗两地三数据中心容灾方案
基于Oracle 12c data guard & far sync的低资源消耗两地三数据中心容灾方案
 
PRM DUL Oracle Database Health Check
PRM DUL Oracle Database Health CheckPRM DUL Oracle Database Health Check
PRM DUL Oracle Database Health Check
 
Vbox virtual box在oracle linux 5 - shoug 梁洪响
Vbox virtual box在oracle linux 5 - shoug 梁洪响Vbox virtual box在oracle linux 5 - shoug 梁洪响
Vbox virtual box在oracle linux 5 - shoug 梁洪响
 
【诗檀软件】Mysql高可用方案
【诗檀软件】Mysql高可用方案【诗檀软件】Mysql高可用方案
【诗檀软件】Mysql高可用方案
 
Shoug at apouc2015 4min pitch_biotwang_v2
Shoug at apouc2015 4min pitch_biotwang_v2Shoug at apouc2015 4min pitch_biotwang_v2
Shoug at apouc2015 4min pitch_biotwang_v2
 
Apouc 4min pitch_biotwang_v2
Apouc 4min pitch_biotwang_v2Apouc 4min pitch_biotwang_v2
Apouc 4min pitch_biotwang_v2
 
使用Oracle osw analyzer工具分析oswbb日志,并绘制系统性能走势图1
使用Oracle osw analyzer工具分析oswbb日志,并绘制系统性能走势图1使用Oracle osw analyzer工具分析oswbb日志,并绘制系统性能走势图1
使用Oracle osw analyzer工具分析oswbb日志,并绘制系统性能走势图1
 
Orclrecove 1 pd-prm-dul testing for oracle database recovery_20141030_biot_wang
Orclrecove 1 pd-prm-dul testing for oracle database recovery_20141030_biot_wangOrclrecove 1 pd-prm-dul testing for oracle database recovery_20141030_biot_wang
Orclrecove 1 pd-prm-dul testing for oracle database recovery_20141030_biot_wang
 
诗檀软件 – Oracle数据库修复专家 oracle数据块损坏知识2014-10-24
诗檀软件 – Oracle数据库修复专家 oracle数据块损坏知识2014-10-24诗檀软件 – Oracle数据库修复专家 oracle数据块损坏知识2014-10-24
诗檀软件 – Oracle数据库修复专家 oracle数据块损坏知识2014-10-24
 
追求Jdbc on oracle最佳性能?如何才好?
追求Jdbc on oracle最佳性能?如何才好?追求Jdbc on oracle最佳性能?如何才好?
追求Jdbc on oracle最佳性能?如何才好?
 
使用Virtual box在oracle linux 5.7上安装oracle database 11g release 2 rac的最佳实践
使用Virtual box在oracle linux 5.7上安装oracle database 11g release 2 rac的最佳实践使用Virtual box在oracle linux 5.7上安装oracle database 11g release 2 rac的最佳实践
使用Virtual box在oracle linux 5.7上安装oracle database 11g release 2 rac的最佳实践
 
Prm dul is an oracle database recovery tool database
Prm dul is an oracle database recovery tool   databasePrm dul is an oracle database recovery tool   database
Prm dul is an oracle database recovery tool database
 
Oracle prm dul, jvm and os
Oracle prm dul, jvm and osOracle prm dul, jvm and os
Oracle prm dul, jvm and os
 
Oracle dba必备技能 使用os watcher工具监控系统性能负载
Oracle dba必备技能   使用os watcher工具监控系统性能负载Oracle dba必备技能   使用os watcher工具监控系统性能负载
Oracle dba必备技能 使用os watcher工具监控系统性能负载
 
Parnassus data recovery manager for oracle database user guide v0.3
Parnassus data recovery manager for oracle database user guide v0.3Parnassus data recovery manager for oracle database user guide v0.3
Parnassus data recovery manager for oracle database user guide v0.3
 
Oracle prm安装说明
Oracle prm安装说明Oracle prm安装说明
Oracle prm安装说明
 
诗檀软件 Oracle数据块损坏知识
诗檀软件 Oracle数据块损坏知识诗檀软件 Oracle数据块损坏知识
诗檀软件 Oracle数据块损坏知识
 
Oracle prm数据库恢复工具与asm
Oracle prm数据库恢复工具与asmOracle prm数据库恢复工具与asm
Oracle prm数据库恢复工具与asm
 
Prm 一个oracle数据库灾难恢复救护车工具
Prm 一个oracle数据库灾难恢复救护车工具Prm 一个oracle数据库灾难恢复救护车工具
Prm 一个oracle数据库灾难恢复救护车工具
 

配置Oracle 10g 双向流复制

  • 1. 配置 Oracle 10g 双向流 复制 by Maclean.liu liu.maclean@gmail.com www.oracledatabase12g.com
  • 2. About Me l Email:liu.maclean@gmail.com l Blog:www.oracledatabase12g.com l Oracle Certified Database Administrator Master 10g and 11g l Over 6 years experience with Oracle DBA technology l Over 7 years experience with Linux technology l Member Independent Oracle Users Group l Member All China Users Group l Presents for advanced Oracle topics: RAC, DataGuard, Performance Tuning and Oracle Internal.
  • 3. 构建 Oracle 双向流复制是一个十分复杂的过程,我写这个文档的目的是尽量有条理地列出所需做的工作,帮助 DBA 更有效的建设流复制环境。 1.以 scott 模式为复制示例,一般只要在创建数据库时选择了安装 sample schema,都会存在该 scott 模式;至少 保证源库中存在该 schema,以便可以初始化到目标库中。 2.在源和目标 2 个数据库中创建 strmadmin 流管理用户,当然你也可以选用其他名字。同时在 2 个库中都要创建 streams 使用的表空间,以便让 logmnr 使用它: CREATE TABLESPACE streams_tbs DATAFILE 'XXXXXX' SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; /* 10g r2 中 logmnr 默认使用 SYSAUX 表空间 */ exec DBMS_LOGMNR_D.SET_TABLESPACE ('streams_tbs'); /* 创建完表空间后,接着要创建 strmadmin 用户 */ CREATE USER strmadmin IDENTIFIED BY strmadmin DEFAULT TABLESPACE streams_tbs QUOTA UNLIMITED ON streams_tbs; GRANT DBA TO strmadmin; BEGIN DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE( grantee => 'strmadmin', grant_privileges => true); END; / /* 可以通过查询 dba_streams_administrator 视图检查用户是否正确授予流管理权限 */ SQL> SELECT * FROM dba_streams_administrator; USERNAME LOC ACC ------------------------------ --- --- MACLEAN YES YES STRMADMIN YES YES
  • 4. 3.在 2 边数据库中都需要设置合理的实例初始化参数,我们以 10g release2 为例: 参数名与推荐值:_job_queue_interval = 1 描述:job 的队列的扫描参数,默认为 5,即 5s 扫描一次 出于何种考虑:设置较小的_job_queue_interval 有利于 propagation 作业 如何设置:alter system set "_job_queue_interval"=1 scope=spfile; /* 注意 scope=spfile 的参数都需要重启实例方能生效 */ 参数名与推荐值:COMPATIBLE>= 10.2.0.0 描述:数据库版本兼容性参数,以前介绍过,不再展开 出于何种考虑:10g release2 的部分 Streams 新特性要求该参数至少为 10.2.0.0 或更高 如何设置:只有从较低版本升级到 10g r2 的数据库需要设置该参数, alter system set compatible="10.2.0.0" scope=spfile; 参数名与推荐值:GLOBAL_NAMES=true 描述:指定是否要求 database link 名与数据库全局名一致,默认为 FALSE 也就是不需要一致 出于何种考虑:帮助我们准确识别 database link 和数据库的关系,避免误操作 如何设置:alter system set global_names=true scope=spfile; 参数名与推荐值:job_queue_processes>4 描述:指定了实例中 job 队列进程的数量(如 J000…J999). 出于何种考虑:该参数控制了实例中能够并行运行的 job 的最大值,应设一个大于已配置的 propagations 数量的值,同时也要考虑到可能还有其他数据库作业 如何设置:alter system set job_queue_processes=15; 参数名与推荐值:PARALLEL_MAX_SERVERS 描述:指定了实例中最大并行进程的数量 出于何种考虑: 在 Streams 环境中,capture 进程和 apply 进程都会用到多个并行进程。 设置该初始化参数为适当值(10*CPU#)以保证总是有足够的可用并行进程; 每多一个 capture 或 apply 进程,则有必要为该参数+2 再加上加入的 capture 或 apply 进程的并行度 parallelism 参数。 如何设置: alter system set PARALLEL_MAX_SERVERS=40; 参数名与推荐值:REMOTE_ARCHIVE_ENABLE 描述:指定是否将归档日志传送到远程目的地 出于何种考虑:只有 downstream capture 时会用到,不展开
  • 5. 参数名与推荐值:SGA_MAX_SIZE 描述:设置合理的 SGA 内存最大值 出于何种考虑:常见参数,不展开 参数名与推荐值:SGA_TARGET=0 描述:disable 掉 10g 中的 Automatic Shared Memory Management. 出于何种考虑:Oracle 推荐在 stream 环境中手动指定 streams_pool 和 shared_pool 的大小而不使用 10g 中的内 存自动管理特性 如何设置: alter system set sga_target=0; 参数名与推荐值:调优 STREAMS_POOL_SIZE 描述: 为流池指定大小。流池包括了缓存的队列消息。此外,流池也会被用于并行 capture 和 apply 的内部通信。 建议参考 V$STREAMS_POOL_ADVICE 视图的信息判断最佳大小,避免 spill 溢出 出于何种考虑: 该参数可以动态修改。若该参数归零则实例中 streams 相关的进程和作业都将无法运行。流池的大小受到以下因素的影 响: 1.capture 进程的并行度,每增加一个 capture 进程有必要为流池增加 10MB 的大小; 此外当 capture 参数 PARALLELISM 大于 1 时,有必要为流池增加 10Mb*parallelism 的大小; 举例来说,若某 capture 进程的并行度 parallelism 设置为 3,则需要为 Streams 池增加 30Mb。 2.apply 进程的并行度,每增加一个 apply 进程有必要为 streams pool 增加 1MB; 此外当 apply 进程的并行度大于 1 时,为 streams pool 增加 1Mb*parallelism 的大小; 举例来说某 apply 进程的 parallelism 被设置为 5,则需要为 streams 池增加 5Mb。 3.Logical Change Records(LCRS)被存储在 buffered queues 缓存队列中; 适当增加 Streams pool 大小以适应源库和目标库上数据复制的数据量; Oracle 建议在低负载的数据库上最小设置 Streams pool 为 256Mb,而在活跃度高的 OLTP 环境中设置为 500Mb; 通过 V$STREAMS_POOL_ADVISE 视图给出的建议进一步调整 Streams Pool 的大小 到一个合理值以避免过多的缓存队列溢出到磁盘上。 如何设置: select * from v$streams_pool_advice; /* 查询 v$streams_pool_advice 视图了解不同 streams_Pool_size 情况下的 estd_spill_time */ alter system set streams_pool_size=500M; 完成以上设置后建议重启实例以便让全部参数生效,2 边都要做。
  • 6. 4.为 scott schema 下的对象创建追加日志(supplemental log),可以使用 dbms_capture_adm 包的 prepare_schema_instantiation 存储过程为指定模式创建追加日志: NAME prepare_schema_instantiation() FUNCTION prepare a schema for instantiation PARAMETERS schema_name - (IN) the name of the schema to prepare supplemental_logging - (IN) supplemental logging level ('NONE', 'KEYS', or 'ALL') NOTES KEYS means PRIMARY KEY, UNIQUE INDEX, and FOREIGN KEY levels combined. ----------------------------------------------------------------------------*/ PROCEDURE prepare_schema_instantiation( schema_name IN VARCHAR2, supplemental_logging IN VARCHAR2 DEFAULT 'KEYS'); /* 其默认 supplemental_logging 选项为 Key,即为 PRIMARY KEY, UNIQUE INDEX, and FOREIGN KEY 等键 创建 IMPLICIT 的追加日志 */ /* 在 10g 或以上版本中 prepare_xxx_instantiation 存储过程也会隐式地创建追加日志组了 (In versions 10g and above,prepare_xxx_instantiation procedure implicitly creates supplemenal log groups. Type of supplemental logging that is enabled implicitly using this command can be checked using the sql in the following link to the documentation. However, additional supplemental logging might need to be enabled depending on the requirements as mentioned above)。 可以通过以下查询了解其追加日志组的属性: SELECT SCHEMA_NAME, SUPPLEMENTAL_LOG_DATA_PK log_pk, SUPPLEMENTAL_LOG_DATA_FK log_fk, SUPPLEMENTAL_LOG_DATA_UI log_ui, SUPPLEMENTAL_LOG_DATA_ALL log_all FROM DBA_CAPTURE_PREPARED_SCHEMAS; SCHEMA_NAME LOG_PK LOG_FK LOG_UI LOG_ALL ------------------------------ -------- -------- -------- -------- SCOTT IMPLICIT IMPLICIT IMPLICIT NO
  • 7. 5.在源库上创建到目标库 strmadmin 用户的 database link: conn strmadmin/strmadmin; Connected. create database link clinicb.rh3.oracle.com connect to strmadmin identified by strmadmin using 'clinicb.rh3.oracle.com'; Database link created. /* 其中 clinicb.rh3.oracle.com 为目标库的全局数据库名,clinicb 为 db_name,rh3.oracle.com 为 domain_name */ 在目标库上创建到源库 strmadmin 用户的 database link: conn strmadmin/strmadmin; Connected. create database link clinica.rh2.oracle.com connect to strmadmin identified by strmadmin using 'clinica.rh2.oracle.com'; Database link created. /* 其中 clinica.rh2.oracle.com 为源库的全局数据库名,clinica 为数据库名,rh2.oracle.com 为 domain_name */ 6.在源库中分别为 capture 和 apply 创建队列 queue: begin dbms_streams_adm.set_up_queue( queue_table => 'apply_srctab', queue_name => 'apply_src', queue_user => 'strmadmin'); end; / PL/SQL procedure successfully completed. begin dbms_streams_adm.set_up_queue( queue_table => 'capture_srctab', queue_name => 'capture_src',
  • 8. queue_user => 'strmadmin'); end; / PL/SQL procedure successfully completed. 在目标库分别为 capture 和 apply 创建队列 queue: conn strmadmin/strmadmin@clinicb.rh3.oracle.com Connected. begin dbms_streams_adm.set_up_queue( queue_table => 'apply_desttab', queue_name => 'apply_dest', queue_user => 'strmadmin'); end; / PL/SQL procedure successfully completed. begin dbms_streams_adm.set_up_queue( queue_table => 'capture_desttab', queue_name => 'capture_dest', queue_user => 'strmadmin'); end; / PL/SQL procedure successfully completed. 8.在源库 clinica 上为 scott 模式创建 capture process: conn strmadmin/strmadmin@clinica.rh2.oracle.com Connected. begin dbms_streams_adm.add_schema_rules ( schema_name => 'scott', streams_type => 'capture', streams_name => 'captures_src',
  • 9. queue_name => 'capture_src', include_dml => true, include_ddl => true, inclusion_rule => true); end; / PL/SQL procedure successfully completed. 9.在源库 clinica 上创建 apply process: conn strmadmin/strmadmin@clinica.rh2.oracle.com Connected. begin dbms_streams_adm.add_schema_rules ( schema_name => 'scott', streams_type => 'apply', streams_name => 'applys_src', queue_name => 'apply_src', include_dml => true, include_ddl => true, source_database => 'clinicb.rh3.oracle.com'); end; / PL/SQL procedure successfully completed. 10.若需要在源库中解决冲突处理,则有必要设置 conflict handlers,可以参考这个 streams 文件链 接:http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14228/conflict.htm 11.在源库 clinica 上配置 propagation process: conn strmadmin/strmadmin@clinica.rh2.oracle.com Connected. begin dbms_streams_adm.add_schema_propagation_rules (
  • 10. schema_name => 'scott', streams_name => 'prop_src_to_dest', source_queue_name => 'capture_src', destination_queue_name => 'apply_dest@clinicb.rh3.oracle.com', include_dml => true, include_ddl => true, source_database => 'clinica.rh2.oracle.com'); end; / PL/SQL procedure successfully completed. 12.在目标库 clinicb 上配置 capture process: conn strmadmin/strmadmin@clinicb.rh3.oracle.com Connected. begin dbms_streams_adm.add_schema_rules ( schema_name => 'scott', streams_type => 'capture', streams_name => 'captures_dest', queue_name => 'capture_dest', include_dml => true, include_ddl => true); end; / PL/SQL procedure successfully completed. 13.在原库 clinica 上以目标库 clinicb 的 SCN 设置模式实例化 SCN(schema instantiation SCN): conn strmadmin/strmadmin@clinicb.rh3.oracle.com Connected. declare v_scn number; begin v_scn := dbms_flashback.get_system_change_number(); dbms_apply_adm.set_schema_instantiation_scn@clinica.rh2.oracle.com(
  • 11. source_schema_name => 'scott', source_database_name => 'clinicb.rh3.oracle.com', instantiation_scn => v_scn, recursive => true); end; / 14.在目标库 clinicb 上配置 apply process: conn strmadmin/strmadmin@clinicb.rh3.oracle.com Connected. begin dbms_streams_adm.add_schema_rules ( schema_name => 'scott', streams_type => 'apply', streams_name => 'applys_dest', queue_name => 'apply_dest', include_dml => true, include_ddl => true, source_database => 'clinica.rh2.oracle.com'); end; / PL/SQL procedure successfully completed. 15.在目标库上配置 propagation process: conn strmadmin/strmadmin@clinicb.rh3.oracle.com Connected. begin dbms_streams_adm.add_schema_propagation_rules ( schema_name => 'scott', streams_name => 'prop_dest_to_src', source_queue_name => 'capture_dest', destination_queue_name => 'apply_src@clinica.rh2.oracle.com', include_dml => true, include_ddl => true,
  • 12. source_database => 'clinicb.rh3.oracle.com'); end; / PL/SQL procedure successfully completed. 16.在目标库上初始化 scott 模式下的对象,有多种方法可以完成初始化。若对象均不存在,在可以使用 export/import 导入导出工具完成 instantiation,若对象均已经存在,则直接使用 dbms_apply_adm.set_schema_instantiation_scn 存储过程。 我们的环境中 scott 模式已存在于目标库中: conn strmadmin/strmadmin@clinica.rh2.oracle.com Connected. declare v_scn number; begin v_scn := dbms_flashback.get_system_change_number(); dbms_apply_adm.set_schema_instantiation_scn@clinicb.rh3.oracle.com( source_schema_name => 'scott', source_database_name => 'clinica.rh2.oracle.com', instantiation_scn => v_scn, recursive => true); end; / PL/SQL procedure successfully completed. 17.若需要在目标库中解决冲突处理,则有必要设置 conflict handlers,可以参考这个 streams 文件链接: http://download-east.oracle.com/docs/cd/B19306_01/server. 102/b14228/conflict.htm 18.在目标库中启动 capture 和 apply 进程: 启动 Apply: /* 以 disable_on_erro 参数为'N'启动 apply 进程,即便遭遇错误,apply 也会继续处理 LCR */ conn strmadmin/strmadmin@clinicb.rh3.oracle.com Connected. begin
  • 13. dbms_apply_adm.set_parameter ( apply_name => 'applys_dest', parameter => 'disable_on_error', value => 'N'); end; / PL/SQL procedure successfully completed. exec dbms_apply_adm.start_apply (apply_name=> 'applys_dest'); PL/SQL procedure successfully completed. 在目标库中启动 capture process: exec dbms_capture_adm.start_capture (capture_name=>'captures_dest'); PL/SQL procedure successfully completed. 19.同样的在源库启动 capture 和 apply 进程: begin dbms_apply_adm.set_parameter ( apply_name => 'applys_src', parameter => 'disable_on_error', value => 'N'); end; / PL/SQL procedure successfully completed. exec dbms_apply_adm.start_apply (apply_name=> 'applys_src'); PL/SQL procedure successfully completed. 在源库启动 capture: exec dbms_capture_adm.start_capture (capture_name=>'captures_src'); PL/SQL procedure successfully completed.
  • 14. 20.测试双向流复制是否成功: 测试 ddl 语句: SQL> conn scott/tiger@clinica.rh2.oracle.com Connected. SQL> create table test_streams(t1 int); Table created. SQL> conn scott/tiger@clinicb.rh3.oracle.com Connected. SQL> desc test_streams; Name Null? Type ----------------------------------------- -------- ---------------------------- T1 NUMBER(38) SQL> create table anti_test(t1 int); Table created. SQL> conn scott/tiger@clinica.rh2.oracle.com Connected. SQL> desc anti_test; Name Null? Type ----------------------------------------- -------- ---------------------------- T1 NUMBER(38) /* ddl 语句双向复制成功 */ 测试 dml 语句: SQL> conn scott/tiger@clinica.rh2.oracle.com Connected. SQL> desc emp; Name Null? Type ----------------------------------------- -------- ---------------------------- EMPNO NOT NULL NUMBER(4) ENAME VARCHAR2(10) JOB VARCHAR2(9) MGR NUMBER(4)
  • 15. HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER(2) SQL> update emp set sal=sal+50; 14 rows updated. SQL> commit; Commit complete. SQL> select sum(sal) from emp; SUM(SAL) ---------- 29725 SQL> conn scott/tiger@clinicb.rh3.oracle.com Connected. SQL> select sum(sal) from emp; SUM(SAL) ---------- 29725 SQL> update emp set sal=sal+50; 14 rows updated. SQL> commit; Commit complete. SQL> select sum(sal) from emp; SUM(SAL) ---------- 30425
  • 16. SQL> conn scott/tiger@clinica.rh2.oracle.com Connected. SQL> select sum(sal) from emp; SUM(SAL) ---------- 30425 /* dml 语句双向复制成功 */ Reference: Oracle Streams Replication Example:http://prodlife.wordpress.com/2008/02/21/oracle-streams-replication- example/ Oracle Streams: Recommendations for Heartbeat table:http://ksadba.wordpress.com/2008/07/02/oracle- streams-recommendations-for-heartbeat-table/ © 2010, www.oracledatabase12g.com. 版权所有.文章允许转载,但必须以链接方式注明源地址,否则追求法律责 任.