• No results found

Integration with CA Workload Automation ESP Edition

To run the mssql_call script using CA Workload Automation ESP Edition, you define a Windows job that runs the script. The job is defined as part of an Application and runs on a Windows agent.

Note: For more information about defining Windows jobs using CA Workload Automation ESP Edition, see the CA Workload Automation Agent for UNIX, Linux, or Windows User Guide.

42 CLI User Guide

Example: Identify SQL Server Agent Job Using a Windows Job

To run a job that is already defined in SQL Server Agent, you require the job name or job ID. If you do not know the job name or job ID, you can use the GetJobList operation to help you identify the job.

This example lists the jobs defined in SQL Server Agent using a Windows job. The following CLI arguments are passed to the batch script:

Name of the operation (GetJobList) ■ Target server database (MYDATABASE)

■ User name (AUSER), password (3B38CA1614D55535), and domain (OURDOMAIN) The following job definition lists the jobs defined in SQL Server Agent using a Windows job:

NT_JOB GET_JOB_LIST AGENT WINAGENT

CMDNAME wrappers\mssql_call.bat

ARGS --operation=GetJobList --TargetDB=MYDATABASE +

--UserName=AUSER --Password=3B38CA1614D55535 --Domain=OURDOMAIN RUN DAILY

ENDJOB

After the job completes, you can retrieve the list of jobs from the spool file. You can then use the GetJobDetail operation to get details about a particular job.

The following job definition displays the details of a job named MYJOB using a Windows job:

NT_JOB GET_JOB_DETAIL AGENT WINAGENT

CMDNAME wrappers\mssql_call.bat

ARGS --operation=GetJobDetail --TargetDB=MYDATABASE +

--UserName=AUSER --Password=3B38CA1614D55535 --Domain=OURDOMAIN + --JobName=MYJOB

RUN DAILY ENDJOB

Chapter 3: Running the CLI Using Your Scheduling Manager 43

Example: Run SQL Server Agent Job Using a Windows Job

After you identify the job, you can run it immediately using the RunJob operation. This example runs a predefined job named MYJOB using a Windows job. The following CLI arguments are passed to the batch script:

■ Name of the operation (RunJob)

Name of the SQL Server Agent job (MYJOB) Target server database (MYDATABASE)

■ User name (AUSER), password (3B38CA1614D55535), and domain (OURDOMAIN)

■ Option to track the job to completion

The following job definition runs a predefined job named MYJOB using a Windows job: NT_JOB RUN_JOB

AGENT WINAGENT

CMDNAME wrappers\mssql_call.bat

ARGS --operation=RunJob --JobName=MYJOB --TargetDB=MYDATABASE + --UserName=AUSER --Password=3B38CA1614D55535 --Domain=OURDOMAIN + --Track=Y

RUN DAILY ENDJOB

When the job completes successfully, it indicates that MYJOB has completed successfully on SQL Server Agent.

44 CLI User Guide

Example: Identify the Reason a SQL Server Agent Job Failed Using a Windows Job

If the job fails during execution, you can use the GetJobHistory operation to find out the reason for the failure.

This example displays the execution log of job named MYJOB using a Windows job. The following CLI arguments are passed to the batch script:

Name of the operation (GetJobHistory) Name of the SQL Server Agent job (MYJOB) ■ Target server database (MYDATABASE)

■ User name (AUSER), password (3B38CA1614D55535), and domain (OURDOMAIN)

The time the job started running (2010-02-03 14:53:00)

You can retrieve the job's start time from the spool file of the job that failed.

The following job definition retrieves the execution log of a job named MYJOB using a Windows job:

NT_JOB GET_JOB_HISTORY AGENT WINAGENT

CMDNAME wrappers\mssql_call.bat

ARGS --operation=GetJobHistory --JobName=MYJOB + --TargetDB=MYDATABASE --UserName=AUSER +

--Password=3B38CA1614D55535 --Domain=OURDOMAIN + --StartDateTime="2010-02-03 14:53:00"

RUN DAILY ENDJOB

After the job completes, you can retrieve the execution log from the spool file. You can then use the GetStepLog operation to display the job step log.

The following job definition displays the job step log of the MYJOB job using another Windows job:

NT_JOB GET_STEP_LOG AGENT WINAGENT

CMDNAME wrappers\mssql_call.bat

ARGS --operation=GetStepLog --JobName=MYJOB + --TargetDB=MYDATABASE --UserName=AUSER + --Password=3B38CA1614D55535 --Domain=OURDOMAIN RUN DAILY

ENDJOB

Chapter 3: Running the CLI Using Your Scheduling Manager 45

Integration with CA Workload Automation CA 7 Edition

To run the mssql_call script using CA Workload Automation CA 7 Edition, you define a Windows job that runs the script. The job runs on a Windows agent.

Note: For more information about defining Windows jobs using CA Workload Automation CA 7 Edition, see the CA Integrated Agent Services User Guide.

Example: Identify SQL Server Agent Job Using a Windows Job

To run a job that is already defined in SQL Server Agent, you require the job name or job ID. If you do not know the job name or job ID, you can use the GetJobList operation to help you identify the job.

This example lists the jobs defined in SQL Server Agent using a Windows job. The following CLI arguments are passed to the batch script:

Name of the operation (GetJobList) ■ Target server database (MYDATABASE)

■ User name (AUSER), password (3B38CA1614D55535), and domain (OURDOMAIN) The following job definition lists the jobs defined in SQL Server Agent using a Windows job:

AGENT WINAGENT

CMDNAME wrappers\mssql_call.bat

ARGS --operation=GetJobList --TargetDB=MYDATABASE +

--UserName=AUSER --Password=3B38CA1614D55535 --Domain=OURDOMAIN

After the job completes, you can retrieve the list of jobs from the spool file. You can then use the GetJobDetail operation to get details about a particular job.

The following job definition displays the details of a job named MYJOB using a Windows job:

AGENT WINAGENT

CMDNAME wrappers\mssql_call.bat

ARGS --operation=GetJobDetail --TargetDB=MYDATABASE +

--UserName=AUSER --Password=3B38CA1614D55535 --Domain=OURDOMAIN + --JobName=MYJOB

46 CLI User Guide

Related documents