Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP SQL Anywhere, on-demand edition 1.0 SP 6 » Task syntax

CreateSchedule task

Creates a task schedule.

Syntax 1 (SQL)
CALL DBCloud.CreateSchedule ( schedule_name=schedule_name, taskdefinition=taskdefinition, arguments=arguments [, optional-parameters ] )
Syntax 2 (Cloud Command utility)
dbcloudcmd run CreateSchedule schedule_name taskdefinition arguments [ optional-parameters ]
Parameters
  • schedule_id

    An output parameter. Internal use only.

  • schedule_name

    The name for the schedule. (Required)

  • taskdefinition

    The task name. (Required)

  • arguments

    The parameters for the task. (Required)

  • event_type

    The type of event. The default is NULL.

  • schedule_definition

    The schedule. The default is NULL.

  • user

    The owner of the schedule. Accepts a search query that identifies one user, for example a user name or ID. The default is the current user.

Required privileges

RunScheduleTask

Remarks

This task creates a new task schedule. The schedule runs the associated task in the future: either when a cloud event occurs or according to a specified schedule.

You can create a schedule without a schedule_definition or an event_type. In this case, the schedule can only be triggered manually from the Cloud Console. This enables you to store a task batch and execute it manually when necessary.

The schedule runs every time the specified event occurs in the cloud.

  • event_type

    This parameter accepts an event type. To view a list of event types and their descriptions, run dbcloudcmd describe type:EventType from the Cloud Command utility (dbcloudcmd).

  • arguments

    This parameter accepts an XML string containing the parameter information of the task being scheduled. The XML string must be specified as follows and must include one or more of the listed XML elements:

          <args>XML-elements</args>
Arguments XML elements Description
<a name="parm1">argument-string-1</a> Parm1 is the task parameter name. Argument-string-1 is the task parameter value.
<a name="parm2" is_null="1"/> Parm2 is the task parameter name. Setting the is_null attribute to 1 indicates that the task parameter value is NULL.

The allowed value for the schedule_definition parameter is an XML string containing the schedule information. The XML string must be specified as follows and must include one or more of the listed XML elements:

<schedule>XML-elements</schedule>
Schedule XML elements Description
<time_range start_time="xx"/> Start time. (Required)
<start_date date="xx"/> Start date.
<interval frequency="xx" units="yy"/> Frequency of event. xx is an integer and yy is one of "HOURS", "MINUTES", or "SECONDS".
<days_of_week><dow day="xx"/></days_of_week> Day of the week. xx is a string as in "Sunday" or "Monday", etc.
<days_of_month><dom day="xx"/></days_of_month> Day of the month. xx is an integer between 0 and 31, with 0 being the last day of the month.

Example

Run the following task, all on one line, to create a schedule called mydatabaseschedule that runs the StopDatabase task on the database named mytenant3, every day at 4:00 PM

dbcloudcmd run CreateSchedule schedule_name=mydatabaseschedule taskdefinition=StopDatabase 
arguments="<args><a name=\"database_list\">mytenant3</a></args>" 
schedule_definition="<schedule><time_range start_time=\"16:00:00\"/> 
<interval frequency=\"24\" units=\"hours\"/></schedule>"

Example

The following schedule definition runs the associated task at 4:00 PM on the first day of each month, the fifteenth day of each month, and the last day of each month.

<schedule>
    <time_range start_time="16:00:00"/>
    <days_of_month>
        <dom day="1"/>
        <dom day="15"/>
        <dom day="0"/>
    </days_of_month>
</schedule>

Example

The following schedule definition runs the associated task at 4:00 PM on the Mondays and Fridays of each week.

<schedule>
    <time_range start_time="16:00:00"/>
    <days_of_week>
        <dow day="Monday"/>
        <dow day="Friday"/>
    </days_of_week>
</schedule>