免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 5809 | 回复: 10
打印 上一主题 下一主题

请教高手:Sybase RS如何创建表级复制 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-11-23 11:17 |只看该作者 |倒序浏览
我现在做的是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_addalias  test2_maint ,dbo
   go
   grant role sa_role to test2_maint
   go

   use test3
   go
   sp_dropuser   test3_maint
   go
   sp_addalias  test3_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.

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

论坛徽章:
33
ChinaUnix元老
日期:2018-07-04 15:10:362015年亚洲杯之阿联酋
日期:2015-02-06 17:15:532015亚冠之武里南联
日期:2015-06-06 15:40:252015亚冠之北京国安
日期:2015-06-17 15:42:412022北京冬奥会纪念版徽章
日期:2015-08-10 16:30:322015亚冠之阿尔纳斯尔
日期:2015-09-20 09:42:1215-16赛季CBA联赛之北京
日期:2016-01-15 10:03:5915-16赛季CBA联赛之青岛
日期:2016-04-26 16:44:4915-16赛季CBA联赛之广夏
日期:2018-07-04 15:33:21C
日期:2016-10-25 16:12:142017金鸡报晓
日期:2017-01-10 15:19:5615-16赛季CBA联赛之同曦
日期:2017-02-22 22:41:10
2 [报告]
发表于 2010-11-23 11:35 |只看该作者
你这个貌似是网络中断,你再来一次试试看!

论坛徽章:
0
3 [报告]
发表于 2010-11-23 11:47 |只看该作者
但是我用admin who_is_down,没有down的。?????

论坛徽章:
7
数据库技术版块每日发帖之星
日期:2015-08-09 06:20:00数据库技术版块每日发帖之星
日期:2015-11-03 06:20:00数据库技术版块每日发帖之星
日期:2016-02-20 06:20:00数据库技术版块每日发帖之星
日期:2016-07-13 06:20:00数据库技术版块每日发帖之星
日期:2016-07-31 06:20:00数据库技术版块每日发帖之星
日期:2016-08-01 06:20:00数据库技术版块每日发帖之星
日期:2016-08-18 06:20:00
4 [报告]
发表于 2010-11-23 15:35 |只看该作者
Rs不支持广播风暴的,也就是说不存在test1->test2->test3->...的方式,所以我觉得你的复制构架有问题。
而且text,blob等巨字段的复制都要先进行同步再作复制定义的。

论坛徽章:
0
5 [报告]
发表于 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) ;
所以应该不是这些原因吧??

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

论坛徽章:
0
7 [报告]
发表于 2010-11-24 09:15 |只看该作者
1.sa密码是一致的
2.test1->test2是全库复制,test2->test3是表复制,test3库已有表结构(手工建表),只需要复制数据

论坛徽章:
0
8 [报告]
发表于 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.
勿用质疑我说给你说的,肯定是这个毛病,自己好好检查

论坛徽章:
0
9 [报告]
发表于 2010-11-24 09:57 |只看该作者
我还是不太明白,整库复制是成功的啊,只是再由test2库表级复制到test3库(test2库跟test3库在一台主机上)出错,它们的sa密码不应该是一致的吗?具体怎样操作,请再指点指点。谢谢!

论坛徽章:
0
10 [报告]
发表于 2011-03-04 18:19 |只看该作者
Failed to connect to server 'YKZ20101118BPJ' as user 'sa'

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

这句是故障点啊。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP