Getting started with the Job Manager
This section covers the basics of using the Job Manager, including how to open the Job Manager, add a database connection, create a new job, add a script to a job, and run a job without scheduling.
To open the Job Manager in the browser, log in to the Data Studio web console, then click on Job Manager under the Open menu of the web console or click on the Manage database jobs link on the Task Launcher page.
Opening the Job Manager from the Open menu
Figure 2. Opening the Job Manager from the Task Launcher
The Job List tab displays all the enabled and disabled jobs. You can add, edit, delete and run jobs manually from this page. The Schedules tab allows you add, edit, and delete schedules on jobs. The Notifications tab allows you to add, edit, and delete notifications on jobs. The History tab shows the status of the jobs that ran. The job history displays jobs that ran according to a schedule, in addition to jobs that you ran manually. The History tab shows the overview status such as the Start Time, End Time, Status, and the Database Name.
Figure 3. The Job Manager user interface
Before running or scheduling a job, you must specify which databases to run the job against. To add a database in the web console:
- In the Getting Started section of the Task Launcher, click Add database connections.
- From the Open menu, click Databases to bring up
the Databases page, then click Add.
Figure 4. Adding a new database connection from the Databases page
- In the Add Database Connections form, enter the database
connection information. The credentials you specify will be used
to connect to the remote database host via SSH, and to execute the
script associated with the job.
Figure 5. Specifying the database connection properties
Note that once you add a database in the Databases page, the web console automatically enables health monitoring for that database. To learn more about health monitoring, see the developerWorks article titled "Monitor DB2 for Linux, UNIX, and Windows databases with Data Studio Health Monitor."
To create a new job:
- Open the Job Manager in the web console.
- From the Job List tab, click Add Job and enter
the basic properties of the new job.
- Name: A descriptive name for the job. The name does not have to be unique. The Job Manager will automatically generate a Job ID as a unique identifier.
- Type: Valid job types are SQL-only script, DB2 CLP script, or Executable/Shell script. The job type determines how the Job Manager connects to the associated database to run the script.
- Enabled for scheduling: Select this option box to enable the job for scheduling. If this option is not selected, you cannot schedule the job but you can still manually run the job from the Job List tab.
- Description: An optional short description of the job.
Figure 5a. Adding a new job entry from the Job Manager
Figure 5b. Entering basic job properties
- Click OK to create a new job entry.
- To define job components, such as schedules, scripts, and notifications, click on the job entry in the job list grid, and then click on the corresponding section under the Job Component bar.
The script is the executable part of a job and defines the actions to be performed against the database server when the job is run. Each script consists of one or more statements that are executed in order.
The Job Manager does not verify that the scripts you enter are valid. Before you schedule the job in the job manager, you should test the script against a database, by using the Run Job button, or use other methods to verify that the script is correct and that it produces the expected results.
To add a script to a job:
- From the Job List tab, select the job you want to add a script to and click Edit.
- In the Job Components menu, click Script.
- In the text field, enter or paste the script to run against the
database server when you run the job. For this tutorial, you can
use the following sample SQL-only script to create a new table and
immediately drop the table.
create table employee(c1 int, c2 int); drop table employee;
- Click Save All to save your changes to the job.
Figure 6. Adding a script to a job
You do not have to add a schedule for a job to run it. You can run your jobs directly from the job list tab to verify that they work correctly before you schedule them.
To run a job directly:
- From the Job List tab, select the job you want to run and click
Figure 7. Running a job from the job list tab
- Select one or more databases on which to run the job. If you
select to run the job on a single database, you can use the
default user ID associated with that database connection or
specify an alternative user credential to run the job against the
selected database. If you select to run the job on multiple
databases, the job is run against each database using the user ID
that is defined in the database connection for that database.
Figure 8. Selecting the databases on which to run the job
- Click OK to run the job on the selected databases.
- Optionally, you can open the History tab to see the job status details and the log file for the job.