26/9/21 11:04 SAP Sybase ASE Warm Standby Database using Replication Server - Database Tutorials
SAP Sybase ASE Warm Standby Database using Replication Server
Engr. Mohammad Rizwan Yasin
September 5, 2018
Sybase
We are going to create warm standby backup of SAP Sybase ASE Prod1 server to Standby1 server using
Sybase Replication Server REP15_7 for a database named : testdb. It comprises to the following 15 steps.
Pre-Requisites :
a) 2 Sybase ASE instances
b)1 replication server instance
c)1 database named testdb
Step 1: Enable Replication Agent on both Sybase ASE Servers
1 sp_configure 'enable rep agent threads' ,1
Step 2: Create a login that on both Sybase ASE Servers and assign replication_role
https://dbtut.com/index.php/2018/09/05/sap-sybase-ase-warm-standby-database-using-replication-server/ 1/7
26/9/21 11:04 SAP Sybase ASE Warm Standby Database using Replication Server - Database Tutorials
These logins will be used in Replication Process
Create logins on both server
1 use master
2 go
3 sp_addlogin test_maint,xxxxx
4 go
5 grant role replication_role to test_maint
6 go
Step 3: Add the user to the dbo profile of the database that is invlovled in this process.
1 use testdb
2 go
3 sp_addalias test_maint,dbo
4 go
Step 4: Synchronize the logins on both the servers if required
execute this to export logins for primary server:
1 bcp master..syslogins out /tmp/logins.txt -c -SProd1 -Usa -P
2
3 execute this to import logins on secondary server:
4
5 bcp master..syslogins in /tmp/logins.txt -c -SStandby1 -Usa -P
Step 5: Install the replication script for both Primary & Standby Servers
https://dbtut.com/index.php/2018/09/05/sap-sybase-ase-warm-standby-database-using-replication-server/ 2/7
26/9/21 11:04 SAP Sybase ASE Warm Standby Database using Replication Server - Database Tutorials
Login to rep server and browse the script from location $SYBASE/REP15-5_5/scripts and execute this:
1 isql -Usa -P<password> -SProd1 -Dtestdb -i changed_rs_install_primary.sql
2 &
3 isql -Usa -P<password> -SStandby1 -Dtestdb -i changed_rs_install_primary.sql
Step 6: Create logical connection on replication server
Connect to the replication server and execute this
1 create logical connection LASE.testdb
2 go
Step 7: Create a connection from replication serer to active database
1 create connection to Prod1.testdb
2 set error class to rs_sqlserver_error_class
3 set function string class to rs_sqlserver_function_class
4 set username to test_maint
5 set password to xxxxx
6 with log transfer on
7 as active for LASE.testdb
Step 8: Create a login in the replication server
This user will be used to connection replication agent from Sybase ASE Servers
1 create user rep_user
https://dbtut.com/index.php/2018/09/05/sap-sybase-ase-warm-standby-database-using-replication-server/ 3/7
26/9/21 11:04 SAP Sybase ASE Warm Standby Database using Replication Server - Database Tutorials
2 set password '123456'
3 set password_expiration to '0'
4 go
5 grant connect source to rep_user
6 go
Step 9: Create a connection from the replication server to the standby server
1 create connection to Standby1.testdb
2 set error class to rs_sqlserver_error_class
3 set function string class to rs_sqlserver_function_class
4 set username to test_maint
5 set password to xxxxx
6 with log transfer on
7 as standby for LASE.testdb
8 use dump marker
9 go
Step 10: Check the logical connections
execute the following command on replication server
1 admin logical_status
2 go
3 LASE.testdb
4 [107] Prod1.testdb
5 Suspended/
6 [108] Standby1.testdb
7 Active/
8 [16777317] REP15_7
9 None
10 None
https://dbtut.com/index.php/2018/09/05/sap-sybase-ase-warm-standby-database-using-replication-server/ 4/7
26/9/21 11:04 SAP Sybase ASE Warm Standby Database using Replication Server - Database Tutorials
Step 11: Mark the database for replication and grant permissions
Execute the following command on primary server to grant permissions and activate the database to
capture all activities for production database by executing the commands:
1 grant execute on rs_update_lastcommit to public
2 grant execute on rs_marker to public
3 grant execute on rs_check_repl_stat to public
4 go
5 sp_reptostandby 'testdb','all'
6 go
Step 12: Configure Replication Agent on primary server
Execute the following command on primary server to configure replication agent on primary server
1 use testdb
2 go
3
4 sp_config_rep_agent 'testdb', 'enable', 'REP15_7', 'rep_user', 'xxxxx'
5 go
6 sp_config_rep_agent 'testdb', 'send warm standby xacts', true
7 go
8 sp_setreplicate rs_marker,'true'
9 go
10 sp_setreplicate rs_update_lastcommit,'true'
11 go
12
13 Execute the following command to start replication agent on primary server
14
15 sp_start_rep_agent 'testdb'
16 go
https://dbtut.com/index.php/2018/09/05/sap-sybase-ase-warm-standby-database-using-replication-server/ 5/7
26/9/21 11:04 SAP Sybase ASE Warm Standby Database using Replication Server - Database Tutorials
Check the error log to verify the status of replication agent.
Step 13: Dump the database on primary server
1 dump database testdb to '/tmp/test_bk.dat'
Step 14: Restore the database on standby server
1 load database testdb from '/tmp/test_bk.dat'
2 go
3 online database testdb
4 go
Step 15: Resume the connection on Primary & Standby Servers and verify the replication status
Connect the replication server and execute the following commands to resume the connections of primary
& secondary servers to replication server respectively.
1 resume connection to Prod1.testdb
2 go
3 resume connection to Standby1.testdb
4 go
5 Check the replication status by the following commands
6 admin logical_status
7 go
8 admin who_is_down
9 go
https://dbtut.com/index.php/2018/09/05/sap-sybase-ase-warm-standby-database-using-replication-server/ 6/7
26/9/21 11:04 SAP Sybase ASE Warm Standby Database using Replication Server - Database Tutorials
Step 16: Validate the replication between primary & standby servers
Primary:
1 use testdb
2 go
3 CREATE TABLE dbo.TEST1 ( COL1 int NOT NULL, COL2 varchar(25) NULL ) LOCK ALLPAGES
4 GO
5
6 insert into dbo.TEST1 values (5,'B')
7
8 select * from TEST1
9
10 Secondary:
11
12 select * from TEST1
DONE!!!
1457 total views , 2 views today
Engr. Mohammad Rizwan Yasin
Author: Engr. Mohammad Rizwan Yasin
https://dbtut.com/index.php/2018/09/05/sap-sybase-ase-warm-standby-database-using-replication-server/ 7/7