devilring 发表于 2012-05-09 16:32

sybase replication server问题(急!急!)

之前sybase工程过来给我单位装了sybase replication server同步,但是仅留下了10来个PDF文档,也没个目录什么的,现在我们系统升级了,需要增加几个表,并修改几个表结构
单位也不肯为了这点事情就购买新服务,老服务到齐了,哎
因为当初sybase工程师仅给我们做了2个库的表数据同步定义,所以变更表结构和新增表不会同步;

我们目前总共有2个节点,主服务器,备份服务器,rs装在备份服务器上,没有图形界面,都是后台操作,我的思路是:
1、先找到当初sybase工程师给我们创建的数据库复制定义(就是create database replication definition 创建的那个)
2、然后用alter database replication 命令修改先过滤掉需要修改表结构的几个表
3、修改完表结构后,把新增表创建完成,再用alter database replication 命令把这几个表加进去

问题出来了:
1、我上面的思路是否可行
2、我不知道怎么查看数据库复制定义,不知用哪个命令能找到
3、我看了一些文档,虽然有alter database replication 命令介绍,但是不知道怎么用来添加复制表,sybase给的命令手册里只有过滤即删除复制表的例子,希望高手给写个成功的例子
4、按照以上步骤怎么做,我需要重新启动rs吗?如果需要,请告诉我重启sybase数据库和rs的步骤,因为我是首次接触这个工具,这才刚刚接触了几天,希望高手能写的详细点儿,最好能注明每个命令的作用和参数代表什么意思

Eisen 发表于 2012-05-09 16:32

本帖最后由 Eisen 于 2012-05-10 17:09 编辑

这不就满足你的要求了嘛,不用着急了,依样画葫芦下周保你成功

我也得下班回家了

Eisen 发表于 2012-05-09 17:22

1. 思路完全可行,不过要保证在alter table和alter replication definition之间者短时间内,对table没有write操作
2. 进入RSSD库,使用rs_helprep命令可以查看所有replication definition,如果太多,可以简单些用
select objname from rs_objects where phys_tablename=tbname来先查到相关deinition名字,再用rs_helprep defname来确认到底是哪一个
3. 添加新复制定义不能用alter replication definition,得用create replication definition,详情参看我以前的科普贴-- http://bbs.chinaunix.net/thread-1771511-1-1.html

4. 无论create还是alter replication ..都无需重起RS。

devilring 发表于 2012-05-09 17:55

rs_helprep

Replication Definition Name    PRS                  Primary DS.DB                                                 Primary Table      Replicate Table      Type
---------------------------    ---                  -------------                                                 -------------      ---------------      ----
rs_classes                     JIFEIRS            JIFEI_RSSD.JIFEIRS_RSSD                                       rs_classes                              Tbl
rs_columns                     JIFEIRS            JIFEI_RSSD.JIFEIRS_RSSD                                       rs_columns                              Tbl
rs_databases                   JIFEIRS            JIFEI_RSSD.JIFEIRS_RSSD                                       rs_databases                              Tbl
rs_dbreps                      JIFEIRS            JIFEI_RSSD.JIFEIRS_RSSD                                       rs_dbreps                                 Tbl
rs_dbsubsets                   JIFEIRS            JIFEI_RSSD.JIFEIRS_RSSD                                       rs_dbsubsets                              Tbl
rs_erroractions                JIFEIRS            JIFEI_RSSD.JIFEIRS_RSSD                                       rs_erroractions                           Tbl
rs_funcstrings               JIFEIRS            JIFEI_RSSD.JIFEIRS_RSSD                                       rs_funcstrings                            Tbl
rs_functions                   JIFEIRS            JIFEI_RSSD.JIFEIRS_RSSD                                       rs_functions                              Tbl
rs_objects                     JIFEIRS            JIFEI_RSSD.JIFEIRS_RSSD                                       rs_objects                              Tbl
rs_routes                      JIFEIRS            JIFEI_RSSD.JIFEIRS_RSSD                                       rs_routes                                 Tbl
rs_systext                     JIFEIRS            JIFEI_RSSD.JIFEIRS_RSSD                                       rs_systext                              Tbl

select objname , phys_tablename from rs_objects   
没有表名啊                                       
objname                        phys_tablename   
-------                        --------------   
rs_classes                     rs_classes         
rs_columns                     rs_columns         
rs_databases                   rs_databases      
rs_dbreps                      rs_dbreps         
rs_dbsubsets                   rs_dbsubsets      
rs_erroractions                rs_erroractions   
rs_funcstrings               rs_funcstrings   
rs_functions                   rs_functions      
rs_objects                     rs_objects         
rs_routes                      rs_routes         
rs_systext                     rs_systext         


还有个问题,我不是想增加复制定义,我是想在复制定义里增加表,就像文档里
create database replication definition ... with ... replicate table in(tab1,tab2...)

不知道在alter时怎么用,我看例子里有过滤的,但是没有增加的
alter database replication definition ...with ... not replicate table in(tab1)
因为是正式库,我没有其他环境,时间又比较近,所以我不敢随便乱测试,不知道是不是
alter database replication definition ...with ...replicate table in(tab1) 这样就添加了一个新表吗?还是把原来定义的表给覆盖了啊,我不敢随便测

还有我在执行以下命令是报了这个错不知道是怎么回事

