You are on page 1of 6

CONTENTS

DOCUMENT CONTROL................................................................................................................................. 2
CONTENTS .......................................................................................................................................................... 3
1. OVERVIEW ................................................................................................................................................ 4
2. INSTALLATION........................................................................................................................................ 4
2.1 PRE-REQUISITES ........................................................................................................................................ 4
2.2 INSTALLING THE SOFTWARE ...................................................................................................................... 4
3. STARTING THE SCHEDULER DAEMON........................................................................................ 5
3.1 COMMAND LINE ........................................................................................................................................ 5
3.2 COMMAND LINE ARGUMENTS................................................................................................................... 5
4. CONFIGURING THE SCHEDULER.................................................................................................... 6
4.1 OVERVIEW.................................................................................................................................................. 6
4.2 INITIALISATION FILES ............................................................................................................................... 6
4.2.1 Mandatory Parameters..................................................................................................................... 6
4.2.2 Optional Parameters....................................................................................................................... 6
4.2.3 Run Time Variables......................................................................................................................... 7
4.2.4 Example............................................................................................................................................. 7
4.3 CONFIGURATION FILES.............................................................................................................................. 8
4.3.1 Parameters........................................................................................................................................ 8
4.3.2 Example............................................................................................................................................. 9
5. MONITORING THE SCHEDULER.................................................................................................... 10
5.1 DISPLAYING THE JOB SCHEDULE ........................................................................................................... 10
6. STANDARD SCHEDULER CONFIGURATION ON DHU CLUSTER ................................... 12
6.1 DBBACKUP ................................................................................................................................................ 12
6.2 ARC2ADSM................................................................................................................................................ 12
6.3 COMPRESS................................................................................................................................................. 12
6.4 BCP_PRD_COPY........................................................................................................................................ 12
6.5 BCP_MAIN ................................................................................................................................................. 12

1. OVERVIEW
db_scheduler is a basic job scheduling system. It is designed to compliment rather than replace existing
scheduling tools (cron/Control-M). In particular it is designed for implementation on HA clusters where it is not
possible to use cron for basic scheduling requirements.

2. INSTALLATION
2.1 Pre-requisites
The db_scheduler software requires Perl to be installed on the server. The minimum supported version of
Perl is 5.004. The Perl installation must include the standard Perl library modules. The installation script will
check the Perl environment.

2.2 Installing the software


Initial installation and subsequent upgrades are performed from a trusted server as follows:
cd ~oracle/standard_packages/site/install
./INSTALL scheduler server
Alternatively the software is available as a tar archive on the engineering build servers:
/export/DBdatabase/DBoracle/DBglobaltools/os_type/scheduler_version.tar
UK Distributed Systems Database Group 14 November 2011 db_scheduler - Installation and User Guide
Page 5

3. STARTING THE SCHEDULER DAEMON


3.1 Command Line
The scheduler can be started as follows:
${SITE}/scripts/db_scheduler.ksh start
There is no need to run the script in the background as it automatically turns itself into a daemon process. The
scheduler should be started in this way as part of the server start up routines.

3.2 Command Line Arguments


The following command line arguments can be supplied to dbscheduler.ksh when starting the daemon:
-d Debug mode, additional diagnostic information is written to the scheduler log file.
-i interval Specifies the sleep interval for the daemon. It will wake every interval seconds to check
for configuration changes and schedule jobs. By defaut an interval of 60 seconds is assumed.
UK Distributed Systems Database Group 14 November 2011 db_scheduler - Installation and User Guide
Page 6

4. CONFIGURING THE SCHEDULER


4.1 Overview
The scheduler is configured at two levels.
At the highest level job classes are defined. A job class defines a type of job (eg backup, compress, and
arc2adsm). No database specific information is defined at this level. Each job class is defined in its own
dedicated scheduler initialisation file (See 4.2 below).
Database specific scheduling information is defined within database specific configuration files (See 4.3 below).
The paths to these files are defined in the appropriate job class initialisation file. If necessary the initialisation file
can also define the keywords to expect in the database configuration files if the default values cannot be used due
to a keyword conflict.

4.2 Initialisation Files


Initialisation files are be placed in the ${SITE}/db_scheduler directory. Each class of job to be scheduled
requires its own initialisation file. Initialisation files are identified by a .ini suffix. Any prefix can be used
though it is recommended that the prefix reflect the type of job, eg backup.ini for database backups.

4.2.1 Mandatory Parameters


The following mandatory parameters must be defined within the initialisation files:
COMMAND_LINE
The command to be run by the scheduler. This must be a fully qualified executable filename followed by any
command line arguments.
CONFIG_FILES
Specifies one or more configuration files to be used to obtain scheduling information for the job.

4.2.2 Optional Parameters


The following optional parameters may be defined within the initialisation files:
BCP_DATABASE

