分享
 
 
 

Oracle高级复制的创建配置步骤-Step by Step

王朝oracle·作者佚名  2008-05-31
窄屏简体版  字體: |||超大  

本例涉及两个站点.

主体定义站点:AVATAR.COOLYOUNG.COM.CN

主体站点:AUTHAA.COOLYOUNG.COM.CN

注:主体定义站点指配置复制工作的站点

本例涉及的用户.

复制治理员:repadmin

应用用户:hawa

本例复制的对象:hw_test 数据表

1.在主体定义站点复制用户下创建复制对象

SQL select * from global_name;

GLOBAL_NAME

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

AVATAR.COOLYOUNG.COM.CN

SQL connect hawa/passWord

Connected.

SQL create table hw_test as select * from hw_online;

Table created.

SQLselect count(*) from hw_test;

COUNT(*)

----------

464

SQL alter table hw_test add (constraint pk_userid primary key (numuserid));

Table altered.

2.在主体站点同样创建复制对象

SQL select * from global_name;

GLOBAL_NAME

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

AUTHAA.COOLYOUNG.COM.CN

SQL connect hawa/password

Connected.

SQL create table hw_test as select * from hw_online;

Table created.

SQL select count(*) from hw_test;

COUNT(*)

----------

0

3.在主体站点手工同步数据

SQL connect repadmin/password

Connected.

SQL insert into hawa.hw_test select * from hawa.hw_test@avatar;

464 rows created.

SQL commit;

Commit complete.

4.在主体定义站点开始操作

登陆主体定义站点

$ sqlplus repadmin/password

SQL*Plus: Release 9.2.0.4.0 - ProdUCtion on Mon Jun 27 09:32:36 2005

Copyright (c) 1982, 2002, Oracle Corporation.All rights reserved.

Connected to:

Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.4.0 - Production

SQL select * from global_name;

GLOBAL_NAME

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

AVATAR.COOLYOUNG.COM.CN

创建复制组:

SQL execute dbms_repcat.create_master_repgroup('rep_hh');

PL/SQL procedure successfully completed.

SQL select gname,master,status from dba_repgroup where gname='REP_HH';

GNAMEM STATUS

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

REP_HH Y QUIESCED

在复制组里加入复制对象

SQL execute dbms_repcat.create_master_repobject

(sname='hawa',oname='hw_test',

type='table',use_existing_object=true,gname='rep_hh',copy_rows=false);

PL/SQL procedure successfully completed.

SQL select sname,oname,status,gname from dba_repobject where gname='REP_HH';

SNAMEONAMESTATUS GNAME

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

HAWA HW_TESTVALIDREP_HH

对复制对象产生复制支持

SQL execute dbms_repcat.generate_replication_support('hawa','hw_test','table');

PL/SQL procedure successfully completed.

SQL select gname, master, status from dba_repgroup where gname='REP_HH';

GNAMEM STATUS

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

REP_HH Y QUIESCED

SQL select sname,oname,status,gname from dba_repobject where gname='REP_HH';

SNAMEONAMESTATUS GNAME

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

HAWA HW_TESTVALIDREP_HH

HAWA HW_TEST$RP VALIDREP_HH

HAWA HW_TEST$RP VALIDREP_HH

SQL

添加主体复制节点

SQL execute dbms_repcat.add_master_database

(gname='rep_hh',master='AUTHAA.COOLYOUNG.COM.CN',use_existing_objects=true,

copy_rows=false, propagation_mode = 'synchronous');

PL/SQL procedure successfully completed.

SQL column masterdef format a10

SQL column master format a10

SQL column dblink format a25

SQL column gname format a12

SQL select gname, dblink, masterdef MASTERDEF, master MASTER from sys.dba_repsites where gname='REP_HH';

GNAMEDBLINKMASTERDEFMASTER

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

REP_HH AVATAR.COOLYOUNG.COM.CN YY

REP_HH AUTHAA.COOLYOUNG.COM.CN NY

登陆主体站点,检查复制对象情况:

[oracle@www167 oracle]$ sqlplus repadmin/password

SQL*Plus: Release 9.2.0.4.0 - Production on Mon Jun 27 09:34:49 2005

Copyright (c) 1982, 2002, Oracle Corporation.All rights reserved.

Connected to:

Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production

With the Partitioning option

JServer Release 9.2.0.4.0 - Production

SQL select * from global_name;

GLOBAL_NAME

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

AUTHAA.COOLYOUNG.COM.CN

SQL set linesize 120

SQL select sname,oname,status,gname from dba_repobject where gname='REP_HH';

SNAMEONAMESTATUS GNAME

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

HAWA HW_TESTVALIDREP_HH

HAWA HW_TEST$RP VALIDREP_HH

HAWA HW_TEST$RP VALIDREP_HH

在主体定义站点启动复制:

SQL select * from global_name;

GLOBAL_NAME

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

AVATAR.COOLYOUNG.COM.CN

SQL execute dbms_repcat.resume_master_activity('rep_hh',true);

PL/SQL procedure successfully completed.

在主体定义站点删除数据测试:

SQL connect hawa/password

Connected.

SQL select count(*) from hw_test;

COUNT(*)

----------

464

SQL delete from hw_test where rownum <20;

19 rows deleted.

SQL commit;

Commit complete.

SQL select count(*) from hw_test;

COUNT(*)

----------

445

在主体站点观察变化:

SQL select * from global_name;

GLOBAL_NAME

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

AUTHAA.COOLYOUNG.COM.CN

SQL select count(*) from hw_test;

COUNT(*)

----------

445

SQL

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有