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 Jan 25, 2007 | 02:51 PM
  #1  
DJ Dunk's Avatar
DJ Dunk
Thread Starter
Moderator
20 Year Member
iTrader: (5)
 
Joined: Nov 2001
Posts: 17,864
Likes: 0
From: Not all those who wander are lost
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 ?
Reply
Old Jan 25, 2007 | 03:05 PM
  #2  
cottonfoo's Avatar
cottonfoo
Scooby Regular
 
Joined: Jan 2001
Posts: 469
Likes: 0
From: still behind twin turbos
Default

Are the sqlldr rules the same for each cloned table?
Reply
Old Jan 25, 2007 | 03:06 PM
  #3  
DJ Dunk's Avatar
DJ Dunk
Thread Starter
Moderator
20 Year Member
iTrader: (5)
 
Joined: Nov 2001
Posts: 17,864
Likes: 0
From: Not all those who wander are lost
Default

Yes they are.
Reply
Old Jan 25, 2007 | 03:08 PM
  #4  
cottonfoo's Avatar
cottonfoo
Scooby Regular
 
Joined: Jan 2001
Posts: 469
Likes: 0
From: still behind twin turbos
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.
Reply
Old Jan 25, 2007 | 03:11 PM
  #5  
DJ Dunk's Avatar
DJ Dunk
Thread Starter
Moderator
20 Year Member
iTrader: (5)
 
Joined: Nov 2001
Posts: 17,864
Likes: 0
From: Not all those who wander are lost
Default

Sorry, you've lost me. Can you explain further ?
Reply
Old Jan 25, 2007 | 03:15 PM
  #6  
cottonfoo's Avatar
cottonfoo
Scooby Regular
 
Joined: Jan 2001
Posts: 469
Likes: 0
From: still behind twin turbos
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.
Reply
Old Jan 25, 2007 | 03:23 PM
  #7  
DJ Dunk's Avatar
DJ Dunk
Thread Starter
Moderator
20 Year Member
iTrader: (5)
 
Joined: Nov 2001
Posts: 17,864
Likes: 0
From: Not all those who wander are lost
Default

Still

I have 450 tables and 450 different files to load, each into a specific one of the 450 tables.
Reply
Old Jan 25, 2007 | 03:27 PM
  #8  
cottonfoo's Avatar
cottonfoo
Scooby Regular
 
Joined: Jan 2001
Posts: 469
Likes: 0
From: still behind twin turbos
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?
Reply
Old Jan 25, 2007 | 03:38 PM
  #9  
DJ Dunk's Avatar
DJ Dunk
Thread Starter
Moderator
20 Year Member
iTrader: (5)
 
Joined: Nov 2001
Posts: 17,864
Likes: 0
From: Not all those who wander are lost
Default

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

In your shell script just set a $TABLE (or whatever) variable, and use that env var in your .ctl files.
Reply
Old Jan 25, 2007 | 04:02 PM
  #11  
DJ Dunk's Avatar
DJ Dunk
Thread Starter
Moderator
20 Year Member
iTrader: (5)
 
Joined: Nov 2001
Posts: 17,864
Likes: 0
From: Not all those who wander are lost
Default

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




All times are GMT +1. The time now is 02:04 AM.