Blog
DB2utor

Categories

March 25, 2008

With Admin Task Scheduler, the Key Word is Resilient

When working on DB2 LUW, have you ever used the task scheduler to schedule utility work like runstats or image copies? If so, consider yourself special. Most z/OS DBAs probably haven't used this feature, and even if they had, they'd be restricted from using it in the tightly controlled production environment on the z/OS platform. However, in a test environment the task scheduler is handy because most z/OS shops don't use the production scheduler for development systems.

The administrative task scheduler delivered with DB2 V9 (it's also available via APAR with DB2 V8) runs tasks that are defined in a task list. A set of administrative stored procedures are available to maintain the schedule. The ADMIN_TASK_ADD stored procedure can be used to insert a task that's either a stored procedure or JCL batch job. These tasks can be scheduled to run based on an interval, a point in time or an event. What makes this a resilient task scheduler is that these tasks are simultaneously stored in DB2 and a separate VSAM file. When DB2 is down, the task scheduler stays up and can continue to process tasks that don't require DB2 resources. Any schedule changes made while DB2 is down are stored in the VSAM file and automatically synchronized when DB2 comes back up.

Some administrative user-defined functions have been delivered to help you monitor the task list. The ADMIN_TASK_LIST function returns a list of tasks that are scheduled for execution. Example: Here's how to retrieve the task list in SQL:

  select * from table (DSNADM.ADMIN_TASK_LIST()) as T;

The ADMIN_TASK_STATUS function allows you to review the status of the most recent execution. To remove a task from the schedule, use the ADMIN_TASK_REMOVE function.

As noted, a fix (APAR PK47893) became available to make this feature available to DB2 V8. It also provides an improved interface.

References
The DB2 Administration Guide has more information and more examples on the use and administration of the task scheduler. The interesting thing is that this didn't show up in the documentation until October 2007. So if you haven't done so, you'll want to download the latest manuals.

The recently published Redbook, "IBM DB2 9 for z/OS: New Tools for Query Optimization," also has more information about the Administrative Task Scheduler.

The administrative scheduler is another address space that comes up with DB2. For example, my DB2 subsystem is DB9G and the tasks that I see in SDSF are DB9GDBM1, DB9GIRLM, DB9GMSTR, DB9GDIST and DB9GADMT. If DB2 goes down, DB9GADMT stays active. To bring the scheduler address space down or back up, issue the operator console command /STOP DB9GADMT (or /START DB9GADMT in my case). A list of all the available commands can be found in the DB2 Version 9.1 for z/OS Command Reference Guide. (Hint: Search on "admtproc" to find the available commands.)

Since this is so new, it would be nice to hear from others who've used this feature. Tell us what types of tasks and or procedures you're scheduling and if you're using this in production.