Determines whether the job is to be run for BCP (Standby) databases. The scheduler inspects the dbcheck
configuration files for each database to determine whether they are classed as BCP databases. Valid values are:
N The default value. Job is not to be run against BCP databases.
Y Job is only to be run against BCP databases.
BOTH Job is to be run against all databases, irrespective of their dbcheck setting.
ORACLE_SIDS
By default the job could potentially be run against ALL databases defined in the oratab (subject to
BCP_DATABASE and START_TIME). If required this parameter can be used to restrict the job to a specific
database or databases by specifying the databases(s) in a space separated list. Unix
UK Distributed Systems Database Group 14 November 2011 db_scheduler - Installation and User Guide
Page 7
wildcards are supported in the database name(s). For example to restrict a job to ASM instances only:
ORACLE_SIDS = +ASM?
Alternatively a list of databases to be excluded from scheduling can be specified by prefixing the list with a !, eg
ORACLE_SIDS = ! +ASM?
START_TIME
START_FILE
START_FILE_OWNERS
LATE_TIME
LATE_SEV
RESCHEDULE
STOP_TIME
STOP_SEV
SUPPORT_GROUP
These allow the default scheduling keywords in the individual configuration files to be changed to avoid
keyword clashes with other jobs.

4.2.3 Run Time Variables


Run time variables can be specified within the initialisation file. The following variables are supported:
SITE
The ${SITE} directory.
ORACLE_SID
The database SID.
ORA_ADMIN
The standard admin directory for the database.
Variables are defined within <>, eg <SITE>.

4.2.4 Example
The following is the contents of a typical initialisation file:
COMMAND_LINE = <SITE>/scripts/dbbackup_v2.ksh <ORACLE_SID> \
>/dev/null
CONFIG_FILES = <SITE>/dbbackup/dbbackup.config \
<SITE>/dbbackup/dbbackup_<ORACLE_SID>.config

UK Distributed Systems Database Group 14 November 2011 db_scheduler - Installation and User Guide
Page 8

4.3 Configuration Files


The configuration files referenced by the CONFIG_FILES parameter in the Initialisation File(s) (See 4.2.1
above) are used to define the scheduling information at a database specific level.

4.3.1 Parameters
START_TIME
Specifies the times that the job is to be scheduled. One or more space separated time definitions can be specified.
Each time definition is of the form hours:minutes.
hours can be an asterix or HH (meaning every hour) or a list of comma separated hour (0-23) elements, or a
range of hours separated by a minus. A step value can also be specified, eg */2 means every 2 hours.
minutes can be an asterix or MM (meaning every minute) or a list of comma separated minute (0-59)
elements, or a range of minutes separated by a minus. A step value can also be specified, eg */5 means every 5
minutes
Both the hours and minutes values can be further qualified via a step value.
For example, all of the following are valid:
START_TIME = 12:30 16:30

START_TIME = *:00 # Hourly


START_TIME = HH:00,15,30,45 # Every 15 minutes
START_TIME = *:*/15 # Every 15 minutes
START_TIME = 01-05/2,07-19,21-23/2:30
START_FILE
Specifies an (optional) file dependency. A job whose START_TIME has been passed but whose START_FILE
dependency has not been met will be marked as "Waiting" in scheduler reports. The START_FILE dependency
is regarded as being met when the specified file exists and has a last modification time greater than the last time
the dependency was met (if applicable). Ie if a job is rescheduled then the dependency will not be met again until
the trigger files mtime is updated.
START_FILE_OWNERS
If specified then any START_FILE dependency will be regarded as being met only if the file is owned by one
of the specified owners. Value is a space separated list of Unix usernames.
LATE_TIME
Specifies a time when a "Waiting" job (ie one whose START_FILE dependancy has not been met) becomes a
"Late" job. LATE_TIMEs are only supported if a single START_TIME is defined.
LATE_SEV
Specifies the severity of any alerts to be raised when a job becomes "Late".
RESCHEDULE
Specifies that once scheduled and completed the job is too be immediately rescheduled. Typically used in
conjunction with START_FILE to have a job continuously scheduled awaiting a file trigger.
UK Distributed Systems Database Group 14 November 2011 db_scheduler - Installation and User Guide
Page 9
STOP_TIME
Specifies a time when a "Waiting" or "Late" job is to be removed from the schedule. Such jobs will be marked as
"Missed" in scheduler reports. STOP_TIMEs are only supported if a single START_TIME is defined. . At the
current release of db_scheduler jobs will automatically be removed from the schedule at midnight no
alerts will be raised for this condition.
STOP_SEV
Specifies the severity of alerts to be raised when a job is removed from the schedule due to its STOP_TIME
being exceeded
SUPPORT_GROUP
Support group to receive alerts for this job.

4.3.2 Example
The following is the contents of a typical initialisation file:
START_TIME = 18:00
START_FILE = /tmp/ok_to_run
START_FILE_OWNERS = root oracle
LATE_TIME = 20:00
LATE_SEV = MAJOR
STOP_TIME = 22:00
STOP_SEV = CRITICAL
SUPPORT_GROUP = Oracle_CI

