单实例和RAC打造的ORACLE STREAM(完)

第十二步,备库下创建应用进程:
USER is "SCOTT"
SQL> conn strmadmin/strmadmin
Connected.
SQL> begin
  2  dbms_streams_adm.add_schema_rules(
  3  schema_name => 'scott',
  4  streams_type => 'apply',
  5  streams_name => 'apply_storm',
  6  queue_name => 'strmadmin.storm_queue',
  7  include_dml => true,
  8  include_ddl => true,
  9  include_tagged_lcr => false,
 10  source_database => 'ora',
 11  inclusion_rule => true);
 12  end;
 13  /
PL/SQL procedure successfully completed.
 
第十三步,主库备库分别启动stream:
备库:
SQL> begin
  2  dbms_apply_adm.start_apply(
  3  apply_name => 'apply_storm');
  4  end;
  5  /
PL/SQL procedure successfully completed.
 
主库:
SQL> begin
  2  dbms_capture_adm.start_capture(
  3  capture_name => 'capture_ora');
  4  end;
  5  /
PL/SQL procedure successfully completed.
 
第十四步,测试过程:
1,主库下以scott用户登陆并创建一张表:
SQL> conn scott/tiger
Connected.
SQL> CREATE TABLE TTT(id NUMBER PRIMARY KEY,name VARCHAR2(50));
Table created.
 
2,备库下进行查看是否有相应表:
$ sqlplus scott/tiger
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jan 19 15:45:54 2010
Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL> desc ttt
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ID                                        NOT NULL NUMBER
 NAME                                               VARCHAR2(50)
 
storm2:
SQL> desc ttt;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ID                                        NOT NULL NUMBER
 NAME                                               VARCHAR2(50)
 
3,主库下插入数据:
SQL> insert into ttt values (1,'storm is a good guy');
1 row created.
SQL> select * from ttt;
        ID NAME
---------- --------------------------------------------------
         1 storm is a good guy

 
4,备库下进行检验:
SQL> select * from ttt;
no rows selected
这时看到没有任何数据生成,在这个地方需要注意的是,主库插入了数据但是并没有提交,所以备库无法查看数据生成结果。
 
5,主库进行提交:
SQL> commit;
Commit complete.
 
6,备库再次查看:
SQL> select * from ttt;
        ID NAME
---------- --------------------------------------------------
         1 storm is a good guy
 
storm2:
SQL> select * from ttt;
        ID NAME
---------- --------------------------------------------------
         1 storm is a good guy
 
至此,整个实验过程宣告结束。仔细对比两次实验可以发现,两个单实例构建的stream和单实例、RAC构建的stream的基本步骤都是相同 的,所不同的地方只是体现在归档模式的设置,只要本着一个数据库的概念,一切都能顺利完成了。
 
全文毕。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/90618/viewspace-659949/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/90618/viewspace-659949/

你可能感兴趣的:(单实例和RAC打造的ORACLE STREAM(完))