• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Shell script to run sqlldr

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

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.
 
Saloon Keeper
Posts: 24501
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic