Sybase复制:基于整库复制(warm standby)

来源:互联网 发布:淘宝卖家跟快递合作 编辑:程序博客网 时间:2024/05/03 22:01

Sybase复制:基于整库复制(warm standby)

  前言:基于整库复制(warm standby);复制服务器名字 : syb_rep;主数据库服务器etoh2和备份数据库服务器etoh2_sdb

  前言:

  基于整库复制(warm standby)

  复制服务器名字 : syb_rep

  主数据库服务器和主库etoh2.etoh2_sc to备份数据库服务器和备份库etoh2_sdb.etoh2_sc

  Sybase的复制步骤:

  1.复制服务器和ASE数据库的interfaces中都要包括上面三个server的接口信息

  2.用复制服务器安装的用户登录。

  3.使用/repsrv/rep-12_5/install/rs_init安装复制服务器

  (ctrl-a接受 ctrl-b向后 ctrl-x退出)

  1>Configure a Serverproduct

  2> Replication Server

  3> Install a new Replication Server

  3.1> Replication ServerInformation

  3.1.1输入复制服务器的名字syb_rep

  3.1.2 Is this Replication Server the ID Server选择Yes

  3.2> Replication ServerSystem Database

  3.2.1 RSSD SQL Server Name:输入安装复制服务器系统库的数据库服务器名字etoh2_sdb

  3.2.2 Create RSSD :如果没有建过这个库,选Yes

  3.2.3 SApassword :输入sa口令

  3.3> RSSD Device Information

  3.3.1 Size of the RSSDDatabase:输入syb_rep_RSSD数据库的大小(30-50M)

  3.3.2 RSSD device name :输入数据库设备的名字

3.3.3如果数据库中没有建立设备,选择 Create the RSSD device 并输入设备文件名和大小

  3.3.4 Size of the RSSDDatabase:输入syb_rep_RSSD日志的大小(30-50M)

  3.4> DiskPartition

  3.4.1 Partition文件必须存在,可以使用>filename(touch filename)创建

  3.4.2 Disk PartitionPath:输入partition文件的文件名

  3.4.3 Logical Identifier for Disk Partition:输入partition在复制服务器中的逻辑名

  3.4.4 Size of Disk Partition:输入Partiton的大小(一定要分配足够大的空间,否则在大的事务复制时会因为partition满而出错)

  3.5>如果所有选项全部为complete状态,按ctrl-a创建复制服务器

  创建完后不要退出rs_init,后面还要用

  4.在主点数据库和备份点数据库服务器中分别执行

  设置数据库服务器可以复制


  isql -Usa -P; -S;
  1> use master
  2> go
  1> sp_configure 'enable rep agent threads',1
  2> go

  如果etoh2_sc没有设置select into 选项,需要如下设置


  1> use master
  2> go
  1> sp_dboption etoh2_sc,'select into',true
  2> go
  1> use etoh2_sc
  2> go
  1> checkpoint
  2> go

  5.在复制服务器中执行

isql -Usa -P -S;
  1> create logical connection to etoh2.etoh2_sc
  2> go

  6.rs_init中增加主库到复制中,选择 add a database to the replicationsystem

  6.1> ReplicationServer Information

  6.1.1>输入复制服务器名字syb_rep

  6.2> DatabaseInformation

  6.2.1> SQL Server Name:输入主数据库服务器名etoh2

  6.2.2> SApassword :输入sa口令

  6.2.3> Database name:输入主库名etoh2_sc

  6.2.4> Will database be replicated :选择Yes

  6.2.5> Is this a Physical Connection for Existing Logical Connection:选择Yes

  6.2.6> Logical DB Setup

  6.2.6.1> Is this an Active Connection or Standby Connection:选择active

  6.2.6.2> Logical DS Name :输入主服务器名etoh2

  6.2.6.3> Logical DB Name :输入主数据库名etoh2_sc

  6.3>如果所有选项全部为complete状态,添加数据库

  7.在主数据库服务器中执行


  isql -Usa –P  -Setoh2
  1> use etoh2_sc
  2> go
  1> sp_reptostandby etoh2_sc,"all"
  2> go
  1> grant role sa_role to etoh2_sc_maint
  2> go

 

在备份数据库服务器中执行:


  isql -Usa -P; -Setoh2_sdb
  1> use master
  2> go
  1> sp_addlogin etoh2_sc_maint,etoh2_sc_maint_ps,@defdb="etoh2_sc"
  2> go
  1> use etoh2_sc
  2> go
  1> sp_adduser etoh2_sc_maint
  2> go
  1> grant role sa_role to etoh2_sc_maint
  2> go

  8.同步主服务etoh2和备份服务etoh2_sdbloginrole、权限等,要保证两台机器的login id一致

  9.rs_init中增加备份库到复制中,选择 add a database to the replicationsystem

  9.1> ReplicationServer Information

  9.1.1>输入复制服务器名字syb_rep

  9.2> DatabaseInformation

  9.2.1> SQL Server Name:输入备份数据库服务器名etoh2_sdb

  9.2.2> SApassword :输入sa口令

  9.2.3> Database name:输入主库名etoh2_sc

  9.2.4> Will database be replicated :选择Yes

  9.2.5> Is this a PhysicalConnection for Existing Logical Connection:选择Yes

  9.2.6> Logical DB Setup

  9.2.6.1> Is this an Active Connection or Standby Connection:输入standby

  9.2.6.2> Logical DS Name :输入主服务器名etoh2

  9.2.6.3> Logical DB Name :输入主数据库名etoh2_sc

  9.2.6.4> Active DS Name :输入主服务器名etoh2

9.2.6.5> Active DB Name :输入主数据库名etoh2_sc

9.2.6.6> Active Db sapassword :输入主数据库sa口令

9.2.6.7> initialize standy using dump and load:选择no

  9.3>如果所有选项全部为complete状态,添加数据库

  10.从主库dump到备份库load&online

  11.在复制服务器中恢复连接


  isql -Usa -P –Ssyb_rep
  1> resume connection to etoh2.etoh2_sc
  2> go
  1> resume connection to etoh2_sdb.etoh2_sc
  2> go

1>alter logical connection to etoh2.etoh2_sc set send_truncate_table to 'on'

2>go

12.最后修改备份服务etoh2_sdb的参数与主服务etoh2一致,锁的数量最好大于主库。

13.性能优化部分:

  isql -Usa -P –Ssyb_rep
  1> configure replication server set memory_limit to "512" –默认为20M
  2> go
  1> configure replication server set exec_cmds_per_timeslice to "3000"
  2> go

原创粉丝点击