Home » RDBMS Server » Server Utilities » Data Loading into a table with Identity type column(Sequence generator used) Direct path
Data Loading into a table with Identity type column(Sequence generator used) Direct path [message #166471] Thu, 06 April 2006 08:46 Go to next message
nimi_patels
Messages: 6
Registered: April 2006
Location: NY
Junior Member
I am trying to implement a Direct Path SQL Loader to load a '|' seperated .txt file into a table in which the primary key is populated thru a sequence generator. I understand that the sequence gen is not supported by Direct Path. Is there a solution/alternative to this? I want to use Direct and not conventional as the volumne is LARGE. The target table will be empty when I load.

The load works great if I did it the conventional way - FYI

Any suggestions to optimize and boost the load performance are welcome.

Here's the contents of control file
LOAD DATA
INFILE 'c:\extract.txt'
BADFILE 'c:\extract.bad'
DISCARDFILE 'c:\extract.dsc'
APPEND
INTO TABLE PA0101.ALERT_MESSAGE
FIELDS TERMINATED BY "|"
TRAILING NULLCOLS
(
SRC_SYS_CD CONSTANT 'NB',
MKTR_NO CHAR,
GO_CD CHAR,
ALERT_DT INTEGER EXTERNAL,
ALERT_TYPE_CD CONSTANT "NB",
READ_IR CONSTANT "N",
POL_NO CHAR NULLIF POL_NO=BLANKS,
INSD_NM CHAR NULLIF INSD_NM=BLANKS,
CASE_STATUS_TX CHAR NULLIF CASE_STATUS_TX=BLANKS,
SYSTEM_TIMESTAMP INTEGER EXTERNAL,
PRIORITY_CD CONSTANT 1,
CATGY_CD CHAR NULLIF CATGY_CD=BLANKS,
ALERT_SUBJECT_TX CHAR(256) NULLIF ALERT_SUBJECT_TX=BLANKS,
PLAN_TYPE CHAR(32) NULLIF PLAN_TYPE=BLANKS,
ALERT_DETAIL_TX CHAR(155000) NULLIF ALERT_DETAIL_TX=BLANKS,
SEQUENCE_NO "PA0101.S_ALERT_MESSAGE.nextval"

)

Below is the SQL LDR load statement:
sqlldr pa01011/alerts_load@ORAM11.WORLD control=C:\extract.ctl DIRECT=true log=c:\extract.log errors=5000

Attached is the .txt data file.

Thank You all.
  • Attachment: extract.txt
    (Size: 4.24KB, Downloaded 1401 times)
Re: Data Loading into a table with Identity type column(Sequence generator used) Direct path [message #166472 is a reply to message #166471] Thu, 06 April 2006 08:52 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Did you also try the SEQUENCE option with sqlldr?

http://www.orafaq.com/forum/t/50054/0/

Regards
Re: Data Loading into a table with Identity type column(Sequence generator used) Direct path [message #166476 is a reply to message #166472] Thu, 06 April 2006 09:30 Go to previous messageGo to next message
nimi_patels
Messages: 6
Registered: April 2006
Location: NY
Junior Member
Thanks

but when I tried SEQUENCE, it worked the first time. I deleted those records from my loaded table and tried again - I got these errors in my log. Any clue?? Never got them before.

SQL*Loader-951: Error calling once/load initialization
ORA-00604: error occurred at recursive SQL level 1
ORA-00054: resource busy and acquire with NOWAIT specified
Re: Data Loading into a table with Identity type column(Sequence generator used) Direct path [message #166478 is a reply to message #166476] Thu, 06 April 2006 09:39 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
>> ORA-00054: resource busy and acquire with NOWAIT specified
The rows are locked ( kind of)
Seems, you opened a parallel session and delete the records.
But not yet committed.
Commit the other session. try sqlldr again.
Re: Data Loading into a table with Identity type column(Sequence generator used) Direct path [message #166480 is a reply to message #166478] Thu, 06 April 2006 10:01 Go to previous messageGo to next message
nimi_patels
Messages: 6
Registered: April 2006
Location: NY
Junior Member
Thanks. That was it. I had parallel sessions active.

Something is wrong though. The records get loaded twice(I see double entries in the table for each row in the .txt). Also the sequence is not generated as a running serial number. The numbers in this case were 321384, 90, 92, 93, 94, 95. Its not in any particular pattern either.
Re: Data Loading into a table with Identity type column(Sequence generator used) Direct path [message #166482 is a reply to message #166480] Thu, 06 April 2006 10:03 Go to previous messageGo to next message
nimi_patels
Messages: 6
Registered: April 2006
Location: NY
Junior Member
And also, like one of the other user in this forum - I figured the time taken by the Direct Load is in fact more than Conventional Load time which defeats the whole purpose of opting for the Direct approach.

Well - we'll get to that later. I had thoughts to use the 'CACHE' clause to the sequence generator in future, but I am not sure if I can do it now since I am using SEQUENCE in my control file itself.
Re: Data Loading into a table with Identity type column(Sequence generator used) Direct path [message #166486 is a reply to message #166482] Thu, 06 April 2006 10:33 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
SEQUENCE option within sqlldr has its price and is documented in docsets.

One workaround is to load the data as-is and then add a sequence number;
Even with a database sequence, Oracle never guarantees that the generated values are sequential.
Maybe unique (within the sequnce and unless they cycle) , but never sequential,

http://www.orafaq.com/forum/m/122997/42800/?srch=sequence+no+cache#msg_122997
Re: Data Loading into a table with Identity type column(Sequence generator used) Direct path [message #166491 is a reply to message #166486] Thu, 06 April 2006 11:02 Go to previous messageGo to next message
nimi_patels
Messages: 6
Registered: April 2006
Location: NY
Junior Member
Thansk a bunch!! I'm getting there

Also, I could not find much on the net regarding the limitations/overhead of using the SEQUENCE option. I'd appreciate if you can send me links to docs if you know of any.

Have a good one.
Re: Data Loading into a table with Identity type column(Sequence generator used) Direct path [message #166493 is a reply to message #166491] Thu, 06 April 2006 11:25 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Utilities manual.

http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/toc.htm
Re: Data Loading into a table with Identity type column(Sequence generator used) Direct path [message #166697 is a reply to message #166493] Fri, 07 April 2006 12:33 Go to previous messageGo to next message
nimi_patels
Messages: 6
Registered: April 2006
Location: NY
Junior Member
Hi
Quick Question.

I read in a few reference links that during a direct path load, some integrity constraints are automatically disabled. Others are not. Should I need to manually disable any before direct load?? Currently I am manually disabling the constraints but I'm wondering if there is any option/clause that I can use to avaoid this manual step.
Re: Data Loading into a table with Identity type column(Sequence generator used) Direct path [message #166700 is a reply to message #166697] Fri, 07 April 2006 12:50 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/ch09.htm#1008082

The above URL takes you to the documentation which lists the constraints that are enabled and disabled. Whatever is disabled by SQLLDR will be enabled at the end of load. If you manually disabled a few of constraints, you have to enable it again.

Previous Topic: Issues with SQL loader Control file
Next Topic: SQL*Loader-941
Goto Forum:
  


Current Time: Thu Jul 04 19:41:24 CDT 2024