1> sp_setreptable xwrep_test, true
2> go
Msg 9137, Level 16, State 2:
Server 'APCHUANBO3', Procedure 'sp_setreptable', Line 513:
LTM trunc. point not yet established with DBCC SETTRUNC().Until the LTM trunc. point is established, changes to the object 'xwrep_test' may not be replicated.
The replication status for 'xwrep_test' is set to true, owner_off.

1> create subscription xwrep_test_sub for rep_test with replicate at JIFEI.bohai
2> go
Msg 15249, Level 12, State 0:
Server 'JIFEIRS':
Can not use active or standby connection names for subscriptions



2BeSybPro 发表于 2012-05-09 22:21

首先请确认你比较过主服务器和备份服务器两边的表结构。

难道用的是warm standby 和sp_setreptable而不是sp_reptostandby?
请给出下面命令的输出。

在主服务器的主库(PDB)
isql -U
use your_db_name
go
sp_help_rep_agent your_db_name
go

在Replication Server上
admin logical_status
go


Eisen 发表于 2012-05-09 23:50

哈。看懂了。那个replicate table in(tab1,tab2...)是db replication definition的东西,果然是MSA架构,不是单纯的table replication阿。那其实也挺简单,用 rs_helpdbrep检查

2BeSybPro 发表于 2012-05-10 07:38

是的,不但要看他的replication用的是warmstandby还是MSA,而且还要看replication是怎样定义的。

hobbylu 发表于 2012-05-10 08:55

用MSA的话,其实很简单的,用sybase central中的RM插件,很方便的就可以完成增加表复制等相关功能。

devilring 发表于 2012-05-10 09:33

1> sp_help_rep_agent bohai
2> go
Replication Agent Recovery status
dbname                         connect dataserver             connect database               status                         rs servername                  rs username
------------------------------ ------------------------------ ------------------------------ ------------------------------ ------------------------------ ------------------------------
bohai                        APCHUANBO3                     bohai                        not active                     JIFEIRS                        bohai_rep_agent
Replication Agent Process status
dbname                         spid      sleep status                   retry count last error
------------------------------ ----------- ------------------------------ ----------- -----------
bohai                        43          end of log                     0         0
Replication Agent Scan status
dbname                         start marker                   end marker                     current marker               log recs scanned oldest transaction
------------------------------ ------------------------------ ------------------------------ ------------------------------ ---------------- ------------------------------
bohai                        (7628872,14)                   (7628873,3)                  (7628873,3)                  0                (-1,0)
Replication Agent Configuration
dbname   auto startrs servername    rs username      connect dataserverconnect database   scan batch size scan timeout retry timeout skip ltl errors batch ltl   send warm standby xacts      send maint xacts to replicateha failover   skip unsupported features      short ltl keywords    send buffer size   priority    send structured oqids   data limits filter modeschema cache growth factor
-------- ----------- ---------------- ------------------ ------------------- ------------------ --------------- ------------ ------------- --------------- ----------- ------------------------------ ------------------------------ ------------- ------------------------------ --------------------- ------------------ ----------- ----------------------- ------------------------ ------------------------------
bohai    true      JIFEIRS          bohai_rep_agent    APCHUANBO3          bohai            1000            15         60            false         true      true                           false                        true          false                        false               2k               5         false                   off                      1
Replication Agent Security Configuration
dbname                         security mechanism             unified login                  msg confidentiality            msg integrity                  msg replay detection         msg origin check               msg out-of-sequence check      mutual authentication
------------------------------ ------------------------------ ------------------------------ ------------------------------ ------------------------------ ------------------------------ ------------------------------ ------------------------------ ------------------------------
bohai                        n/a                            false                        false                        false                        false                        false                        false                        false
(return status = 0)



admin logical_status
go   
               
Logical Connection Name   Active Connection Name   Active Conn State   Standby Connection Name   Standby Conn State   Controller RS       Operation in Progress   State of Operation in Progress   Spid
------------------------- ------------------------ ------------------- --------------------------- -------------------- ------------------------------------------- -------------------------------- -----
APCHUANBO3.bohai    APCHUANBO3.bohai   Active/             JIFEI.bohai         Active/             JIFEIRSNone                  None


使用rs_helpdbrep命令没数据

其实我只是想在原有的数据库复制定义下面(database replication definition)增加和删除表,这样做起来最简单,因为是生产库,而且时间又很紧,以我的认知觉得这样只需要用1条命令就(alter database replication definition)就能实现,但是不知道对不对,而且当初sybase工程师来装的时候我也不再现场,又不知道 数据库复制定义的名称是什么,所以请教各位,而且我上面说过了,我没有图形界面,无法用图形界面连接,所以只能是命令行执行,请几位前辈高手指点,谢谢

devilring 发表于 2012-05-10 09:41

我不懂你们说的warmstandby还是MSA,毕竟我才接触2、3天,只是看了些资料,所以我认为sybase的人肯定不可能用一个个表复制定义这种办法来进行复制,后来发现可以整个数据库复制,所以我就猜测是用的数据库复制这种批量的方式,以我的浅显认知,就想出了这个思路来增加和删除需要复制的表,但是我又不知道这样是否可行,而且也不知道该执行哪些命令才能最终达到这个目的,所以请各位前辈高手能说的仔细点,假如想要达到这个目的需要什么样的命令,如果需要确认什么信息也请一起发出来,我执行后把结果发给你们,并且请各位前辈高手能给我解释下,越详细越好,谢谢
页: [1] 2 3 4 5 6 7 8
查看完整版本: sybase replication server问题(急!急!)