Wednesday, October 24, 2007

HOW TO RUN A SQL PLUS SCRIPT FROM A CRON JOB

PURPOSE:
========
HOW TO RUN A SQL PLUS SCRIPT FROM A CRON JOB.

SCOPE & APPLICATION:
=====================
This article is intended for an audience having knowledge about unix and sql.

EXPLANATION:
============
Cron is a mechanism for planning and scheduling batch jobs. The daemon "crond" is started automatically on system boot up. It runs one check per minute to see if there are any jobs to execute. The list of jobs to execute is created by the program "crontab".

Entering the command "crontab -l" will display a list of current entries. By default, only entries owned by the logged in user will be displayed.
Existing lists can be removed/deleted with command "crontab -r".

To create a new list, it is recommended to read the entries from a file using the command

"crontab filename".

To run a sql script, create a file (for ex: script1.ksh) containing the sql commands. Now use the following crontab entry.

#The following entry will execute the script 1.ksh every hour.
0 12 * * * $ORACLE_BASE/admin/scripts/snap.ksh

This entry consists of six parameters. The first five parameters define the time schedule, whereas the sixth parameter contains the command for executing the job.
This command consists of:

- the full path and file name of the script - an argument

Parameters defining the time schedule are:

minute(0-59)
hour(0-23)
day of month(1- 31)
month(1-12)
day of week(0-6) 0 = Sun

Hence, the above sample entry: 0 12 * * * can be translated as:

If Minute = 0 and Hour = 12, the script will be executed.

Because the last three scheduling parms are defined by the wildcard character
"*", the job will be executed every day.

REFERENCES:
===========
For further explanations under Unix enter the following commands:

man crontab
man 5 crontab
man cron

29 comments:

  1. Can anyone recommend the robust Remote Management tool for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: [url=http://www.n-able.com] N-able N-central software monitoring
    [/url] ? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!

    ReplyDelete
  2. Hi there! Do you know if they make any plugins to safeguard against hackers?
    I'm kinda paranoid about losing everything I've worked
    hard on. Any tips?

    Here is my page: planet fitness gym
    Also see my web site > fitness quest ab lounge 2 Abdominal exerciser

    ReplyDelete
  3. whoah this weblog is magnificent i like reading your articles.
    Stay up the great work! You recognize, lots of individuals are hunting around for this information, you can help
    them greatly.

    my web site: exercises to improve vertical

    ReplyDelete
  4. Ahaa, its pleasant discussion concerning this article at this place at this blog, I have read
    all that, so at this time me also commenting here.

    my web page ... workouts to improve vertical jump

    ReplyDelete
  5. Just desire to say your article is as amazing. The clarity
    for your publish is just great and that i can assume you are an expert on this subject.
    Fine with your permission allow me to snatch your feed to stay up to date with coming near near post.
    Thanks a million and please carry on the enjoyable work.

    Visit my webpage: designer kleidung billig

    ReplyDelete
  6. I loved as much as you'll receive carried out right here. The sketch is attractive, your authored subject matter stylish. nonetheless, you command get bought an shakiness over that you wish be delivering the following. unwell unquestionably come further formerly again as exactly the same nearly very often inside case you shield this increase.

    my web site ... best Affiliate networks

    ReplyDelete
  7. Way cool! Some very valid points! I appreciate you
    penning this write-up plus the rest of the website is also really
    good.

    my web site - private consolidation student loans

    ReplyDelete
  8. Great article.

    Feel free to visit my page; find a home loan with bad credit

    ReplyDelete
  9. Way cool! Some very valid points! I appreciate you writing this write-up plus the rest of the website is extremely
    good.

    Also visit my homepage - marken mode billig

    ReplyDelete
  10. I do not even know how I ended up here, but I thought this
    post was great. I do not know who you are but definitely you're going to a famous blogger if you aren't already ;) Cheers!


    Feel free to surf to my weblog 100 ltv home equity loan

    ReplyDelete
  11. I visited multiple sites except the audio feature for audio songs
    current at this site is truly marvelous.

    My homepage: http://www.breakthroughthemovie.com/community/members/mollypark/activity/82654

    ReplyDelete
  12. I could not reѕist commenting. Verу wеll written!


    Hеre is my wеb blog: bad credit long term loans

    ReplyDelete
  13. I ωill immеdiately clutch your rss as
    I cаn nоt іn finԁing yоur еmaіl subѕcгiptіоn link oг newslеtter sегvісе.
    Dο you've any? Kindly permit me recognise so that I may subscribe. Thanks.

    Also visit my site; long term loans for people with poor credit

    ReplyDelete
  14. Whoa! This blog looks exactly like my old one! It's on a totally different topic but it has pretty much the same layout and design. Superb choice of colors!

    Here is my web blog ... waist to hip ratio

    ReplyDelete
  15. I sеriοusly love your ωebsitе.
    . Great сolours & theme. Did уou create this web ѕitе yourѕelf?
    Plеase reply back as I'm attempting to create my own website and would like to learn where you got this from or what the theme is called. Many thanks!

    Visit my site http://dl.free.fr

    ReplyDelete
  16. hello!,Ι гeally like your writing sο
    so much! Cаn we κeep in touch more regarding your
    аrticle οn digg? I requіre аn expert оn this spacе
    tо unravеl my prοblem. Mаybe that's you! Taking a look ahead to look you.

    Have a look at my blog post - columbo.in

    ReplyDelete
  17. If you wish for to grow your know-how simply keep visiting this site and be updated with the most recent information posted here.


    Feel free to surf to my weblog Adorna Breast Enhancement Supplement

    ReplyDelete
  18. Thanks for sharing such a fastidious opinion, article is good, thats why i have
    read it completely

    my web-site workouts to increase vertical

    ReplyDelete
  19. Hello to all, since I am really keen of reading this blog's post to be updated regularly. It carries pleasant information.

    Take a look at my page ... canfriends.com

    ReplyDelete
  20. Hello colleagues, how is everything, and what you wish for to say about this paragraph, in my view its
    in fact awesome for me.

    Also visit my web blog ... vertical leap exercises

    ReplyDelete
  21. If you are going for finest contents like me, just
    visit this site every day because it offers quality contents, thanks

    my site; workouts to increase vertical Jump

    ReplyDelete
  22. Why visitors still make use of to read news papers when in this
    technological world all is accessible on web?


    Check out my website; Www.mypatroncard.com

    ReplyDelete
  23. Hello friends, its fantastic paragraph about educationand entirely explained, keep
    it up all the time.

    My web page :: http://articleinternet.info/Several-Good-Suggestions-For-Improving-Your-Vertical-Jump.htm

    ReplyDelete
  24. My partner and I stumbled over here by a different web address and thought I
    might check things out. I like what I see so i am just following
    you. Look forward to finding out about your web page
    again.

    My website workouts to improve vertical

    ReplyDelete
  25. Hello! I just wanted to ask if you ever have any
    problems with hackers? My last blog (wordpress) was hacked and I
    ended up losing several weeks of hard work due to no back up.

    Do you have any methods to prevent hackers?


    my web page; exercises for vertical

    ReplyDelete
  26. Thanks for sharing your thoughts on first health of the carolinas
    hospitals. Regards

    Also visit my web page; exercises for vertical jump

    ReplyDelete