This is actually our project requirement. I described here it as a small assignment, but actually we have about 150 procedures and some of them can be run parallally and some of them have dependency. Our objective is to write a shell script to schedule this task. I have no idea about how to start with and request your ideas/suggestions.
What a complicated request! You are trying to code a work flow system in a shell script.
If you're new to UNIX, you will certainly have trouble wrapping your arms around someone else's scripts.
Conceptually, here is what you want to do:
Your first goal is to build the framework for interacting with Oracle. I find that communicating to Oracle with a sqlplus coprocess to be very easy to control your various interactions.
Then you send messages to the coprocess.
Then you can read back Oracle's responses simillarly as follows:
This works for PL/SQL code wrappers, dynamic SQL, etc. In fact, the only thing that isn't so great is if you have 1000s of lines of results and you want to process them with the while read command.
The next thing that you need is a mechanism to drive your execution priorities. This can be done with one or more tables and defining some basic rules. The simplest will be the processing order.
You'll also want to identify the don't care procedures that can run in the background. This is more tricky but can be done fairly easy. I did this for my current project where I need to bulk load data using sqlldr and where I can't use direct path loads (this works at blazingly fast speeds; my tests showed nearly one million records per minute in one test case). I split the task into five threads and each thread loads a different portion of the file. You can sychronize information by wrapping the command in a pair of braces which causes the code to execute in a subshell. The direct the output to a common file for analyzing the results.
Your serially executed procedures/tasks run in the coprocessor and your "don't care procedures" can be run in their own sqlplus sessions independent of the coprocessor.
Coprocess exacmple:
Background example:
If you really want to monitor status of the background procedures, use the facilities with Oracle for long oeprations and then use your coprocessor to periodically query the information. Or you can use your own table, whatever you want but the Oracle longops facility is designed for this simple kind of job communication.
This can also serve as a mechanism for synchronizing your background tasks.
This is a very simplistic description for solving your very complex requirement but I use this kind of technique now with great success.
Hi everyone,
I am trying to automate one process on Solaris OS.
This is what happens at the moment.
Every night at 19:30 and every hour after that we run a script that checks the status of databases. That script runs and prints if db's are OK at the end it states how many were down.
I am... (3 Replies)
Hi,
I have a ksh scrip (x) that scans a directory and does actions when a file arrives in this directory.
My question is what is the best way to schedule x?
1. Use cron tab and create a task running forever
2. Creat another ksh script (y) that runs (x) in a non-terminating loop
Which... (2 Replies)
Hi,
Before I start, I would like to inform that, I went through all FAQs and other threads before posting here.
I 'm trying to schedule a shell script on cygwin using cron. No matter what I do I don't seem to get the cron job executing my bash script.
My script is temp.sh
echo `date` >... (4 Replies)
Hi,
I have a shell script Scp_1.sh for which I have to pass 2 arguments to run.
I have another script Scp_2.sh which in turns calls script Scp_1.sh inside.
How do I make Scp_1.sh script to read arguments automatically from a file, while running Scp_2.sh?
--
Weblogic Support (4 Replies)
Hi,
How can we run/schedule a shell script. Since there is no access to cron at this point of time we have to think other way out to run a script every hour.
How can we achieve this. Need advice.
How about using sleep,autosys etc...the script should trigger off every hour...which sends... (3 Replies)
Hi,
I need to schedule a script in crontab which should run at 01:00 am in the morning and should run for every 15 days in a month.
How to schedule this by using crontab?
Many thanks.
Rgds, (13 Replies)
All,
Running the below script independently is working fine with no issue but once I am scheduling it in cron on my Linux environment it is not working.
Can anyone look into this and let me know what I have to modify here to schedule it properly.
09 03 * * 4 ksh 'cd... (1 Reply)
Hi,
I have developed a file deletion script and scheduled it in cronjob to run daily at 5:00 AM. But the script is not running automatically any day. However when I run the script manually at any time, it runs successfully. This is how the cron looks like :
0 5 * * *... (5 Replies)
Hi,
I have my script in below path in UNIX
/storage/sas_source/SDTM-Development/FileWatcher/filewatcher.sh
I want to schedule it to run every 30 secs.
Please let me know the steps to do it.
Thanks. (7 Replies)