Page 1 of 1

insert/update with no key

Posted: Tue Nov 21, 2017 12:20 pm
by dnat
Hi,

I have to load a oracle table from a file. There are no keys in the table. In this situation what would be the best approach to load the table with restartability in place..If the job aborts in the middle with some rows inserted, how do i make sure that the same records dont insert into the table again..

I have a log table which has a ID associated with every file. So, I have this ID inserted into the table to identify which file these records are from

These are the options i could think of.
1.Have all the fields has keys and do upsert..But there are so many fields with null values..
2. Use the option of delete then insert(delete all records with the ID field from log table)
3. Have a high commit count..

Anyone faced this issue and what could be the ideal method.

Posted: Tue Nov 21, 2017 12:56 pm
by chulett
What kind of transactional volume are we talking about here?

Posted: Tue Nov 21, 2017 1:44 pm
by FranklinE
For secure and reliable restartability, full (bulk) load is the first choice. Doesn't matter what DBMS you are using, or the structure of the table.

For example:

Job 1 -- bulk unload for backup/restore if "new" data cannot be fully loaded.

Job 2 -- merge unloaded data with "new" data, doing any updates as delete/inserts on file instead of to table.

Job 3 -- bulk load of merged data.

We use this method for VSAM file updates. For your requirements, it looks like a good choice.

Posted: Tue Nov 21, 2017 4:24 pm
by ray.wurlod
Can you perform a DIFFERENCE against your log table as the source for the load?

Posted: Wed Nov 22, 2017 9:25 am
by chulett
Still a wee bit curious how much data we're talking about here, both already in the target and what shows up in your average load...