Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Massive insert: problems with indexes (Version 10.2)

user12249099Apr 12 2010 — edited Apr 12 2010
Hi, friends. I am a rookie in Oracle, so I ask us because I have a problem that I can't solve it,
(in fact it's a inherited problem)

I want to insert about 4.000.000 records in a table with around 10.000.000 records.

This table have many foreign keys, a primary key (on an index) and three indexes.

I try to insert the records with a cursor as this:

OPEN c_cursor;

FETCH c_cursor INTO c_record;
WHILE c_cursor%found LOOP

INSERT INTO table
(id,
...
VALUES (
...
);
FETCH c_cursorINTO INTO c_record;
END LOOP;
commit;
CLOSE c_cursor;

The operation takes very long time. So I want to disable/drop indexes at first of cursor and at the end,
unable-rebuild/create.

- But when I try disable the indexes with UNUSUABLES (alter index INDEX UNUSABLE), the database
said me:
ORA-01502: index 'INDEX' or partition of such index is in unusable state

It looks that I can't write while the INDEX (also is primary key) is unusable

- I can't remove the index DROP INDEX 'INDEX':
ORA-02429: cannot drop index used for enforcement of unique/primary key

- I can't disable the primary key:
ORA-02297: cannot disable constraint (INDEX) - dependencies exist

What would you want in this case?.

Thanks for all and regards.

Javi


Note: I can't do it with sqlldr because the insert requires a treatment (I do it with the cursor).
Thanks again.

Edited by: user12249099 on 12-abr-2010 7:04

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on May 10 2010
Added on Apr 12 2010
9 comments
1,450 views