Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

SQL*Loader CTL File Creation Automation ?

Thread Tools
 
Search this Thread
 
Old 25 January 2007, 02:51 PM
  #1  
DJ Dunk
Moderator
Support Scoobynet!
Thread Starter
iTrader: (5)
 
DJ Dunk's Avatar
 
Join Date: Nov 2001
Location: Not all those who wander are lost
Posts: 17,863
Received 0 Likes on 0 Posts
Default SQL*Loader CTL File Creation Automation ?

I have a large number of data dumps that need to be loaded into tables easily using SQL*Loader.

There are 9 different table structures which are cloned about 50 times, so 450 tables to load into.

I have a CTL file for each of the 9 different structures, each tailored for their own columns. I will have 450 data files that need loading into these tables.

If I have a list of the tables and a list of the data files. How can I quickly create the required CTL files ? I need 450 CTL files with the input file and table name within it (I could put the input file in the command line, so at a minimum I need the table name in there). Or can I put the target table in the command line too ?

I intend to write a shell script to run the 450 sqlldr commands when they're all done.

Any ideas on how best to do this ?
Old 25 January 2007, 03:05 PM
  #2  
cottonfoo
Scooby Regular
 
cottonfoo's Avatar
 
Join Date: Jan 2001
Location: still behind twin turbos
Posts: 469
Likes: 0
Received 0 Likes on 0 Posts
Default

Are the sqlldr rules the same for each cloned table?
Old 25 January 2007, 03:06 PM
  #3  
DJ Dunk
Moderator
Support Scoobynet!
Thread Starter
iTrader: (5)
 
DJ Dunk's Avatar
 
Join Date: Nov 2001
Location: Not all those who wander are lost
Posts: 17,863
Received 0 Likes on 0 Posts
Default

Yes they are.
Old 25 January 2007, 03:08 PM
  #4  
cottonfoo
Scooby Regular
 
cottonfoo's Avatar
 
Join Date: Jan 2001
Location: still behind twin turbos
Posts: 469
Likes: 0
Received 0 Likes on 0 Posts
Default

You just need a couple of loops. An outer loop to read in each .ctl file per table, then another loop to loop over each cloned table and run sqlldr against that.
Old 25 January 2007, 03:11 PM
  #5  
DJ Dunk
Moderator
Support Scoobynet!
Thread Starter
iTrader: (5)
 
DJ Dunk's Avatar
 
Join Date: Nov 2001
Location: Not all those who wander are lost
Posts: 17,863
Received 0 Likes on 0 Posts
Default

Sorry, you've lost me. Can you explain further ?
Old 25 January 2007, 03:15 PM
  #6  
cottonfoo
Scooby Regular
 
cottonfoo's Avatar
 
Join Date: Jan 2001
Location: still behind twin turbos
Posts: 469
Likes: 0
Received 0 Likes on 0 Posts
Default

Assuming you can pass the table name:

Code:
for each .ctl file you have         ## this is the outer loop
  for each cloned table               ## this is the inner one
    call the current .ctl file against that table
  end loop
end loop
Let's try this edit.
Old 25 January 2007, 03:23 PM
  #7  
DJ Dunk
Moderator
Support Scoobynet!
Thread Starter
iTrader: (5)
 
DJ Dunk's Avatar
 
Join Date: Nov 2001
Location: Not all those who wander are lost
Posts: 17,863
Received 0 Likes on 0 Posts
Default

Still

I have 450 tables and 450 different files to load, each into a specific one of the 450 tables.
Old 25 January 2007, 03:27 PM
  #8  
cottonfoo
Scooby Regular
 
cottonfoo's Avatar
 
Join Date: Jan 2001
Location: still behind twin turbos
Posts: 469
Likes: 0
Received 0 Likes on 0 Posts
Default

Maybe I misunderstood. If the .ctl files are the same for each cloned table (the 50 clones of each of the 9 tables) then you only need one .ctl file for each table type, you just need to specify each cloned table to the .ctl, no?
Old 25 January 2007, 03:38 PM
  #9  
DJ Dunk
Moderator
Support Scoobynet!
Thread Starter
iTrader: (5)
 
DJ Dunk's Avatar
 
Join Date: Nov 2001
Location: Not all those who wander are lost
Posts: 17,863
Received 0 Likes on 0 Posts
Default

Correct. How do I specify which table to load into ? I thought that had to be within the CTL file ?
Old 25 January 2007, 03:40 PM
  #10  
cottonfoo
Scooby Regular
 
cottonfoo's Avatar
 
Join Date: Jan 2001
Location: still behind twin turbos
Posts: 469
Likes: 0
Received 0 Likes on 0 Posts
Default

In your shell script just set a $TABLE (or whatever) variable, and use that env var in your .ctl files.
Old 25 January 2007, 04:02 PM
  #11  
DJ Dunk
Moderator
Support Scoobynet!
Thread Starter
iTrader: (5)
 
DJ Dunk's Avatar
 
Join Date: Nov 2001
Location: Not all those who wander are lost
Posts: 17,863
Received 0 Likes on 0 Posts
Default

Gotcha I'll try it out, thanks.
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Nick_Cat
Computer & Technology Related
2
26 September 2015 08:00 AM
Littleted
Computer & Technology Related
4
25 September 2015 09:55 PM
Littleted
Computer & Technology Related
0
25 September 2015 08:44 AM
mazbow
ScoobyNet General
2
15 September 2015 06:58 PM
riiidaa
ScoobyNet General
1
12 September 2015 11:52 AM



Quick Reply: SQL*Loader CTL File Creation Automation ?



All times are GMT +1. The time now is 10:28 PM.