Oracle10gR2 Streams(六)表空间复制
NinGoo's blog

Oracle10gR2 Streams(六)表空间复制

Oracle10gR2 Streams中,可以采用pre_instantiation_setup/post_instantiation_setup或者maintain_tts(maintain_simple_tts)来配置表空间级别的复制,但是在我的实验中,pre_instantiation_setup一直无法正确执行,报ORA-06502错误。而maintain_simple_tts只能配置单个表空间,maintain_tts则可以复制一组只包含的表空间,本文演示使用maintain_tts过程配置表空间复制的过程。

源库:ning.test
目标库:dest.test
要复制的表空间:test
复制方式:单向,本地捕获日志

一、配置directory

和使用maintain_global配置全库复制一样,maintain_tts也使用expdp/impdp执行初始化

STRMADM@ning>create directory dir_source as ‘f:\oracle\source’;

Directory created.

STRMADM@ning>create directory dir_datafile as ‘f:\oracle\oradata\ning’;

Directory created.

STRMADM@dest>create directory dir_dest as ‘f:\oracle\oradata\dest’;

Directory created.


二、创建测试表

STRMADM@ning>create table test(i int) tablespace test;

Table created.

要复制的表空间不能是空的表空间,否则执行后面的maintain_tts虽然返回信息是执行成功了,实际上什么动作都不会执行。另外,要复制的表空间在目标库中不能已经存在。

三、执行maintain_tts

STRMADM@ning>DECLARE
2 t_names DBMS_STREAMS_TABLESPACE_ADM.TABLESPACE_SET;
3 BEGIN
4 — Tablespace names
5 t_names(1) := ‘TEST’;
6 DBMS_STREAMS_ADM.MAINTAIN_TTS(
7 tablespace_names => t_names,
8 source_directory_object => ‘DIR_SOURCE’,
9 destination_directory_object => ‘DIR_DEST’,
10 source_database => ‘ning.test’,
11 destination_database => ‘dest.test’,
12 perform_actions => true,
13 bi_directional => false,
14 include_ddl => true);
15 END;
16 /

PL/SQL procedure successfully completed.

如果要配置成downstream捕获,则在捕获库执行该过程。由于采用了expdp的传输表空间的特性来执行初始化,在配置过程中表空间需要处于read only状态,在业务高峰期执行的话,注意评估对产品库造成的影响。

四、验证复制是否成功

在源库上插入测试数据

STRMADM@ning> insert into test values(1);

1 row created.

STRMADM@ning>commit;

Commit complete.

稍等片刻在目标库查询

STRMADM@dest>select * from test;

I
———-
1

发现复制已经正常。如果等了足够长的时间发现数据没有复制过来,仔细检查了capture/propagation/apply各进程的状态都是正常的,这种现象我在使用maintain_tts/maintain_schemas/maintain_tables试验表空间复制/用户复制/表复制的时候都遇到过。所有的东西看起来都是正常的,但是数据就是过不去。后来开了个tar问oracle,经过一个星期的折腾,最后oracle给的答复是修改一个隐含参数:

alter system set “_job_queue_interval”=1 scope=spfile;

并且将aq_tm_processes参数改为1(我原来这是为10)

alter system set aq_tm_processes=1;

改完后重启,发现数据就可以去了。这个隐含参数只是控制对job队列的检查频率,默认5秒。复制正常后我再将这个参数改回默认值,重新配置streams复制也一切正常了。。。

本文网址:http://www.ningoo.net/html/2007/oracle10gr2_streams_tablespace_replication.html

订阅到Google | 收藏到Del.icio.us | 推荐到鲜果

上一篇: 下一篇:
相关文章 随机文章

本文Tags: ,

2 条评论

  • At 2007.12.04 11:06, westlife_xu said:

    streams的报错机制还是有点问题,各个视图显示都是正常的状态,数据就是没有复制过来

    • At 2008.03.25 20:17, chen said:

      很好的空间


      (Required)
      (Required, will not be published)