Create Schedules

Use create schedule to create a schedule to execute shell commands at a time you specify.

For example, you can report on a specific state of the replicate database while the replicate database is frozen and not receiving data from the primary database. In this example, you can schedule replication to happen only during specific night hours, so that the processing of the next day does not change the replicate database, and reporting can occur on the data of the day before, that is frozen in the replicate database. You can do this by creating schedules to suspend and resume connections to the replicate database at specific times of the day.

Syntax:
create schedule sched_name as ‘sched_time’ [set {on | off}] for exec ‘command

Parameters:

Example 1

Create “schedule1” in Windows that suspends the connection to the pubs2 database in the SYDNEY_DS data server at 12:00p.m.every Monday and 12:00p.m. on the 16th of every month:
  1. Create a text file, such as sql.txt that contains the actual Replication Server command line that you want to schedule. For example, sql.txt can contain:
    suspend connection to SYDNEY_DS.pubs2
    go
  2. Create a batch file, such as suspend_conn.bat in Windows that contains isql and relevant parameters to run the command line in sql.txt. For example, suspend_conn.bat can contain:

    %SYBASE\OCS-15_0\bin\isql.exe -Usa -P -S SYDNEY_DS -I %SYBASE%\sql.ini -i %SYBASE%\REP-15_5\sched\sql.txt

  3. Create the schedule, “schedule1”:
    create schedule schedule1 as ‘0 12 16 * 1’ for exec
    ‘test.bat > c:\temp\test.out’
    go

Example 2

Create “schedule2” to execute the suspend_conn.sh script in UNIX that suspends the connection to the pubs2 database in the SYDNEY_DS data server every day at 8:17p.m.:
create schedule schedule2 as ‘17 20 * * *’ for exec
‘suspend_conn.sh’

Example 3

Create “schedule3” to execute the resume_conn.sh script that resumes the connection to the pubs2 database in the SYDNEY_DS data server every day at 7:15a.m.:
create schedule schedule2 as '15 7 * * *' for exec
‘resume_conn.sh’