Primary Key

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
vcannadevula
Charter Member
Charter Member
Posts: 143
Joined: Thu Nov 04, 2004 6:53 am

Primary Key

Post by vcannadevula »

Hi All,

I have 2 jobs developed in Parallel Extender that are loading data into same table.In both the jobs I am using surrogate key generator to create id. I ran both the jobs with out specifying start value. So it took default value and now I see 2 records with each ID in the database , I didn't get any errors or warnings while running the job. Now when I am trying to delete the records from table it says

ORA-01502: index 'WIDS.XPKCLG_TYP' or partition of such index is in unusable state

I am unable to do anything with the table.It is giving me the same error for everything.
I would like to know if parallel Extender disables the constraints before loading data into table automatically ( I Didn't specify in oracle stage to disable the constraints)
Please let me know how to handle this.

Thank You
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If you chose a "table load" (i.e. bulk load) then you will have an "index mode" option in the Oracle stage, set to either "maintenance" or "rebuild". I think that in the log file there would have been a warning from the stage stating something like "unable to build index '....' on table"; at least that is what I get when I create duplicates.

Also check the settings for your $APT_ORACLE_LOAD_OPTIONS to see what your actual values are.
vcannadevula
Charter Member
Charter Member
Posts: 143
Joined: Thu Nov 04, 2004 6:53 am

Post by vcannadevula »

Hi Arnd,

How can I get rid of the rows in the table now? This there any way other than droping and creating the table again.

ArndW wrote:If you chose a "table load" (i.e. bulk load) then you will have an "index mode" option in the Oracle stage, set to either "maintenance" or "rebuild". I think that in the log file there would have been a warning from the stage stating something like "unable to build index '....' on table"; at least that is what I get when I create duplicates.

Also check the settings for your $APT_ORACLE_LOAD_OPTIONS to see what your actual values are.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Can you disable that index and do an appropriate SELECT on the table?
vcannadevula
Charter Member
Charter Member
Posts: 143
Joined: Thu Nov 04, 2004 6:53 am

Post by vcannadevula »

Index is in UNUSABLE state . I am not able to disable the index.
ArndW wrote:Can you disable that index and do an appropriate SELECT on the table?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

What about "skip_unusable_indexes true", that should allow the delete operations to run.
thebird
Participant
Posts: 254
Joined: Thu Jan 06, 2005 12:11 am
Location: India
Contact:

Post by thebird »

vcannadevula wrote:Index is in UNUSABLE state . I am not able to disable the index.
ArndW wrote:Can you disable that index and do an appropriate SELECT on the table?
Hi,

The index will have to be rebuilt .

While doing a load into the Oracle table, if there occurs an error or a constraint violation then the index goes to the unusable state. This will have to be got back to the usable state for the job to run successfully again.

Regards,

The Bird.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

TheBird,

the rebuilding was not his question, though. I think that part is clear - an unusable index needs to be rebuilt. But it was the use of DELETE/SELECT that he is asking about on a table with an unusable index.

the Oracle setting that I gave will work at Oracle 10.x; I am not sure if it existed at previous versions.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You could hint it to use a different index or use the NOINDEX hint:

Code: Select all

/*+ INDEX_NOINDEX(table_name index_name) */
to facilitate removal of the problem rows before you rebuild the index.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vcannadevula
Charter Member
Charter Member
Posts: 143
Joined: Thu Nov 04, 2004 6:53 am

Post by vcannadevula »

I truncated the table finally . But still I don't know how database is accepting different rows with same ID.BTW our database in Oracle 10g.

chulett wrote:You could hint it to use a different index or use the NOINDEX hint:

Code: Select all

/*+ INDEX_NOINDEX(table_name index_name) */
to facilitate removal of the problem rows before you rebuild the index.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

vcannadevula wrote:But still I don't know how database is accepting different rows with same ID
Direct path loads are fast because indexes and such are disabled during the load, so it's up to you to not load 'duplicates'. The database will accept them just fine, it's when it tries to re-enable the PK constraint (for example) that it fails and that leaves the affected index marked as UNUSABLE.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply