MySQL Job Scheduling



Similar documents
JobScheduler Installation by Copying

How To Use The Jobscheduler On A Linux Box (Jid) On A Pcode (Jio) Or Macbook 2.2 On A Microsoft Powerbook 2 (For A Freebie

JobScheduler Web Services Executing JobScheduler commands

JobScheduler - Quickstart

JobScheduler Security

CrontabFile Converter

JobScheduler and Script Languages

JobScheduler Events Definition and Processing

JobScheduler - Amazon AMI Installation

Migration from Control-M to JobScheduler in a TWS Landscape. SOS Software GmbH Berlin, Germany

JobScheduler - Installation Guide

Project management integrated into Outlook

ODBC Client Driver Help Kepware, Inc.

Project management integrated into Outlook

JOB SCHEDULER. Managed Jobs. Technical Documentation March Job Automation

McAfee Network Threat Response (NTR) 4.0

ORACLE GOLDENGATE BIG DATA ADAPTER FOR HIVE

LICENSE4J AUTO LICENSE GENERATION AND ACTIVATION SERVER USER GUIDE

CA Workload Automation Agent for Remote Execution

Novell Identity Manager Driver for Remedy Action Request System (ARS)

Crystal Reports Integration Plugin for JIRA

Table of Contents. Introduction: 2. Settings: 6. Archive 9. Search Browse Schedule Archiving: 18

UQC103S1 UFCE Systems Development. uqc103s/ufce PHP-mySQL 1

Project management integrated into Outlook

ServerView Inventory Manager

Specops Command. Installation Guide

Novell Identity Manager

Microsoft SQL Server Connector for Apache Hadoop Version 1.0. User Guide

Cabot Consulting Oracle Solutions. The Benefits of this Approach. Infrastructure Requirements

Database Management Reference

Forms Printer User Guide

How To Back Up Your Pplsk Data On A Pc Or Mac Or Mac With A Backup Utility (For A Premium) On A Computer Or Mac (For Free) On Your Pc Or Ipad Or Mac On A Mac Or Pc Or

Webapps Vulnerability Report

TimesTen Auditing Using ttaudit.java

Installation Instructions

CA Workload Automation Agent for Microsoft SQL Server

KonyOne Server Installer - Linux Release Notes

RTI Database Integration Service. Getting Started Guide

A Brief Introduction to MySQL

Plug-In for Informatica Guide

Company Profile. Areas of Competence. Software- und Organisations-Service. Committed to Service. Software- und Organisations-Service GmbH

Password Management Guide

Installation and Testing of NMM (Windows)

Open Source Job Scheduler

Installation Guide. Version 1.5. May 2015 Edition ICS Learning Group

IronKey Enterprise File Audit Admin Guide

SIEBEL ANALYTICS SCHEDULER GUIDE

Coveo Platform 7.0. Oracle Knowledge Connector Guide

Oracle WebLogic Server

TIBCO ActiveMatrix BusinessWorks Plug-in for Big Data User s Guide

CA ARCserve Backup for Windows

Mailsteward Pro Table of Contents

SendMIME Pro Installation & Users Guide

**Web mail users: Web mail provides you with the ability to access your via a browser using a "Hotmail-like" or "Outlook 2003 like" interface.

The MariaDB Audit Plugin

SAM Server Utility User s Guide

Connectivity Pack for Microsoft Guide

Accounting Manager. User Guide A31003-P1030-U

Introduction. There are several bits of information that must be moved:

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved.

Auditing manual. Archive Manager. Publication Date: November, 2015

XMailer Reference Guide

Exporting Addresses. for Use in Outlook Express

SQL Server Automated Administration

MySQL for Beginners Ed 3

HYPERION DATA RELATIONSHIP MANAGEMENT RELEASE BATCH CLIENT USER S GUIDE

THUM - Temperature Humidity USB Monitor

Service Level Agreement Guide. Operations Center 5.0

Application Note - JDSU PathTrak Video Monitoring System Data Backup and Restore Process

CA Nimsoft Monitor. Probe Guide for Microsoft Exchange Server Response Monitoring. ews_response v1.1 series

StreamServe Persuasion SP5 Control Center

Informatica Corporation Proactive Monitoring for PowerCenter Operations Version 3.0 Release Notes May 2014

Oracle Database 10g Express

SETTING UP AND RUNNING A WEB SITE ON YOUR LENOVO STORAGE DEVICE WORKING WITH WEB SERVER TOOLS

PAINLESS MULTI-DBMS STRATEGY For Magic Developers

Data Domain Profiling and Data Masking for Hadoop

DiskPulse DISK CHANGE MONITOR

CA Workload Automation Agent for Databases

Fritz Speed Documentation

OpenLane 5.3 supports a distributed architecture with either an Oracle 8i SQL database or a Sybase database. Refer to: Oracle Integration on page 2.

Multimedia im Netz Online Multimedia Winter semester 2015/16

Predictive Analytics Client

Bandwidth Monitor for IIS 6

How to Schedule Report Execution and Mailing

Product Training Services. Training Options and Procedures for JobScheduler and YADE

NetWrix SQL Server Change Reporter. Quick Start Guide

Using the SQL TAS v4

Installation Guide. . All right reserved. For more information about Specops Deploy and other Specops products, visit

DataLogger Kepware, Inc.

Capturing & Processing Incoming s

JAMF Software Server Installation Guide for Linux. Version 8.6

IceWarp to IceWarp Server Migration

versasrs HelpDesk quality of service

EventTracker: Configuring DLA Extension for AWStats Report AWStats Reports

Alert Logic Log Manager

Integrating VoltDB with Hadoop

Manual. Visendo 10. Manual. Achieve more with less

Backup and Restore MySQL Databases

Unity Error Message: Your voic box is almost full

windream Failover Cluster Installation

Transcription:

JobScheduler - Job Execution and Scheduling System MySQL Job Scheduling MySQL automation March 2015 March 2015 MySQL Job Scheduling page: 1

MySQL Job Scheduling - Contact Information Contact Information Software- und Organisations-Service GmbH Giesebrechtstr. 15 D-10629 Berlin Germany Telephone +49 (0)30 86 47 90-0 Telefax +49 (0)30 8 61 33 35 Mail info@sos-berlin.com Web http://www.sos-berlin.com Last Updated: 03/13/2015 12:04 PM This documentation is based on JobScheduler Version 1.7.4169. Copyright 2005-2015 SOS GmbH Berlin. All rights reserved. All trademarks or registered trademarks are the property of their respective holders. All information and materials in this book are provided "as is" and without warranty of any kind. All information in this document is subject to change without further notice. This product includes software developed by the Apache Software Foundation (http://apache.org/) We would appreciate any feedback you have, or suggestions for changes and improvements; please forward your comments to info@sos-berlin.com. March 2015 MySQL Job Scheduling page: 2

MySQL Job Scheduling - Table of Contents Table of Contents 1 Introduction.................................................................................................. 4 2 Installation................................................................................................... 5 2.1 JobScheduler............................................................................................. 5 2.2 MySQL Procedures....................................................................................... 5 2.3 MySQL UDF for UDP Datagrammes.......................................................................5 2.4 Configuration of User permissions......................................................................... 6 3 The SQL Interface............................................................................................7 3.1 JOB_SUBMIT.............................................................................................7 3.2 JOB_RUN................................................................................................ 8 3.3 JOB_DELETE............................................................................................ 8 3.4 JOB_SET_SCHEMA...................................................................................... 8 3.5 JOB_SET_ACTION....................................................................................... 8 3.6 JOB_SET_TITLE......................................................................................... 9 3.7 JOB_SET_PRIORITY..................................................................................... 9 3.8 JOB_SET_SUSPENDED..................................................................................9 3.9 JOB_SET_NEXT_START................................................................................ 10 4 The SQL Interface for Database Reports................................................................... 11 4.1 REPORT_JOB_SUBMIT................................................................................. 11 4.2 REPORT_JOB_SET_MAILTO............................................................................11 4.3 REPORT_JOB_SET_MAILCC........................................................................... 11 4.4 REPORT_JOB_SET_MAILBCC..........................................................................12 4.5 REPORT_JOB_SET_ASBODY.......................................................................... 12 4.6 REPORT_JOB_SET_BODY............................................................................. 12 4.7 REPORT_JOB_SET_SUBJECT......................................................................... 12 4.8 REPORT_JOB_SET_STYLESHEET..................................................................... 13 4.9 REPORT_JOB_SET_PATH.............................................................................. 13 4.10 REPORT_JOB_SET_FILENAME....................................................................... 13 4.11 SEND_MAIL............................................................................................13 March 2015 MySQL Job Scheduling page: 3

MySQL Job Scheduling - Introduction 1 Introduction The dbms_scheduler or dbms_job packages are used to execute database statements at specific times under Oracle. Such components are not included in any of the MySQL distributions. The Managed User Jobs package has been written to fulfill this need, and offers an SQL interface for the definition of jobs similar to the Oracle dbms_scheduler interface. The Managed User Jobs package allows users to plan the execution of jobs within their allowed user permissions using an external JobScheduler. In addition Managed User Jobs offers the possibility of informing registered recipients per E-mail about the success or failure of statement execution. Use of the Managed User Jobs requires that the following conditions are fulfilled: A MySQL 5 database A database user with super user permissions Installation of the udf_sos_send_udp shared object (or dll on Windows) for the MySQL Server Installation of the JobScheduler with database access for the user mentioned above The MySQL Maintenance Jobs Package The Scheduler must be configured so that the JobSchedulerManagedUserJob is started every minute. The database user requires further permissions in order to be able to set up his own jobs. See Installation. March 2015 MySQL Job Scheduling page: 4

MySQL Job Scheduling - Installation 2 Installation A MySQL database (at best Version 5+) is required before the JobScheduler is installed. Installation and update instructions together with the installation files are to be found on the official MySQL web site. The server version must be installed. 2.1 JobScheduler The JobScheduler may be installed on a different computer to the database. Before installation of the JobScheduler it is recommended that the necessary database user(s) and schema are created. This is described in detail in the MySQL documentation. It is recommended that the JobScheduler is installed using its own installation program. During installation of the Scheduler it is necessary that the "Database Support" and "MySQL Maintenance Jobs" packages are activated by clicking the appropriate check boxes. The JobScheduler will create the necessary database tables for itself and the Managed User Jobs if required. This option may, however, be deactiviert and the tables manually created later. 2.2 MySQL Procedures MySQL procedures must be manually installed after the installation of the JobScheduler. The script for this can be found in the <scheduler_procedures_directory>/db/mysql/procedures directory. The procedure for running this script is as follows: make a connection with the MySQL server using a MySQL client as Scheduler user; select the JobScheduler database schema (e.g. use scheduler ) change the delimiters to other characters: delimiter // read in the following procedure: source <path>/scheduler_job_procedure.sql reset the delimiter using: delimiter ; 2.3 MySQL UDF for UDP Datagrammes A user defined function for sending UDP commands is provided in the directory <scheduler_installationsverzeichnis >/lib/. This function need not be installed unless the JOB_RUN procedure is to be used. Linux : the path in which the udf_sos_send_udp.so file is to be found must be added to the LD_LIBRARY_PATH variable in the MySQL server start script, e.g.: export LD_LIBRARY_PATH=/pfad/pfad:$LD_LIBRARY_PATH; The MySQL server must now be restarted. After restarting, the presence of the function will be disclosed to the MySQL server with create function sos_send_udp returns string soname 'udf_sos_send_udp.so'; Windows : The udf_sos_send_udp.dll file must be copied into the the bin directory of the MySQL server. The MySQL server must then be restarted. After restarting, the MySQL server will disclose the presence of the function with create function sos_send_udp returns string soname 'udf_sos_send_udp.dll'; March 2015 MySQL Job Scheduling page: 5

MySQL Job Scheduling - Installation 2.4 Configuration of User permissions The JobScheduler executes planned database statements. To do this it creates new users during run time. In order to be able to do this, it is necessary that the JobScheduler posesses super user administrative permissions: grant all on *.* to <scheduler_user>@<scheduler_host> identified by <scheduler_password> with grant option grant all on mysql.* to <scheduler_user>@<scheduler_host> identified by < scheduler_password> with grant option Every normal database user who is to be allowed to set up his own jobs requires access permissions for the tables used by these jobs, as well as the right to carry out the Scheduler users procedures: grant execute on scheduler.* to <user_name>@<user_host> This allows the user to set up his own jobs and only be able to modify his own jobs. This last statement does not apply to MySQL from Version 4.1 up to (but not including) Version 5 as there are no procedures. Instead the user must be allowed access to the scheduler_managed_user_jobs table: grant all on scheduler.scheduler_managed_user_jobs to <user_name>@<user_host> Naturally this sets the basic security concept described above out of action. March 2015 MySQL Job Scheduling page: 6

MySQL Job Scheduling - The SQL Interface 3 The SQL Interface The job administration functions (similarly to Oracle) directly through a SQL interface. The procedures documented here are to be found in the Scheduler user's schema. In order to use these procedures it is necessary that the appropriate schema is selected (e.g. use scheduler ) or that a qualified procedure call is made (e.g. call scheduler.job_submit(...) ). In order to be able to identify the result of a procedure call, all procedures have a common first parameter included in the output string. This parameter can then be later used to locate procedure output. call scheduler.job_set_schema(@result, 1, 'test'); SELECT @result; Should it be necessary to call several API procedures when processing a job, then it is recommended that these are carried out in one transaction. Otherwise it is possible that a job is run before all parameters have been completely specified. 3.1 JOB_SUBMIT OUT job_id INT IN job_action TEXT IN job_start_time DATETIME IN job_next_start TEXT IN job_schema VARCHAR(250) JOB_SUBMIT creates a new job. This job is identified by the returned job_id which, in turn, is used by other procedures as an IN parameter. The SQL command to be carried out is to be found in job_action. It is possible to give a number of SQL commands together, which must, however, be seperated by semicolons (see JOB_SET_ACTION ). The starting time for the first start of a job is given using job_start_time. If the value of this parameter is null, then the job will be started as soon as possible (but after the first commit). The method by which the next start time for the job is calculated is given by job_next_start. This start time is calculated after the original job has run. Should this parameter be null, then the job will only run once. See also JOB_SET_NEXT_START. The data bank schema to be used is specified using job_schema. This parameter may not have the value null and the user must possess the appropriate permissions for the schema. Example: Setting up a Job call scheduler.job_submit(@result, @jobid, 'UPDATE persondata SET age=age+1;', null, 'ADDTIME(NOW(), ''1:0:0'')', 'test'); The '1:0:0' String (one hour) must be in double inverted commas, as it lies in another string. March 2015 MySQL Job Scheduling page: 7

MySQL Job Scheduling - The SQL Interface 3.2 JOB_RUN IN job_start_time DATETIME Either gives a job new start time immediately, or starts the job immediately should job_start_time be null. Thereby a command is given to the JobScheduler per UDP. For this to work, it is necesary that the User Defined Function is installed. This command should not be used together with other commands within a transaction but singly - for example to start a job for test purposes. Example: Start Job 25 Immediately call scheduler.job_run(@result, 25, null); 3.3 JOB_DELETE Deletes the Specified Job. Example: Delete Job 20 call scheduler.job_delete(@result, 20); 3.4 JOB_SET_SCHEMA IN job_schema VARCHAR(250) Sets the database schema in which a job is to be run. Example: Set Schema for Job 19 to 'test'. call scheduler.job_set_schema(@result, 19, 'test'); 3.5 JOB_SET_ACTION March 2015 MySQL Job Scheduling page: 8

MySQL Job Scheduling - The SQL Interface IN job_action TEXT Sets the commands to be carried out for a job. Any number of commands seperated by semi-colons can be specified. Example: Multiple Commands for a Job call scheduler.job_set_action(@result, 19, 'UPDATE persondata SET age=age+1; UPDATE persondata SET weight=weight-1;'); 3.6 JOB_SET_TITLE IN job_title VARCHAR(250) Specify the Job Title. Example: Specify Title call scheduler.job_set_title(@result, 15, 'Testjob'); 3.7 JOB_SET_PRIORITY IN job_priority INT Specifies the priority of a job. Should insufficient tasks be available to carry out all jobs together, then jobs with a higher priority will carried out first. The default priority value is 1. Example: Set the Priority of Job 13 to 5 call scheduler.job_set_priority(@result, 13, 5); 3.8 JOB_SET_SUSPENDED IN job_suspended BOOL Activates (job_suspended = false) or deactivates (job_suspended = true) a Job. March 2015 MySQL Job Scheduling page: 9

MySQL Job Scheduling - The SQL Interface Example: Deactivate Job 16 call scheduler.job_set_suspended(@result, 16, true); 3.9 JOB_SET_NEXT_START IN job_next_start TEXT Sets the rules by which the next start time for a job is calculated. This must be an SQL expression which returns an ISO date. The expression is always evaluated after a job has been completed. Example: Start Job 10 Every Day at the Same Time (every 24h) After the End of the First Run call scheduler.job_set_next_start(@result, 10, 'ADDDATE(NOW(), 1)'); Example: Start Job 10 Once Every Hour call scheduler.job_set_next_start(@result, 10, 'ADDDATE(NOW(), ''01:00:00'')'); Example: Start Job 10 every 5 Minutes call scheduler.job_set_next_start(@result, 10, 'ADDTIME(NOW(), ''0:5:0'')'); Example: Start Job 10 Every Hour, On the Hour call scheduler.job_set_next_start(@result, 10, 'ADDDATE(CURRENT_DATE(), INTERVAL EXTRACT(HOUR FROM CURRENT_TIME())+1 HOUR)'); Example: Start Job 10 to the Ultimo of Every Month at 18:00 call scheduler.job_set_next_start(@result, 10, 'adddate(last_day(current_date()), interval 18 hour)'); Example: Start Job 10 every Day at 5:00 call scheduler.job_set_next_start(@result, 10, 'IF(HOUR(NOW())>=5, ADDDATE(CURRENT_DATE(), INTERVAL 24+5 HOUR), ADDDATE(CURRENT_DATE(), INTERVAL 5 HOUR));'); March 2015 MySQL Job Scheduling page: 10

MySQL Job Scheduling - The SQL Interface for Database Reports 4 The SQL Interface for Database Reports After the Managed Jobs packet has been installed, the following additional database report jobs can be created. These jobs function similarly to normal database jobs. After the selection statements are completed, a report containing the result of the last select statement is sent by e-mail. This process is described in more detail in the Managed Jobs documentation. The SQL interface described above is valid for the report jobs, together with the following functions: 4.1 REPORT_JOB_SUBMIT OUT job_id INT IN job_action TEXT IN job_start_time DATETIME IN job_next_start TEXT IN job_schema VARCHAR(250) IN report_recipient VARCHAR(250) REPORT_JOB_SUBMIT creates a new report job similar to JOB_SUBMIT. The report_recipient parameter is, however, new and specifies the e-mail address of the report recipient. Example: Creation of a Report Job call scheduler.report_job_submit(@result, @jobid, 'SELECT * FROM persondata;', null, 'ADDTIME(NOW(), ''1:0:0'')', 'test','info@sos-berlin.com'); 4.2 REPORT_JOB_SET_MAILTO IN report_recipient VARCHAR(250) Specifies the e-mail address of the report recipient. Example: Set the report address von job 30 to 'info@sos-berlin.com'. call scheduler.report_job_set_mailto(@result, 30, 'info@sos-berlin.com'); 4.3 REPORT_JOB_SET_MAILCC March 2015 MySQL Job Scheduling page: 11

MySQL Job Scheduling - The SQL Interface for Database Reports IN report_recipient VARCHAR(250) Specifies the e-mail address of the report cc recipient. 4.4 REPORT_JOB_SET_MAILBCC IN report_recipient VARCHAR(250) Specifies the e-mail address of the report bcc recipient. 4.5 REPORT_JOB_SET_ASBODY IN asbody BOOL If asbody is true(1), then the report will be sent as the e-mail body and not as an attachment. 4.6 REPORT_JOB_SET_BODY IN body TEXT The body parameter specifies the report e-mail body, when asbody is not set to true. 4.7 REPORT_JOB_SET_SUBJECT March 2015 MySQL Job Scheduling page: 12

MySQL Job Scheduling - The SQL Interface for Database Reports IN subject VARCHAR(250) The subject parameter specifies the report e-mail subject. 4.8 REPORT_JOB_SET_STYLESHEET IN stylesheet VARCHAR(250) The stylesheet parameter specifies the stylesheet to be used in the transformation of the report. 4.9 REPORT_JOB_SET_PATH IN path VARCHAR(250) If a path is specified here, then the report is not only sent by e-mail but also saved in the specified directory. 4.10 REPORT_JOB_SET_FILENAME IN filename VARCHAR(250) The filename parameter specifies the file name mask for the report file. 4.11 SEND_MAIL IN mailto VARCHAR(250) IN subject VARCHAR(250) IN body TEXT March 2015 MySQL Job Scheduling page: 13

MySQL Job Scheduling - The SQL Interface for Database Reports This function sends an e-mail with the subject subject to the mailto recipient. The e-mail text is specified with body. HTML can also be used here. March 2015 MySQL Job Scheduling page: 14