潇湘--雨 发表于 2010-11-23 11:17

请教高手:Sybase RS如何创建表级复制

我现在做的是test1库整库复制到test2库,再由test2库表级复制到test3库(test2库跟test3库在一台主机上)。
整库复制创建成功后,按照以下步骤创建表级复制:
1. 主点允许复制
   use test2
   go
   sp_setreptable        t_table ,true
   go
2. 定义TXT定义
   sp_setrepcol t_table, beizhu,replicate_if_changed
   go
3.设置用户连接
use test2
   go
   sp_dropuser   test2_maint
   go
   sp_addaliastest2_maint ,dbo
   go
   grant role sa_role to test2_maint
   go

   use test3
   go
   sp_dropuser   test3_maint
   go
   sp_addaliastest3_maint ,dbo
   go
   grant role sa_role to test3_maint
   go

4.出版 --RS执行
create publication "test3_aa"
    with primary at B.test2
    create replication definition "test3_1402"
      with primary at B.test2
      with all tables named "a"
      ( "a" char(10),
       "b" char(10))
      primary key("a")
      send standby all columns
      replicate all columns
   create article "a"
            for "test3_aa"
    with primary at B.test2
    with replication definition "test3_1402"
validate publication "test3_aa"
with primary at B.test2

5.订阅 --RS执行
create subscription sub_test3
   for publication test3_aa
   with primary at B.test2
   with replicate at B.test3
   subscribe to truncate table

以上步骤执行完之后测试,test3中a表数据并未复制到,错误日志为:
I. 2010/11/23 11:13:56. _SUB_RECOVERY_DAEMON: Retrying materialization for subscription <aa> for article <a> with replicate at <YKZ20101118BPJ.sbtest> for the 527 time
I. 2010/11/23 11:13:56. SQM stopping: 104:-2147483545 a.aa
I. 2010/11/23 11:13:56. SQM starting: 104:-2147483545 a.aa
E. 2010/11/23 11:13:56. ERROR #1028 SUB(aa) - seful\cm.c(3463)
        Message from server: Message: 4002, State 1, Severity 14 -- 'Login failed.
'.
E. 2010/11/23 11:13:56. ERROR #1027 SUB(aa) - seful\cm.c(3463)
        Open Client Client-Library error: Error: 67175468, Severity 4 -- 'ct_connect(): protocol specific layer: external error: The attempt to connect to the server failed.'.
E. 2010/11/23 11:13:56. ERROR #13045 SUB(aa) - seful\cm.c(3467)
        Failed to connect to server 'YKZ20101118BPJ' as user 'sa'. See CT-Lib and/or server error messages for more information.

为什么会这样?请各位高手支招!谢谢了!

wfcjz 发表于 2010-11-23 11:35

你这个貌似是网络中断,你再来一次试试看!

潇湘--雨 发表于 2010-11-23 11:47

但是我用admin who_is_down,没有down的。?????

Eisen 发表于 2010-11-23 15:35

Rs不支持广播风暴的,也就是说不存在test1->test2->test3->...的方式,所以我觉得你的复制构架有问题。
而且text,blob等巨字段的复制都要先进行同步再作复制定义的。

潇湘--雨 发表于 2010-11-23 16:12

test1->test2->test3这种复制构架是没问题的,因为之前有做成功过。数据库也没有text,blob等字段,我只是随便建了一个简单的table:create table dbo.a (a char(10) not null, b char(10) null) ;
alter table dbo.a add constraint a primary key nonclustered (a) ;
所以应该不是这些原因吧??

hobbylu 发表于 2010-11-24 08:20

你一看错误日志就知道是什么问题
再看你说的,是由于建了一个新表,再可以看出来,你这个库是全库复制的,而且是复制DDL的,因此会对建表动作也进行复制。而复制系统里面对建表动作是会考虑以哪个用户来建表的,很明显你是sa用户。因此在复制点建表的时候,会模拟sa用户来建表,但你主点和复制点的sa密码是不一致的,所以会造成此错误。
解决办法可以用以下任意一种
1、修改成一致的sa密码
2、resume .. skip tran,手工客户端建表

潇湘--雨 发表于 2010-11-24 09:15

1.sa密码是一致的
2.test1->test2是全库复制,test2->test3是表复制,test3库已有表结构(手工建表),只需要复制数据

hobbylu 发表于 2010-11-24 09:35

I. 2010/11/23 11:13:56. _SUB_RECOVERY_DAEMON: Retrying materialization for subscription <aa> for article <a> with replicate at <YKZ20101118BPJ.sbtest> for the 527 time
I. 2010/11/23 11:13:56. SQM stopping: 104:-2147483545 a.aa
I. 2010/11/23 11:13:56. SQM starting: 104:-2147483545 a.aa
E. 2010/11/23 11:13:56. ERROR #1028 SUB(aa) - seful\cm.c(3463)
      Message from server: Message: 4002, State 1, Severity 14 -- 'Login failed.
勿用质疑我说给你说的,肯定是这个毛病,自己好好检查

潇湘--雨 发表于 2010-11-24 09:57

我还是不太明白,整库复制是成功的啊,只是再由test2库表级复制到test3库(test2库跟test3库在一台主机上)出错,它们的sa密码不应该是一致的吗?具体怎样操作,请再指点指点。谢谢!:emn23:

hefan 发表于 2011-03-04 18:19

Failed to connect to server 'YKZ20101118BPJ' as user 'sa'

在 test3上能连接到test2吗?sa用户

这句是故障点啊。
页: [1] 2
查看完整版本: 请教高手:Sybase RS如何创建表级复制