UK Distributed Systems Database Group 14 November 2011 db_scheduler - Installation and User Guide
Page 10

5. MONITORING THE SCHEDULER


5.1 Checking the status of the db_scheduler daemon
The current status of the daemon can be displayed with the status option to db_scheduler.ksh:
${SITE}/scripts/db_scheduler.ksh status
2011/11/14_12:18:26 db_scheduler is active with PID 1389
As well as displaying the status the script exits 0 if the daemon is active and 1 if inactive.

5.1.1 db_scheduler_check.ksh
This script will check the status of the scheduler daemon and attempt to restart it if it is down. Can be scheduled
periodically by cron, for example, to ensure db_scheduler availability.

5.1.2 oem_db_scheduler_check.ksh
This script can be called as an OEM UDM (User Defined Metric) Command Line to enable db_scheduler
monitoring from within OEM. Standard output from the script is as follws:
If daemon is active:

em_result=0
em_message=dbScheduler is up.

If daemon is inactive:

em_result=1
em_message=dbScheduler is down.

5.2 Displaying the job schedule


The current day's schedule can be displayed with the schedule option to db_scheduler.ksh:
${SITE}/scripts/db_scheduler.ksh schedule
*************************************************** 2011/11/14_12:00:46
db_sceduler.ksh V1.23
***********************************************************************
Schedule For: 20040920
---------------------Sched Start Database Job End Res
----- ----- -------- ---------------------------------------- ----- --00:00 03:19 PMODEV01 db_ora_control.ksh bounce PMODEV01 03:20 0
00:00 03:20 PMODEV01 db_ora_control.ksh bounce PMODEV01 <Waiting>
00:30 00:30 DBPRSP arc2adsm.ksh DBPRSP 00:31 0
01:00 01:00 GPCUAT2 dbbackup_v2.ksh GPCUAT2 01:00 51

For jobs that have passed their scheduled start time the job status is displayed. Status can be one of the following:
hh:mm n Job completed at hh:mm with a response code of n.
UK Distributed Systems Database Group 14 November 2011 db_scheduler - Installation and User Guide
Page 11
<Running> Job is still running.
<Waiting> Job is waiting for its START_FILE dependancy to be met.
<Late> Job is waiting and has passed it's LATE_TIME.
<Missed> Job has been removed from schedule as it's STOP_TIME was passed.
<Unknown> Job has completed but did not report back to the scheduler with it's status.
In addition you can display schedule data for a different date:
${SITE}/scripts/db_scheduler.ksh schedule yyyymmdd
Or for a specific database:
${SITE}/scripts/db_scheduler.ksh schedule ${ORACLE_SID}

UK Distributed Systems Database Group 14 November 2011 db_scheduler - Installation and User Guide
Page 12

6. STANDARD SCHEDULER CONFIGURATION ON DHU


CLUSTER
6.1 dbbackup

/applications/oracle/admin/site/db_scheduler/dbbackup.ini
COMMAND_LINE = <SITE>/scripts/dbbackup_v2.ksh <ORACLE_SID> >/dev/null
CONFIG_FILES = <SITE>/dbbackup/dbbackup.config \
<SITE>/dbbackup/dbbackup_<ORACLE_SID>.config

6.2 arc2adsm

/applications/oracle/admin/site/db_scheduler/arc2adsm.ini
COMMAND_LINE = <SITE>/scripts/arc2adsm.ksh <ORACLE_SID> >/dev/null
CONFIG_FILES = <SITE>/dbbackup/dbbackup.config \
<SITE>/dbbackup/dbbackup_<ORACLE_SID>.config
START_TIME = ARC2ADSM_START_TIME

6.3 compress

/applications/oracle/admin/site/db_scheduler/compress.ini
COMMAND_LINE = <SITE>/scripts/compress_archlogs.ksh <ORACLE_SID>
>/dev/null
CONFIG_FILES = <SITE>/dbbackup/dbbackup.config \
<SITE>/dbbackup/dbbackup_<ORACLE_SID>.config
START_TIME = COMPRESS_START_TIME

6.4 bcp_prd_copy

/applications/oracle/admin/site/db_scheduler/bcp_prd_copy.ini
COMMAND_LINE = <SITE>/scripts/bcp_prd_copy_new.ksh <ORACLE_SID>
>/tmp/bcp_prd_copy_<ORACLE_SID>.out 2>&1
CONFIG_FILES = <ORA_ADMIN>/config/db_scheduler.config
START_TIME = BCP_PRD_COPY_START_TIME

6.5 bcp_main

/applications/oracle/admin/site/db_scheduler/bcp_main.ini
BCP_DATABASE = Y
COMMAND_LINE = <SITE>/scripts/bcp_bkp_main_new.ksh <ORACLE_SID>
>/tmp/bcp_bkp_main_<ORACLE_SID>.out 2>&

You might also like