Why delete index before insertion?

Hi all
I have a table with 5 partitions, I also have 3 indices and 1 local index.
Before each load, I have to truncate a partition and reload the data in that partition.
When I tried to insert data into the partition, I got an error called
ORA-29861: area index is shown LOADING/FAILURE/UNUSABLE
When I checked my index finger, they were all unusable.
I don't know if my truncated statement would unusable.
Once I dropped these unusable indexes, my insert worked.
Now I guess I have to recreate all the indexes.
In my view, there is no such thing as enable and disable an Index. It should drop and rebuild them, I guess?

I have however, the advantage of having a partition is to be able to truncate.
Kindly let me know if I have to go through this every time I have truncate partition and reload it?
Kind regards
AJ

You shouldn't have to drop and re-create the index.

Before loading, you should be able to:
change the index unusable.

on each index. Then, before loading, do:
ALTER session set skip_unusable_indexes = true;

then do the load.

Finally, do:
ALTER index rebuilt nologging;

for each index.

Hope that helps,

-Mark

Tags: Database

Similar Questions

  • Control files - delete records before insert

    Hello

    I have a file of control as follows:

    DOWNLOAD THE DATA
    INFILE 'PRODUCT_DESC*.txt '.
    ADD
    IN THE TABLE PROD_DESC
    WHEN (1:4), <>' 00 |' and <>(1:3) 99 |' and (1:3) <>' | »
    FIELDS TERMINATED BY ' |'
    TRAILING NULLCOLS
    (
    PARTNUMBER,
    PRODUCTNAME,
    SERVICEIDLABEL,
    SORTSEQUENCE)

    When my control file is executed, I would replace the records existing in the table to the records in the file if PARTNUMBER in the file is the same as the table. If this isn't the case, it will just add on the record in the table.

    Here is how the logic goes:

    IF ((PARTNUMBER dans l'enregistrement dele de fichier) = (PARTNUMBER in table PROD_DESC)) THEN
    Replace the record in the table with the record in the file
    ON THE OTHER
    Add the file to the table
    END IF

    How am I suppose to change my CONTROL file for this logic?

    Edited by: JoannaLee May 21, 2009 23:51
  • Confirm delete before inserting then have a unique key.

    Hello

    I have a use case where a database field that is entered by the user must be unique.

    In the database, there is already a record for example 'name1 '.

    The user inserts a new record and puts his name 'name1' as well. Then, for some reason any decides to delete the first existing record and tries to save the new record 'name1 '.

    The previous record validation "Name1" is not yet removed, but the new record with 'name1' seeks to insert.

    Then I get the error message: attribute value 'name1' leads to duplicate keys for this type of entity. oracle.jbo.AttrValException...

    Is it possible to run delete before insertion on commit or another work around?

    JDev Version 11.1.2.3.0

    Concerning

    Here is the link which suites for your usecase

    ADF binary Decompilation: customization of the display order of the changes made to the database

    You need to wtite your own custom of the Transactionfactory class.

    Let us know if it works for you

    Thank you

    KT

  • TRIGGER BEFORE INSERT OR UPDATE OR DELETE

    I want to create a single trigger before each insert or update or delete, a record gets copied into the AUDIT table. works very well on the insertion and to day but you have problem clear.

    Can you please help me debug this error. The problem of mutation.

    create or replace

    BIU_FS_Test_T RELAXATION

    BEFORE INSERT OR UPDATE OR DELETE

    ON FS_Test

    REFERRING AGAIN AS NINE OLD AND OLD

    FOR EACH LINE

    DECLARE

    number of voffender_history_id;

    Start

    IF the INSERTION

    SELECT FS_Test_history_seq. nextval in the double voffender_history_id;

    INSERT INTO FS_Test_history (OFFENDER_HISTORY_ID,

    OFFENDER_ID, FIRST_NAME, MIDDLE_NAME, LAST_NAME.

    SX, SKIN_TONE, HEIGHT, WEIGHT, RACE, EYE_COLOR,

    HAIR_COLOR, BLOOD_TYPE, VARIOUS, DATE_OF_BIRTH.

    PLACE_OF_BIRTH, TRANSACTION)

    VALUES (voffender_history_id,

    : new. OFFENDER_ID,: new. First name: new. MIDDLE_NAME,: new. LAST_NAME,

    : new. RACE: new. SX,: new. SKIN_TONE,: new. HEIGHT: new. WEIGHT: new. EYE_COLOR,

    : new. HAIR_COLOR,: new. BLOOD_TYPE,: new. VARIOUS: new. DATE_OF_BIRTH,

    :new. PLACE_OF_BIRTH,

    "INSERT");

    ELSIF UPDATE

    et (

    NVL (:OLD. First name, 'x') <> nvl():NEW. First name, 'x') or

    NVL (:OLD. MIDDLE_NAME, 'x') <> nvl():NEW. MIDDLE_NAME, 'x') or

    NVL (:OLD. Last_name, 'x') <> nvl():NEW. Last_name, 'x') or

    NVL (:OLD. RACE 0) <> nvl():NEW. RACE 0) or

    NVL (:OLD. SX 0) nvl(:NEW <>.) SX 0) or

    NVL (:OLD. SKIN_TONE 0) <> nvl():NEW. SKIN_TONE 0) or

    NVL (:OLD. HEIGHT 0) <> nvl():NEW. HEIGHT 0) or

    NVL (:OLD. WEIGHT 0) <> nvl():NEW. WEIGHT 0) or

    NVL (:OLD. EYE_COLOR 0) <> nvl():NEW. EYE_COLOR 0) or

    NVL (:OLD. HAIR_COLOR 0) <> nvl():NEW. HAIR_COLOR 0) or

    NVL (:OLD. BLOOD_TYPE 0) <> nvl():NEW. BLOOD_TYPE 0) or

    NVL (:OLD. VARIOUS, ' x') <> nvl():NEW. VARIOUS, ' x') or

    NVL (:OLD. DATE_OF_BIRTH, January 1, 1900 ") <> nvl():NEW. " DATE_OF_BIRTH, January 1, 1900 ") or"

    NVL (:OLD. PLACE_OF_BIRTH 0) <> nvl():NEW. PLACE_OF_BIRTH 0)

    )

    THEN

    SELECT FS_Test_history_seq. nextval in the double voffender_history_id;

    INSERT INTO FS_Test_history (OFFENDER_HISTORY_ID,

    OFFENDER_ID, FIRST_NAME, MIDDLE_NAME, LAST_NAME.

    SX, SKIN_TONE, HEIGHT, WEIGHT, RACE, EYE_COLOR,

    HAIR_COLOR, BLOOD_TYPE, VARIOUS, DATE_OF_BIRTH.

    PLACE_OF_BIRTH, TRANSACTION)

    VALUES (voffender_history_id,

    : new. OFFENDER_ID,: new. First name: new. MIDDLE_NAME,: new. LAST_NAME,

    : new. RACE: new. SX,: new. SKIN_TONE,: new. HEIGHT: new. WEIGHT: new. EYE_COLOR,

    : new. HAIR_COLOR,: new. BLOOD_TYPE,: new. VARIOUS: new. DATE_OF_BIRTH,

    :new. PLACE_OF_BIRTH, "UPDATE");

    ELSIF DELETION THEN

    SELECT FS_Test_history_seq. nextval in the double voffender_history_id;

    SELECT FS_Test_history_seq. nextval in the double voffender_history_id;

    INSERT INTO FS_Test_history (OFFENDER_HISTORY_ID,

    OFFENDER_ID, FIRST_NAME, MIDDLE_NAME, LAST_NAME.

    SX, SKIN_TONE, HEIGHT, WEIGHT, RACE, EYE_COLOR,

    HAIR_COLOR, BLOOD_TYPE, VARIOUS, DATE_OF_BIRTH.

    PLACE_OF_BIRTH, TRANSACTION)

    VALUES (voffender_history_id,

    : new. OFFENDER_ID,: new. First name: new. MIDDLE_NAME,: new. LAST_NAME,

    : new. RACE: new. SX,: new. SKIN_TONE,: new. HEIGHT: new. WEIGHT: new. EYE_COLOR,

    : new. HAIR_COLOR,: new. BLOOD_TYPE,: new. VARIOUS: new. DATE_OF_BIRTH,

    :new. PLACE_OF_BIRTH, 'CLEAR');

    END IF;

    end;

    Error I get

    Error from the 1 in the command line:

    Remove from the fs_test where PK = 41476

    Error report:

    SQL error: ORA-04091: table get OUT. SOR_O_HISTORY is changing, function of triggering/can not see

    ORA-06512: at «GET. » BIU_FS_TEST_T', line 111

    ORA-04088: error during execution of trigger ' EB. BIU_FS_TEST_T'

    04091 00000 - «table %s. » "%s is changing, function of triggering/can not see.

    * Cause: A trigger (or plsql user-defined function that is referenced in)

    ( this statement) attempted to watch (or modify) a table that has been

    in the middle to be modified by the statement that shot.

    * Action: Rewrite the trigger (or function) so it does not read this table.

    PS 11g r2

    Thank you.

    n_shah18-

    Is there a parent-child relationship between the tables involved in the triggering event? Is there a foreign key used above the child table that references the parent table?

    If you have a parent-child relationship and a trigger on the parent table must be running some DML on the child table, and, if the child table as a foreign key (FK) back to the parent table, any DML on the child table will cause a recursive SQL statement to check the constraint. Indirectly, this will cause an exception table mutation.

    So watch the dependencies on SOR_O_HISTORY / FS_TEST_HISTORY/all other related table. A FOREIGN KEY can make it to mutate (no pun intended).

    Hope this will help you find the root cause.

  • Whenever I restart my pc I need to fix my indexing before I can search anything.

    Whenever I restart my pc I need to fix my indexing before I can search anything. Why? Is there a way to fix this?

    You can try to turn it off and on through Control Panel > everything in Control Panel > programs and features > Windows turn on or off features in the left pane. > Indexing.

  • Trigger before insert

    Hi, I need help to create a trigger before the insertion of the STA_STARTDATE column in the employees table
    CREATE OR REPLACE TRIGGER trig_start_date
    BEFORE INSERT OF STAFF FOR EACH ROW
    BEGIN
      IF STA_STARTDATE < '01-JAN-1980'
        THEN
            RAISE_APPLICATION_ERROR(-20900, 'No earlier than 1/1/1980');
      END IF;
    END;
    Note: If the declaration is < 01 - JAN-1980 quotes

    When I run the script, it comes up with this error:

    Error report:
    ORA-04073: invalid column list for this type of trigger
    04073 00000 - "list of invalid columns for this type of trigger.
    * Cause: A list of columns has been specified for a non updated trigger type.
    * Action: Delete the column list.

    * fixed by replacing the OF keyword with, but still have a warning

    Published by: 888948 on October 2, 2011 16:48

    Hello

    to use a column in a trigger, the column must have: new for new values, or: old old values before the name of the column, so your if statement should begin with:

    IF :NEW.STA_STARTDATE 
    

    Herald tiomela
    http://htendam.WordPress.com

  • delete index.dat

    How can I delete index.dat / I know that you can do that but how

    Hello

    The free ccleaner version should make this - it is on the link below.

    http://www.Piriform.com/ccleaner/download/standard

    Kind regards

    DP - K

  • Why delete the temporary file?

    Why delete the temporary file?

    because temporary files are of no use to us and toff are created for temporary use so after use keep them in our system, as resulting from the decreade of memory hard drive and also a lot of downturns and vaults of virus, so it is better to delete the temporary files u can try one of them to make the best management of your temporary folder

    1. search for folder or folder type in the run command and delete everything in the temp folder
    2.u can also use tune up utilities software
    3. famous is ccleaner it's free, you can download it and use it
  • Truncate a field before inserting

    Suppose I have the following text:

    Array: mytable

    field: username (VARCHAR2 (35))

    field: zip (VARCHAR2 (5))

    I am importing data from an excel with columns username and zip file. A couple of the usernames contains more than 35 characters, and some postal codes are in the format xxxx-xxxxx, therefore containing more than 5 characters.

    I tried to write an insert before truncating the data until they are inserted. For any user name that is longer than 35 characters in Excel, simply truncate the username to the first of 35 characters. Similarly, for any ZIP code which is above 5 characters, just truncate the zip on the first 5 characters.

    The trigger for postal codes:

    CREATE OR REPLACE

    Trigger_zipc RELAXATION

    BEFORE INSERTING

    ON mytable

    FOR EACH LINE

    BEGIN

    SELECT substr (: new .zip, 1, 5)

    IN: new.zip

    Double;

    END;

    However, I get the error: ORA-12899: value too large for column

    I understand that this happens because the value is read before my validation, and because the value is too large, it is not allowed to insert.

    I'm not sure where to go from here. Any suggestions?

    
    

    Is it excel file or a csv file.

    I think you can look into creating an external table as well.

    Before inserting it just to make a substring.

    Something along the lines.

    CREATE TABLE ext_data (
     username CHAR(500),
      zip CHAR(500))
      ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT DIRECTORY ext_tab_dir
      ACCESS PARAMETERS (FIELDS TERMINATED BY ',')
      LOCATION ('csv.dat'));
    
    insert into mytable
    select substr(username,1,35) , substr(zip,1,5) from ext_data;
    

    I hope this helps.

    Alvinder

  • Why the index are lost after recovering from a REPLICATE_PERSISTENT region?

    GemFire Version V7.0.1.3 for region below specifications. java.lang.String com.foo.bar.Positon after recovery of the store persistent it is no markings on the region. All indexes are lost. CacheFactory cacheFactory = new CacheFactory(); cache = cacheFactory.create (); Ins ByteArrayInputStream = new ByteArrayInputStream (cachexmlstring); cache.loadCacheXml (ins);

    OK I understood why the index get lost. Is that the way cache is initialized.

    CacheFactory cacheFactory = new CacheFactory();

    cache = cacheFactory.create (); Cache is created here without consideration of persistence pdx

    Ins ByteArrayInputStream = new ByteArrayInputStream (cachexmlstring);

    cache.loadCacheXml (ins); Now loading data it has no definition pdx index data.

    So now even if I get the data loaded in the regions, when I probe through gfsh, there's no index.

    I just changed the code of

    FileOutputStream ops = new FileOutputStream ("cache.xml");

    OPS. Write (cachexmlstring. GetBytes());

    CacheFactory cacheFactory = new CacheFactory();

    cache = cacheFactory.create ();

    The indexes are coming fine...

  • When I wear a picture of ACR in photoshop there are black or white boxes in this image. Why? Never before have this problem.

    When I wear a picture of ACR in photoshop there are black or white boxes in this image. Why? Never before have this problem.

    Hello

    Please try to update to camera raw.

    Concerning

    Jitendra

  • Currently, I have Photoshop CS5 on my computer. Should I delete it before you download Photoshop on the cloud?

    Currently, I have Photoshop CS5 on my computer. Should I delete it before you download Photoshop on the cloud?

    You don't have to.

  • Why bitmp index are not suggested for DML operations

    Hi all

    Can someone make me understand why bitmap indexes are not suggested to use for DML operations. AFAIK, the reason being that it locks the table and another user won '; t be able to complete the transaction but why?

    user13389425 wrote:
    the reason is that I found is that it stores the rowid of beginning and the end rowid and the value of the spreadsheet store n number of entries of the inder, so any operation DML whole leaves lock themselves and cause the performance of the database. My next question I was not able to address, is that the index entries how do I store it on a single sheet. How calcualte the same.

    It is not the entire sheet that gets locked, just the specific index entry in the block sheet index, as well as the corresponding lines in the table referenced by the rowid ranges in the index entry.

    As an indication, the average number of index entries in a block of sheets is the num_rows/leaf_blocks in dba_indexes. As an example, the average number of rows in the table referenced by the index entry is (num_rows in dba_tables/num_rows in dba_indexes) * distinct_keys in dba_indexes.

    See you soon

    Richard Foote
    http://richardfoote.WordPress.com/

  • Helps relaxation that fits into another table before insertion

    I have two tables:

    TABLE A as follows:
    x, y, z
    1, 1, 1
    1, 1, 2
    1, 1, 3

    TABLE B as follows
    c, d, e, f
    1, 1, 1, 8
    1, 1, 1, 2
    1, 1, 1, 6
    1, 1, 2, 5
    1, 1, 2, 10
    1, 1, 2, 3
    1, 1, 3, 12
    1, 1, 3, 11
    1, 1, 3, 15


    I want a trigger, BEFORE insertion in the TABLE B, I want to INSERT into TABLE A as follows:

    c = > x
    d = > y
    e = > z

    ONLY IF a (x, y, z) record does not already exist in the TABLE.

    That is to say. If record (1, 1, 3) already exists in the TABLE, we do not try to put it back when you insert in the TABLE B with values containing (1, 1, 3).

    You will need

    CREATE OR REPLACE trig_on_insert
    BEFORE INSERT ON B
    FOR EACH ROW
    IS
       lv_count    NUMBER := 0;
    BEGIN
       SELECT COUNT(1)
         INTO lv_count
         FROM a
        WHERE x = :new.c
          AND y = :new.d
          AND z = :new.e ;
    
       IF ( lv_count = 0 ) THEN
          INSERT INTO A VALUES(:new.c,:new.d ,:new.e);
       END IF;
    END;
    /
    

    Concerning
    Arun

  • Redirect data to another table using before insert trigger.

    Dear all,
    How can I redirect the data to another table in a before Insert trigger? My database is Oracle10g.
    I have a table EMP (EMP_ID, LAST_NAME, SALARY).
    I have another EMP_COPY table with the same structure. I also have a before Insert trigger on the EMP table.
    Based on a condition that I have to redirect the data in table EMP_COPY. Let's say the condition is EMP_ID = 100.
    I fire an insert on EMP table for example INSERT IN EMP(EMP_ID,LAST_NAME,SALARY) VALUES(100,'Dev',500).
    On the inside of the front Insert trigger on the EMP table, I have the code
    IF EMP_ID = 100 THEN
    INSERT INTO EMP_COPY (EMP_ID, LAST_NAME, SALARY)
    VALUES(:NEW.) EMP_ID,: NEW. LAST_NAME,: NEW. SALARY);
    COMMIT;
    ON THE OTHER
    NULL;
    END IF;
    But the problem here is that data goes to EMP table of origin also although I don't want. He should do an Insert into EMP table only if EMP_ID! = 100.

    One way has been to raise a user-defined exception inside the If statement and not handle it so that the original insert on table EMP fails but INSERT comes in the EMP_COPY table. But in this solution since the inside the trigger unhandled exception, it propagates to the calling environment. And I can't stand outside relaxation as the calling environment is a form of Oracle Apps standard that cannot be customized.

    Any kind of help will be highly appreciated that I am fighting for more than two weeks.

    Thanks in advance
    Dev

    Remove the autonomous transaction pragma... and then try again.

Maybe you are looking for