Show TOC

create scheduleLocate this document in the navigation structure

Creates a schedule to execute shell commands at a time you specify.

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

The name of the schedule you provide, which:

  • Must conform to the rules for identifiers

  • Must be unique

  • Can be 1 – 30 bytes long


The time and day to execute ‘<command>’. Provide the day and time in the restricted UNIX cron style with a single space separating the time and date parameters:

[<mm>] [<HH>] [<DOM>] [<MON>] [<DOW>]

The time and date parameters are:





Minutes past the hour

0 – 59. Use “*” to include all legal values.


Hour in 24-hour notation

0 – 23. Use “*” to include all legal values.


Day of the month

1 – 31. Use “*” to include all days of the month.


Month of the year

1 – 12. Use “*” to include all months of the year.


Day of the week

0 – 6 with 0=Sunday. Use “*” to include all days of the week.

  • Use an asterisk “*” to specify all valid values. For example, “17 20 * * *” represents a daily schedule at 8:17 p.m.

  • Use a comma “,” to separate values that are not part of a range. For example, “17 20 1,15 * *” represents 8:17 p.m. on the 1st and 15th of every month, where 1 and 15 are the values for the <DOM> parameter.

  • Use a hyphen “-” between two values to specify a range of values, inclusive of the two values. For example, “17 20 * * 1-5” represents 8:17 p.m. from Monday to Friday where “1-5” are the range of values for the <DOW> parameter.

  • For the <DOM>, <MON>, or <DOW> parameters, you can specify the day using both the <DOM> and <DOW> parameters. Replication Server follows all schedules you specify in the string. For example, “0 12 16 * 1” represents 12:00 p.m.every Monday and 12:00 p.m. on the 16th of every month.

set [on | off}

Enables or disables the schedule when you create it. By default, the schedule is on.


The shell command, such as scripts, executables, or batch files to execute at the specified schedule. Enclose in single quotes.

Shell commands:

  • Must be in $SYBASE/$SYBASE_REP/sched for UNIX or %SYBASE%\%SYBASE_REP%\sched for Windows

  • Can include parameters delimited with a space within the shell command.

  • In Windows, create schedule executes the command specified in the last parameter within the shell command or batch file. You must also include stdout to a file in the create schedule command line.

In shell command names, you:

  • Can use only ASCII alphanumeric characters, such as A – Z, a – z, and 0 – 9

  • Can use the “.”, “-”, and “_” characters

  • Cannot use the “\” and “/” characters

  • Must include the .bat suffix if you are executing on Windows. For example, the name should be suspend_conn.bat on Windows and on UNIX.

Example 1

Create “schedule1” in Windows that suspends the connection to the <pubs2> database in the SYDNEY_DS dataserver at 12:00 p.m.every Monday and 12:00 p.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
  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’
Example 2

Create “schedule2” to execute the script in UNIX that suspends the connection to the <pubs2> database in the SYDNEY_DS dataserver every day at 8:17p.m.:

create schedule schedule2 as ‘17 20 * * *’ for exec
Example 3

Create “schedule2” to execute the script that resumes the connection to the <pubs2> database in the SYDNEY_DS dataserver every day at 7:15 AM:

create schedule schedule2 as '15 7 * * *' for exec
  • Schedule the time you want to perform replication tasks – to report, for example, on a specific state of the replicate database while the replicate database is frozen and not receiving data from the primary database.

  • 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.


create schedule requires “sa” permission.