DisCopy


Thursday 9 November 2017

Some Interesting Scenarios and Resolutions

Scheduling Replication Tasks or Delaying the Replication

Sybase Replication Server provides support for Scheduling a specific task (It could be Suspending a connection or Resuming a Connection) or Delaying replication by a fixed period of time (Not more than 24 Hours)

Why do we need to Suspend/Resume or Delay Replication?

If you look into Creditcard online statement or Mobile call History, you would notice the Data is visible/available till last night, I mean the data found till the date prior to current-day only.
Due to business requirements and performance issues, during peak hours or day-time we might need to stop the Replication or suspend the Replication and Resume in the Evening i.e. off business hours.

We can do this using schedules : create a schedule to execute shell command/script at a time we specify:

Syntax -->  create schedule schedule_name as 'TIME' [set { on | off } for exec 'command'

For an Example: 

Create “schedule1” to execute the suspend_conn.sh script in UNIX that suspends the connection to the pubs2 database every day at 6AM:
create schedule schedule1 as ‘0 6 * * *’ for exec ‘suspend_conn.sh’


Create “schedule2” to execute the resume_conn.sh script that resumes the connection to the pubs2 database every day at 10 PM:
create schedule schedule2 as ‘0 22 * * *’ for exec ‘suspend_conn.sh’


Delay Replication


We can configure Replication Server to delay replication by a fixed period of time. We can use the replicate database as a failback system by keeping the replicate database a certain amount of time behind the primary database to provide a window of time during which to recover any human error committed on the primary database, such as a table or records dropped or truncated by mistake. 

We can specify a maximum delay of 24 hours. The default delay value is 00:00 which means there is no delay.

To delay by a couple of hours of the time (Lag/Latency will be more than 2 Hours now) transactions commit at the pubs2 replicate database in the SECOND_DS data server, enter:
alter connection to SECOND_DS.pubs2  set dsi_timer to ‘02:00’




No comments:

Post a Comment