Chinaunix首页 | 论坛 | 博客
  • 博客访问: 254460
  • 博文数量: 70
  • 博客积分: 2120
  • 博客等级: 大尉
  • 技术积分: 820
  • 用 户 组: 普通用户
  • 注册时间: 2008-01-16 10:52
文章分类

全部博文(70)

文章存档

2012年(2)

2011年(53)

2010年(6)

2009年(1)

2008年(8)

我的朋友

分类:

2011-12-27 15:43:06

第十二步,备库下创建应用进程:
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的基本步骤都是相同的,所不同的地方只是体现在归档模式的设置,只要本着一个数据库的概念,一切都能顺利完成了。
 
全文毕。
阅读(510) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~