Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5601952
  • 博文数量: 745
  • 博客积分: 10075
  • 博客等级: 上将
  • 技术积分: 7716
  • 用 户 组: 普通用户
  • 注册时间: 2005-04-29 12:09
文章分类

全部博文(745)

文章存档

2019年(1)

2016年(1)

2010年(31)

2009年(88)

2008年(129)

2007年(155)

2006年(197)

2005年(143)

分类: Oracle

2010-01-19 23:00:47

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

penguinstorm2010-02-07 12:44:17

to cuijj_ibm: 我也是学习DG跟Stream的东西没多长时间,你太过奖了。

cuijj_ibm2010-02-06 19:50:35

最近做oracle DG,Stream的实验,无意中看到了LZ的博,大概浏览了一下,相当的佩服,虽然这些东西基本也都接触过,但对我都是略懂皮毛,在客户那里混饭吃的!以后当以LZ为学习榜样!