I'm looking to write a shell script to run sqlldr command to insert bulk data and this sqlldr will be called through a cron job. My question here is, first how to write a shell that connects to the database, reads the file and inserts the records? The following is what I have,
Oracle 11g database
the file is a .ctl file and a .csv data file
I have to run this command from the location where my app server is installed and my db server is a different machine. I have oracle client installed on my app server.
sqlldr will handle the database reads and writes. Just set up a simple shell script to do what you'd do if you were running sqlldr manually. If you want to put the sqlldr directives inline in the script, you can use the "here" feature:
The "<<" starts off the "here" data stream and indicates that a line with the value of "EOF" marks the end of the data. You'll have to supply your own sqlldr options - I'm afraid that since nobody wants to pay me to do Oracle these days, I don't recall the details and I'm too lazy to RTFM.
Customer surveys are for companies who didn't pay proper attention to begin with.