Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SCRIPT TO EXECUTE SQLLOADER

Status
Not open for further replies.

Gius

MIS
Sep 20, 2001
12
IT
I have installed Oracle 8i on HP_UX 11.00. I am trying to write a unix script to check if some files have arrived and then load them into the database.
I would like this script to act like a daemon,in other words it has to run in background waiting for the files. Any suggestion???

Thank you

Gius
 
You can use crontab to execute it, say, every 5 minutes, and then check for new files every execution of it.
 

I made a script that checks the existence of source files and then calls another script that performs loading via sqlldr. Such script is included in our crontab list scheduled to run on a specified time and interval.
 
Thank you very much,
You are using the same approach. I was wondering if it is possible to make a script that is always running.
Excuse me rcurva, what interval do you use?

Thnx


 

Since we know when these source files are coming down, we schedule the loading script to run a few minutes after the last file came down. In our site, we schedule it twice a day.

It really depends on your requirements, but a more specific time is more efficient than to run on a frequent interval in terms of CPU utilization.


So, a better understanding of your operations will give you a clue.
 

But if, you insist on a daemon type of process. You can make a script that is running on the background that sleeps whenever your condition is not met.

For example:

if [ -f $FILEDIR/yourfile.dat ]; then
-- your process
else
sleep $interval
fi


Put this inside a loop that terminates when a certain control file, for example, is set to TERMINATE:Y.
 
Alternatively, would it be possible to have whatever process delivers the files also kick off your script to run SQL*Loader? This way you avoid the overhead of polling and constantly running daemons.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top