Saturday, August 31, 2013

What is Autosys

Hi,

This post gives you very brief introduction about Autosys. I will post some more details about Autosys in upcoming posts.

What is Autosys??
Autosys is an automated job control system for scheduling, monitoring, and reporting. This is developed by Unicenter.

A job is any single command, executable, script. Each job definition contains a variety of qualifying attributes, including the conditions specifying when and where a job should be run.

Autosys uses JIL (Job Information Language) as its own language. We can use this through a command -line interface. JIL is a specification language, with its own syntax, that is used to describe when, where,and how a job should run. When you enter the jil command, you get the jil command prompt, at which you can enter the job definitions one line at a time using this special language. When you exit the jil command -line interface, the job definition is loaded into the database. Alternatively, you can enter the definition as a text file and redirect the file to the jil command. In this case, the jil command activates the language processor, interprets the information in the text file, and loads this information in the database.

Sample from unix command prompt how to use this.

echo "insert_job:      xyz
      job_type:        c
      condition:       s(xyz)
      date_conditions: y
      command:         dbconnect.ksh (you can give any script name)
      machine:         machine name on which it needs to be run" | jil

Once done the XYZ job is getting added in Autosys. You can check it the same by using the below command on unix prompt.

$autorep -J XYZ

Make sure to run all this Autosys needs to be install first on your machine

Thanks

Shell Script to execute query by connecting Database

Hi All,

This post will give some idea about how to connect Database using shell script.

I am considering here an Oracle DB since it is used most widely in the industry. Along with Oracle, SQLPLUS is installed on your system. While connecting Oracle DB as a remote machine, please make sure you have SQLPLUS installed on your machine (i.e. from where you are connecting the DB or running this script).

You can simply test whether the SQLPLUS is installed on your machine as below.

$ sqlplus
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Sep 1 07:30:12 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter user-name:

If it is already installed then it will prompt username as above else will give you an error. Once you confirmed please try the below script (i.e. this is a sample query to show how to connect DB and execute the query)

#!/bin/ksh

#FileName: dbconnect.ksh

SQL="set feedback off underline off pages 0 lines 999 heading off
           select sysdate from dual;"

echo -e "$SQL"| sqlplus -s userid/password@TNSNAME

I have store the above script with name as dbconnect.ksh, here userid is the userid for your schema and password is the password used for the given userid. TNSNAME is nothing but the connection string you used to connect the DB.

Store the script and check if any syntx error using below command on command prompt

$ /bin/ksh -n dbconnect.ksh

Once having no error, please execute the below script by changing its permission
$chmod 775 dbconnect.ksh
$ /bin/ksh dbconnect.ksh

01-SEP-13


You can see the output as current date.

This is one of the way to execute the query, there are others ways to to connect the Database.
I hope this post is useful to you.

Thanks