Direct read / load


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Direct read / load
# 1  
Old 08-05-2014
Direct read / load

Guys,

I wrote a script to do the following -
  1. Read a file that is placed into a directory and depending upon the contents, load into one or multiple tables into Oracle.
  2. After the file is loaded into the table, depending upon the exit status of the process I will either delete the file or mark the record entry for that file as incomplete record in the table.

Initially, I was told that there would only be few files in a 15 minute time span and I cron-ed this script to run for every 5 mins and it was fast enough to load it in few minutes. Now, they are sending huge files and on couple occasions, the script ran longer than 10 minutes.

Now, Im running into an issue that I cant seem to grapple with on multiple levels.
  1. First, how do I find which records ran and which one did not ?
  2. How do I identify as to which records got completed and which are pending and which one did not even process ?
  3. how do I implement some checks and balances so that whatever is placed in the directory is loaded into the table.

I am sure a great many of you might have ran into this and want to learn as to what could be the best practice here. I am thinking of implementing a thread based approach but I never wrote thread programming in POSIX.

Please advise

Last edited by rbatte1; 08-05-2014 at 07:23 AM.. Reason: Spelling and converting to numbered LIST tags
# 2  
Old 08-05-2014
I presume that you loading script has something like:-
Code:
for file in *
do
   sqlload connection $file to table options
done

If you have your data that is to be loaded in a directory /data then when you script runs, it could:-
  1. List (and remember) the files it is going to work with
  2. Move all those files into a sub-directory /data/loading
  3. Process the files listed above now in /data/loading moving them to /data/loaded or wherever afterwards.
In this way, you can have the script running multiple times but they will load separate data files. Of course, you still have to consider:-
  • What if there is a duplicate file name?
  • What if there is a duplicate target table name?
  • What to do with failures? (i.e. file remains in /data/loading)
You could also just slow dow the frequency of your cron job I suppose......


I hope that this logic might help.
Robin
# 3  
Old 08-06-2014
rbatte1, thanks a bunch for taking time and writing back to me on this. Let me try my way around this here...
# 4  
Old 08-06-2014
Let us know how you get on or if I have just caused more confusion.

All questions welcome and someone here should be able to help.



Regards,
Robin
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Creating script to read many files and load into database via single control file

Hi, I have many files but with only 2 names , I want to load the data of that file into database through sqlldr with single control file. how can i do that ????? Example: switch_file switch_file billing_file billing_file now these files should be loaded into same database but different... (1 Reply)
Discussion started by: niti_sharma
1 Replies

2. UNIX for Beginners Questions & Answers

Direct Printing In AIX

Hello. I recently upgraded to a new Power 8 server and running AIX 7.1. I migrated from an IBM P520 and AIX 5.5. My application on the P520 works best if I direct print, it doesn't work well with spooling. My IBM rep set up the new Power 8 server with spooling which is causing an issue.... (4 Replies)
Discussion started by: ldavis1080
4 Replies

3. UNIX for Dummies Questions & Answers

VPS has load 200, httpd load no activity, netstat nothing

Hello, on my hostserver i see one VPS of mine got load of 200.00 and netstat nothing (not a single blank line on netstat command) after some time, netstat started showing connections, but i see no excessive IP connections. tail -f /var/log/httpd/access_log shows no activity /var/log/messages ;... (1 Reply)
Discussion started by: postcd
1 Replies

4. Shell Programming and Scripting

Manipulating sed Direct Input to Direct Output

Hi guys, been scratching round the forums and my mountain of resources. Maybe I havn't read deep enough My question is not how sed edits a stream and outputs it to a file, rather something like this below: I have a .txt with some text in it :rolleyes: abc:123:xyz 123:abc:987... (7 Replies)
Discussion started by: the0nion
7 Replies

5. Shell Programming and Scripting

How to read file and load data into a script as variable

I need to read a text file that contain columns of data, i need to read 1st column as a function to call, and others are the data i need to get into a ksh script. I am quite new to ksh scripting, i am not very sure how to read each row line by line and the data in each columns of that line, set... (3 Replies)
Discussion started by: gavin_L
3 Replies

6. Shell Programming and Scripting

Connect:Direct

Hello all, I have a requirement to transfer files to mainframe usinf NDM connect:direct. So can anybody provide me a sample shell script on how to call a connect;direct script by providing filename as a parameter please? Thanks, Ajay (0 Replies)
Discussion started by: ajaykumar4534
0 Replies

7. Shell Programming and Scripting

shell script to read data from text file and to load it into a table in TOAD

Hi....can you guys help me out in this script?? Below is a portion text file and it contains these: GEF001 000093625 MKL002510 000001 000000 000000 000000 000000 000000 000001 GEF001 000093625 MKL003604 000001 000000 000000 000000 000000 000000 000001 GEF001 000093625 MKL005675 000001... (1 Reply)
Discussion started by: pallavishetty
1 Replies

8. Shell Programming and Scripting

Need help in wrting Load Script for a Load-Resume type of load.

hi all need your help. I am wrting a script that will load data into the table. then on another load will append the data into the existing table. Regards Ankit (1 Reply)
Discussion started by: ankitgupta
1 Replies

9. Shell Programming and Scripting

How to read a dynamically changing file and load into Oracle?

I have a tab delimited file which has 27 character fields. The file needs to be loaded into an Oracle table. But the challenge is that everytime the file comes it may or may not have values in all 27 fields. Column Definition of the 27 fields: TYPE: Char (1) NAME: Char (30) CUSTOM_VAL: Char... (8 Replies)
Discussion started by: madhunk
8 Replies
Login or Register to Ask a Question