Sql loader direct path leaving indexes unusuable

10.2.0.3
redhat 4.5
temp tablespace 6.5 GB
datafile size 33k
I thought in version 10 you can do direct path loads without indexes going unusuable?
i saw this, but we have plenty of temp space.
http://dbasolve.com/OracleError/ora/ORA-01502.txt
Oracle Error:
ORA-01502 Oracle Index in Unusable State
Cause and Solution:
When trying to perform query on Oracle tables with select SQL statement, Oracle returns this error.
The error indicates an attempt has been made to access an index or index partition that has been marked unusable by a direct load or by a DDL operation.
The problem usually happens when using the Direct Path for the SQL*Loader, Direct Load or DDL operations. This requires enough temporary space to build all indexes of the table. If there is no enough space in TEMP tablespace, all rows will still be loaded and imported, but the indices are left with STATUS = 'INVALID'.
Invalid indexes can be checked with down SQL statement.
SQL>SELECT * from USER_INDEXES WHERE STATUS = 'INVALID';
Solution to this error is simple. You can:
1. Drop the specified index and/or recreate the index
2. Rebuild the specified index
3. Rebuild the unusable index partition
Generally, the following SQL manipulation language will be able to rebuild the unusable index:
SQL>ALTER INDEX index_name REBUILD online

Hi Alan,
How big is this table and what sort of indexes are they?
An index update using SQL*Loader unrecoverable direct path load is achieved by an isolated sort followed by a nologging merge of the old index and the new mini-index into a new index segment (this according to seminar notes by Jonathan Lewis). This will conceivably take a long time for a large table / large index.
Performance improvements? Are you loading all records into a new partition?
Cheers,
Colin

Similar Messages

  • SQL Loader, direct path and indexes on partition tables

    Hi,
    I have a big partitioned table and I have two indexes on it.
    When I use SQL Loader to upload data to my table with using OPTIONS (DIRECT=TRUE) UNRECOVERABLE , then it takes almost half hour to load just one record!!
    When I remove OPTIONS (DIRECT=TRUE), then it takes just two seconds to upload the same one record.
    Am I missing anything? Can I use direct path load on indexed partitioned tables and have reasonable load time ?
    An scheduled external job loads almost 100,000 records into this table every hour and I am trying to make the sql*loader performance it as fast as possible.
    Any help would be appreciated,
    Alan

    Hi Alan,
    How big is this table and what sort of indexes are they?
    An index update using SQL*Loader unrecoverable direct path load is achieved by an isolated sort followed by a nologging merge of the old index and the new mini-index into a new index segment (this according to seminar notes by Jonathan Lewis). This will conceivably take a long time for a large table / large index.
    Performance improvements? Are you loading all records into a new partition?
    Cheers,
    Colin

  • SQL Loader direct path loads and unusable indexes

    sorry about all the questions. I am researching several issues. I am reading the Utilities document. It says that in certain circumstances indexes will become unusable. I have some questions about my scenario.
    1. tables partitioned by range
    2. local indexes
    3. all tables have 1 primary key and other indexes are non-unique
    4. all sql loads will go into the most recent partition
    5. users will be querying tables while sql loader is occurring
    6. only one sql loader session will run per table
    7. no foreign keys, triggers, or other constrants other than primary keys.
    The docs are not clear. Do I have a concern about unusable indexes with direct path loads? Will indexes function while the sql loader direct path is occurring(this I can't test since I have small data files now and they load fast, but I will have larger ones in production).
    My understanding is that Extertnal tables using Insert append is exactly the same as sql loader direct path load. Is this true?

    if you dont have anything productive to say how about you don't post at all? you have made ignorant posts like this for years.
    as far as reading the docs what do you think "the docs are not clear" means? By the docs I am referring to the utilities document.
    As far as version number its 10.2 and I forgot that. However, it does not appear that sql loader has really changed all that much over the last few versions.
    Finally I plan on testing it out and its more than a 2 minute test. I wanted to make sure I don't miss anythng in my tests.
    don't respond to any threads or posts I make from now on.

  • Cannot get Oracle sequence to be used with SQL Loader direct path load.

    I attempted to load approximately 3 million rows from a flat file into a 10g database using SQL Loader direct path load. In order to generate a primary key for each of these rows I used a simple SQL expression which gets the next number of an Oracle sequence and assigned that to my primary key column inside the control file. The strange thing is no primary key was generated for each of these columns as I see the sequence was not advanced. Furthermore when I try to run a query to find the count on those rows which have this column as NOT NULL ,I get the total of all the rows even though on inspection this column is empty in each of the rows.
    As far as I know, in the control file for a direct path load I am able to use a SQL Expression that returns simple scalar data which a NEXTVAL on a sequence does. (Oreilly Oracle SQL Loader The Definitive Guide p.184)
    Does anybody why my primary key was not generated and furthermore why is this column in a query appear to be NOT NULL when in fact it has nothing in it?

    Daniel,
    I appreciate your response alot.
    Now a follow on. You say that SQL*Loader is the fastest way to get data into Oracle Spatial even though the conventional path. How does SQL*Loader do this? Doesn't it use OCI?
    I just can't help but think that coverting my data to SQL*Loader format, and then having it parse it and send it to the database in some form must be slower than me just sending whatever SQL Loader sends to the DB myself using OCI. Am I missing something?
    The SQL Loader documentation seems to suggest that SQL*Loader just turns the input into alot of INSERT stateemnts. If so, can't I just do this?
    My performance with OCI and INSERT statements isn't very good, but I believe I am doing one transaction per insert. Might I be as well off to concentrate on fine tuning my OCI based code using INSERTs?
    I will actually do some time tests myself, but I would appreciate your opinion.
    Once again thanks for the great info you have provided.

  • Oracle Replication and SQL*Load direct Path

    We are setting up Oracle replication and have a few tables which are loaded using SQL*Loader Direct path. I have following questions:
    1. Can MultiMaster replication replicate direct patch sqlloaded data.
    2. If the answer to the above question is no, should we set up a new snapshot replication group . All other tables are in the Multi Master replication.
    3. Another question is on the number of replication groups. How many of these we should create. We have total of about 500 tables and database size is about 450 Gig. We plan to replicate all the tables and the refresh interval we want to be one minute for all the tables. Does having more/less replication groups help??
    Thanks for your help

    We are setting up Oracle replication and have a few tables which are loaded using SQL*Loader Direct path. I have following questions:
    1. Can MultiMaster replication replicate direct patch sqlloaded data.Yes, I don't think it should matter how the table is getting updated.
    2. If the answer to the above question is no, should we set up a new snapshot replication group . All other tables are in the Multi Master replication.see above
    3. Another question is on the number of replication groups. How many of these we should create. We have total of about 500 tables and database size is about 450 Gig. We plan to replicate all the tables and the refresh interval we want to be one minute for all the tables. Does having more/less replication groups help??
    Thanks for your help I believe what Oracle recommends is that you split up your tables into replication groups transactionally. I personally have 6 replication groups supporting 700+ tables. They are broken up more by business function than by number and size.

  • SQL Loader Direct Path issue

    Hi,
    I am trying to load data using SQL Loader Direct Path. One of the tables has a REC_UPD_DT column which is of timestamp datatype. The table was created with default value of SYSTIMESTAMP on this column. However when I load the table, the REC_UPD_DT is null due to the behavior(bypasses the sqlfunctions, etc) of the Direct Path method.
    What is the way out to achieve my objective?
    I do not want to use the conventional path since that is proven to be slow for my case.
    Thanks in advance
    Pavin

    Hi,
    My apologies for not providing requested information before. Here are the scripts:
    I am testing from my windows m/c.
    Database version: 10.2.0.3
    Table creation script:
    CREATE TABLE TXN_DEFAULT
    (MAPPER_Q_ID NUMBER(1,0) NOT NULL,
    TRANSACTION_SEQUENCE NUMBER(10,0) NOT NULL,
    RECORD_COUNT NUMBER(4,0),
    STATUS VARCHAR2(1 CHAR),
    USER_ID VARCHAR2(20 CHAR),
    USER_IP_ADDRESS VARCHAR2(35 CHAR),
    REC_UPD_DT TIMESTAMP (6) DEFAULT SYSTIMESTAMP
    Loader Control file script:
    OPTIONS (DIRECT=TRUE)
    load data
    CHARACTERSET WE8ROMAN8
    into table TXN_DEFAULT
    append
    FIELDS TERMINATED BY '     '
    trailing nullcols
    MAPPER_Q_ID,
    TRANSACTION_SEQUENCE,
    RECORD_COUNT,
    STATUS,
    USER_ID,
    USER_IP_ADDRESS,
    REC_UPD_DT     
    Sample Dat file contents:
    0     251939112     3     N     chowdsr     10.222.79.20     
    1     251939113     140     N     zhuanre     146.222.52.176     
    2     251939114     41     N     sombupo     146.222.187.155     
    0     251939116     75     N     BaseAdmin     146.222.4.246     
    Log File contents:
    SQL*Loader: Release 10.2.0.1.0 - Production on Mon Dec 7 13:22:23 2009
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Control File: Control.ctl
    Character Set WE8ROMAN8 specified for all input.
    Data File: Control.dat
    Bad File: Control.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Continuation: none specified
    Path used: Direct
    Table TXN_DEFAULT, loaded from every logical record.
    Insert option in effect for this table: APPEND
    TRAILING NULLCOLS option in effect
    Column Name Position Len Term Encl Datatype
    MAPPER_Q_ID FIRST * WHT CHARACTER
    TRANSACTION_SEQUENCE NEXT * WHT CHARACTER
    RECORD_COUNT NEXT * WHT CHARACTER
    STATUS NEXT * WHT CHARACTER
    USER_ID NEXT * WHT CHARACTER
    USER_IP_ADDRESS NEXT * WHT CHARACTER
    REC_UPD_DT NEXT * WHT CHARACTER
    Table TXN_DEFAULT:
    4 Rows successfully loaded.
    0 Rows not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Bind array size not used in direct path.
    Column array rows : 5000
    Stream buffer bytes: 256000
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 4
    Total logical records rejected: 0
    Total logical records discarded: 0
    Total stream buffers loaded by SQL*Loader main thread: 1
    Total stream buffers loaded by SQL*Loader load thread: 0
    Run began on Mon Dec 07 13:22:23 2009
    Run ended on Mon Dec 07 13:22:23 2009
    Elapsed time was: 00:00:00.75
    CPU time was: 00:00:00.08
    If I run using Conventional path, the REC_UPD_DT is populated with the a systimestamp value. However, this column values are null when I use the Direct path. Log files have no errors. What is the way out to achieve my objective?
    Thanks in advance.
    - Pavin

  • Sql loader direct path

    Hi All,
    Can anyone confirm whether SQL loader DIRECT path option can load in clustered tables?
    Also what is the difference between Clustered Server and Clustered Table? Will the clustered Server by default have clustered tables?

    That is 1/2 of the questions asked.
    What do you mean by clustered server? Do you mean RAC or HACMP or Veritas something else?
    What do you mean by clustered table? Do you mean like a single table hash cluster or something else?
    Please be specific ... you don't want an answer based on a guess.
    And what is 10g? Is that 10.1.0.3, or 10.2.0.1, or 10.2.0.5? Again this is computers please be precise.I am sorry. version is 10.2.0.1. its Oracle RAC. I am not sure what kind of table clustering exists. I believe its table cluster using a cluster key(what kind of table clustering is this?)
    I just want to know if sql loader direct path option can load data in Oracle RAC / Clustered tables? If not, any workaround for that?

  • Sql Loader Direct Path Upload

    I am trying DIRECT path upload to insert data from flat file to oracle table which has some indexes.The table is used by a procedure for dml operations on another table.
    Previously,we used conventional path upload with PARALLEL=TRUE option.
    I read that DIRECT upload affects indexes,and since I use the table being populated by direct upload for some other dml operation I don't want any performance degradation to other operations in the procedure.
    How do I inspect the impact of DIRECT upload on my tables and procedure execution.
    Also,are there any other side-effects of DIRECT Path Upload.
    Any ideas?

    since I use the table being populated by direct upload for
    some other dml operationOne of the restrictions for Direct Path Loads is
    that the tables to be loaded do not have any active transactions pending.
    For other restrictions on using direct path loads and conditions causing a direct path load to leave an index in usables state see
    http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10825/ldr_modes.htm#i1008815

  • SQL Loader Direct Path and Nulls

    I'm using Sql Loader with Direct Path and I cannot find a way to remove trailing spaces in varchar2 fields.
    I'm trying to avoid updating the tables after loading.
    Any ideas?

    Hi Alan,
    How big is this table and what sort of indexes are they?
    An index update using SQL*Loader unrecoverable direct path load is achieved by an isolated sort followed by a nologging merge of the old index and the new mini-index into a new index segment (this according to seminar notes by Jonathan Lewis). This will conceivably take a long time for a large table / large index.
    Performance improvements? Are you loading all records into a new partition?
    Cheers,
    Colin

  • Errors when using sql loader direct path with a nvl functin on a date field

    I thought I read in 10g that all sql functions now work in direct path mode.
    the following function works without direct path mode. When we turn direct path mode on the load fails. When we take the function out in direct path mode it works.
    mydate DATE "YYYY-MM-DD" "nvl(:mydatedate,to_date('9999-01-01','YYYY-MM-DD'))"
    with direct path mode I get:
    EVERY record gets rejected with this error.
    Record 10: Rejected - Error on table MYTABLE
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01861: literal does not match format string
    again works fine without direct=true, works fine with direct=true if i get rid of the function.
    any ideas?
    Message was edited by:
    Guess2
    Message was edited by:
    Guess2

    like usual your posts are completely useless daniel.
    I could have swarn that oracle advertised that you can use functions with 9i or 10g release in the new features guys or the first releases.

  • Loading VARRAY's with SQL loader, direct path in 9i?

    Isn't it possible to load VARRAY's with SQLloader and direct path in a Oracle 9i database?
    /Magnus Hornstrom
    mailto:[email protected]

    Daniel,
    I appreciate your response alot.
    Now a follow on. You say that SQL*Loader is the fastest way to get data into Oracle Spatial even though the conventional path. How does SQL*Loader do this? Doesn't it use OCI?
    I just can't help but think that coverting my data to SQL*Loader format, and then having it parse it and send it to the database in some form must be slower than me just sending whatever SQL Loader sends to the DB myself using OCI. Am I missing something?
    The SQL Loader documentation seems to suggest that SQL*Loader just turns the input into alot of INSERT stateemnts. If so, can't I just do this?
    My performance with OCI and INSERT statements isn't very good, but I believe I am doing one transaction per insert. Might I be as well off to concentrate on fine tuning my OCI based code using INSERTs?
    I will actually do some time tests myself, but I would appreciate your opinion.
    Once again thanks for the great info you have provided.

  • SQL Loader installed path

    Any one have any idea how to get the exact path where SQLLDR got installed in UNIX. I am getting a path related issue while executing SQLDR unix command in Oracle
    You help is well appreciated.

    Please check $PATH, $ORACLE_BASE, $ORACLE_HOME  environments.
    echo $PATH
    echo $ORACLE_HOME
    export PATH=$ORACLE_HOME/bin:$PATH;
    Regards
    Mahir

  • SQL Loader choosing conventional path when direct path is requested

    We have a mystery regarding SQL Loader choosing to load with conventional path even though direct path is requested.
    We have a control file that produces direct-path loads and one which does not. The difference between them does not seem to account for the difference in behavior.
    The following control file does not give us direct-path:
    OPTIONS (
         SKIP=0,
         ERRORS=0,          
         DIRECT=TRUE,          
         NOLOGGING
    LOAD DATA
    INFILE "[file path]" "STR x'0A'"
    BADFILE "[file path].bad"
    DISCARDFILE "[file path].dsc"
    DISCARDMAX 0
    INSERT
    INTO [schema name].[table name]
    FIELDS TERMINATED BY X'2C'
    OPTIONALLY ENCLOSED BY '?'
    TRAILING NULLCOLS
         C1_ACD_LINE_CD     CHAR(2000),
    [column specifications continue]
    )When running with this control file, the log shows:
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 0
    Bind array:     64 rows, maximum of 256000 bytes
    Continuation:    none specified
    Path used:      Conventional
    Table [schema name].[table name], loaded from every logical record.
    Insert option in effect for this table: INSERT
    TRAILING NULLCOLS option in effectIf we use a control file that is modified as follows:
    OPTIONS (
         SKIP=0,
         ERRORS=0,     
         DIRECT=TRUE,     
         PARALLEL=TRUE,
         NOLOGGING
         )Then we do get direct-path load:
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 0
    Continuation:    none specified
    Path used:      Direct
    Table [schema name].[table name], loaded from every logical record.
    Insert option in effect for this table: INSERT
    TRAILING NULLCOLS option in effectSo there is nothing about the table (constraints, triggers, etc.) that is preventing direct-path loads.
    Now, we stumbled into this PARALLEL thing by accident - we are not really trying to do parallel loads.
    In my reading of the Utilities guide (http://docs.oracle.com/cd/E11882_01/server.112/e22490/ldr_modes.htm#autoId64 ), the PARALLEL option lets SQL Loader tolerate multiple sessions loading to the same segment at once, but does not perform parallel processing itself. So, is it possible there is some other lock on the table is causing SQL Loader to block direct-path loads to the table (because of a previous SQL Loader direct-path load, perhaps) unless the PARALLEL option is invoked? If so, how do we recognize that state and how do we resolve it?
    Version information:
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE     11.2.0.3.0     Production
    TNS for Solaris: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    Any thoughts or suggestions would be appreciated.
    Thanks,
    Mike

    From the same link
    >
    To use a direct path load (except for parallel loads), SQL*Loader must have exclusive write access to the table and exclusive read/write access to any indexes.
    >
    So I suspect that when using only DIRECT=TRUE, Oracle is not able to get an exclusive lock on the required objects, so it uses the conventional mode.
    From a later section
    >
    - Segments to be loaded do not have any active transactions pending.
    To check for this condition, use the Oracle Enterprise Manager command MONITOR TABLE to find the object ID for the tables you want to load. Then use the command MONITOR LOCK to see if there are any locks on the tables.
    >
    Would be interested in knowing what you find
    HTH
    Srini

  • How to handle SQL loader in stream,

    Hi friends,
    ANy experience to handle SQL*loader in stream? How to handel space and mamory for SQL*Loader Direct path loading?
    we have a bi_direction stream. how to load huge data into stream without brokken stream system?
    Thanks for your help!!
    Jim

    see also note
    Note:222769.1
    I have not use this parameter before in sqlldr.. Do need to do some research..
    STREAMSIZE          
    Specifies the size, in bytes,      250 KB               
    New parameter introduced in for direct path streams.                    
    Oracle 9i.

  • DIRECT PATH LOAD의 개념 및 사용 방법

    제품 : ORACLE SERVER
    작성날짜 : 1998-11-27
    매우 많은 양의 데이타를 빠른 시간 내에 load하고자하는 경우 direct path load를
    사용할 수 있다. 여기에서 이러한 direct path load의 자세한 개념 및 사용방법,
    사용 시 고려해야 할 점 등을 설명한다.
    1. conventional path load
    일반적인 sql*loader를 이용한 방법은 존재하는 table에 datafile 내의 data를
    SQL의 INSERT command를 이용하여 insert시킨다. 이렇게 SQL command를
    이용하기 때문에 각각의 데이타를 위한 insert command가 생성되어 parsing되는
    과정이 필요하며, 먼저 bind array buffer (data block buffer) 내에 insert되는
    데이타를 입력시킨 후 이것을 disk에 write하게 된다.
    conventional path load를 사용하여야 하는 경우는 다음과 같다.
    --- load 중에 table을 index를 이용하여 access하여야 하는 경우
    direct load중에는 index가 'direct load state'가 되어 사용이 불가능하다.
    --- load 중에 index를 사용하지 않고 table을 update나 insert등을 수행해야
    하는 경우
    direct load 중에는 table에 exclusive write(X) lock을 건다.
    --- SQL*NET을 통해 load를 수행해야 하는 경우
    --- clustered table에 load하여야 하는 경우
    --- index가 걸려 있는 큰 table에 적은 수의 데이타를 load하고자 할 때
    --- referential이나 check integrity가 정의되어 있는 큰 table에
    load하고자 할 때
    --- data field에 SQL function을 사용하여 load하고자 할 때
    2. direct path load의 수행 원리
    Direct Path Loads는 다음과 같은 특징들로 인하여 매우 많은 양의 데이타를
    빠른 시간에 load하고자 할 때 이용하는 것이 바람직하다.
    (1) SQL INSERT 문장을 generate하여 수행하지 않는다.
    (2) memory 내의 bind array buffer를 이용하지 않고 database block의
    format과 같은 data
    block을 memory에 만들어 데이타를 넣은 후 그대로 disk에 write한다.
    memory 내의 block buffer와 disk의 block은 그 format이 다르다.
    (3) load 시작 시에 table에 lock을 걸고 load가 끝나면 release시킨다.
    (4) table의 HWM (High Water Mark) 윗 부분의 block에 data를 load한다.
    HWM는 table에 data가 insert됨에 따라 계속 늘어나고 truncate 외에는
    줄어들게 하지 못한다.
    그러므로, 항상 완전히 빈 새로운 block을 할당받아 data를 입력시키게 된다.
    (5) instance failure가 발생하여도 redo log file을 필요로 하지 않는다.
    (6) UNDO information을 발생시키지 않는다.
    즉 rollback segment를 사용하지 않는다.
    (7) OS에서 asynchronous I/O가 가능하다면, 복수개의 buffer에 의해서 동시에
    data를 읽어서 buffer에 write하면서 buffer에서 disk로 write할 수 있다.
    (8) parallel option을 이용하면 더욱 성능을 향상시킬 수 있다.
    3. direct path load의 사용방법 및 options
    direct path load를 사용하기 위한 view들은 다음 script에 포함어 있으며,
    미리 sys user로 수행되어야 한다. 단 이 script는 catalog.sql에 포함되어 있어,
    db 구성 시에 이미 수행되어진다.
    @$ORACLE_HOME/rdbms/admin/catldr.sql
    direct path load를 사용하기 위해서는 일반적인 sqlload 명령문에 DIRECT=TRUE를
    포함시키기만 하면 된다. 다음과 같이 기술하면 된다.
    sqlload username/password control=loadtest.ctl direct=true
    이 direct path load를 사용 시에 고려할 만한 추가적인 option 및 control file
    내에 기술 가능한 clause들을 살펴본다.
    (1) ROWS = n
    conventional path load에서 rows는 default가 64이며, rows에 지정된 갯수
    만큼의 row가 load되면 commit이 발생한다. 이와 비슷하게 direct load
    path에서는 rows option을 이용하여 data save를 이루며, data save가 발생하면
    data는 기존 table에 포함되어 입력된 data를 잃지 않게 된다.
    단 이 때 direct path load는 모든 data가 load된 다음에야 index가
    구성되므로 data save가 발생하여도 index는 여전히 direct load state로
    사용하지 못하게 된다.
    direct path load에서 이 rows의 default값은 unlimited이며, 지정된 값이
    database block을 채우지 못하면 block을 완전히 채우는 값으로 올림하여,
    partial block이 생성되지 않도록 한다.
    (2) PIECED clause
    control file내에 column_spec datatype_spec PIECED 순으로 기술하는
    것으로서 direct path load에만 유효하다. LONG type과 같이 하나의 data가
    maximum buffer size보다 큰 경우 하나의 data를 여러번에 나누어 load하는
    것이다. 이 option은 table의 맨 마지막 field
    하나에만 적용가능하며, index column인 경우에는 사용할 수 없다.
    그리고 load도중 data에 문제가 있는 경우 현재 load되는 data의 잘린 부분만
    bad file에 기록되게 된다. 왜냐하면 이전 조각은 이미 datafile에 기록되어
    buffer에는 남아있지 않기 때문이다.
    (3) READBUFFERS = n (default is 4)
    만약 매우 큰 data가 마지막 field가 아니거나 index의 한 부분인 경우
    PIECED option을 사용할 수 없다. 이러한 경우 buffer size를 증가시켜야
    하는데 이것은 readbuffers option을 이용하면 된다. default buffer갯수는
    4개이며, 만약 data load중 ORA-2374(No more slots for read buffer
    queue) message가 나타나면, buffer갯수가 부족한 것이므로 늘려주도록 한다.
    단 일반적으로는 이 option을 이용하여 값을 늘린다하더라도 system
    overhead만 증가하고 performance의 향상은 기대하기 어렵다.
    4. direct path load에서의 index 처리
    direct path load에서 인덱스를 생성하는 절차는 다음과 같다.
    (1) data가 table에 load된다.
    (2) load된 data의 key 부분이 temporary segment에 copy되어 sort된다.
    (3) 기존에 존재하던 index와 (2)에 의해서 정렬된 key가 merge된다.
    (4) (3)에 의해서 새로운 index가 만들어진다.
    기존에 존재하던 index와 temporary segment, 그리고 새로 만들어지는 index가
    merge가 완전히 끝날 때까지 모두 존재한다.
    (5) old index와 temporary segment는 지워진다.
    이와 같은 절차에 반해 conventional path load는 data가 insert될 때마다 한
    row 씩 index에 첨가된다. 그러므로 temporary storage space는 필요하지 않지만
    direct path load에 비해 index 생성 시간도 느리고, index tree의 balancing도
    떨어지게 된다.
    index생성 시 필요한 temporary space는 다음과 같은 공식에 의해 예측되어질 수
    있다.
    1.3 * key_storage
    key_storage = (number_of_rows) * (10 + sum_of_column_sizes +
    number_of_columns)
    여기에서 1.3은 평균적으로 sort 시에 추가적으로 필요한 space를 위한 값이며,
    전체 data가 완전히 순서가 거꾸로 된 경우에는 2, 전체가 미리 정렬된 경우라면
    1을 적용하면 된다.
    --- SINGLEROW clause
    이와 같이 direct path load에서 index 생성 시 space를 많이 차지하는 문제점
    때문에 resource가 부족한 경우에는 SINGLEROW option을 사용할 수 있다.
    이 option은 controlfile 내에 다음과 같은 형태로 기술하며, direct path
    load에만 사용 가능하다.
    into tables table_name [sorted indexes...] singlerow
    이 option을 사용하면 전체 data가 load된 뒤에 index가 구성되는 것이 아니라
    data가 load됨에 따라 data 각각이 바로 index에 추가된다.
    이 option은 기존에 미리 index가 존재하는 경우 index를 생성하는 동안
    merge를 위해 space를 추가적으로 필요로 하는 것을 막고자 하는 것이므로
    INSERT 시에는 사용하지 않고, APPEND시에만 사용하도록 하고 있다.
    실제 새로 load할 data 보다 기존 table이 20배 이상 클 때 사용하도록 권하고
    있다.
    direct path load는 rollback information을 기록하지 않지만, 이 singlerow
    option을 사용하면 insert되는 index에 대해 undo 정보를 rollback segment에
    기록하게 된다.
    그러나, 중간에 instance failure가 발생하면 data는 data save까지는 보존
    되지만 index는 여전히 direct load state로 사용할 수 없게 된다.
    --- Direct Load State
    만약 direct path load가 성공적으로 끝나지 않으면 index는 direct load
    state로 된다.
    이 index를 통해 조회하고자 하면 다음과 같은 오류가 발생한다.
    ORA-01502 : index 'SCOTT.DEPT_PK' is in direct load state.
    index가 direct load state로 되는 원인을 구체적으로 살펴보면 다음과 같다.
    (1) index가 생성되는 과정에서 space가 부족한 경우
    (2) SORTED INDEXES clause가 사용되었으나, 실제 data는 정렬되어 있지 않은
    경우
    이러한 경우 data는 모두 load가 되고, index만이 direct load state로 된다.
    (3) index 생성 도중 instance failure가 발생한 경우
    (4) unique index가 지정되어 있는 컬럼에 중복된 data가 load되는 경우
    특정 index가 direct load state인지를 확인하는 방법은 다음과 같다.
    select index_name, status
    from user_indexes
    where table_name = TABLE_NAME';
    만약 index가 direct load state로 나타나면 그 index는 drop하고 재생성
    하여야만 사용할 수 있다. 단, direct load 중에는 모든 index가 direct
    load state로 되었다가 load가 성공적으로 끝나면 자동으로 valid로 변경된다.
    --- Pre-sorting (SORTED INDEX)
    direct load 시 index구성을 위해서 정렬하는 시간을 줄이기 위해 미리 index
    column에 대해서 data를 정렬하여 load시킬 수 있다. 이 때 control file 내에
    SORTED INDEXES option을 다음과 같이 정의한다.
    이 option은 direct path load 시에만 유효하며, 복수 개의 index에 대해서
    지정가능하다.
    into table table_name SORTED INDEXES (index_names_with_blank)
    만약, 기존의 index가 이미 존재한다면, 새로운 key를 일시적으로 저장할 만큼
    의 temporary storage가 필요하며, 기존 index가 없는 경우였다면, 이러한
    temporary space도 필요하지 않다.
    이와 같이 direct path load 시에 index 구성 시에는 기존 데이타가 있는 table에
    load하는 경우 space도 추가적으로 들고, load가 완전히 성공적으로 끝나지 않으면
    index를 재생성하여야 하므로, 일반적으로 direct path load 전에 미리 table의
    index를 제거한 후 load가 모두 끝난 후 재생성하도록 한다.
    5. Recovery
    direct load는 기존 segment중간에 data를 insert하는 것이 아니라 완전히
    새로운 block을 할당받아 정확히 write가 끝난 다음 해당 segment에 포함되기
    때문에 instance failure시에는 redo log정보를 필요로 하지 않는다. 그러나
    default로 direct load는 redo log에 입력되는 data를 기록하는데 이것은 media
    recovery를 위한 것이다. 그러므로 archive log mode가 아니면 direct load에
    생성된 redo log 정보는 불필요하게 되므로 NOARCHIVELOG mode시에는 항상
    control file내에 UNRECOVERABLE이라는 option을 사용하여 redo log에 redo entry를 기록하지 않도록 한다.
    data가 redo log 정보 없이 instance failure시에 data save까지는 보호되는데
    반해 index는 무조건 direct load state가 되어 재생성하여야 한다. 그리고 data save이후의 load하고자 하는 table에 할당되었던 extent는 load된 data가
    user에게 보여지지는 않지만 extent가 free space로 release되지는 않는다.
    6. Integrity Constraints & Triggers
    direct path load중 not null, unique, primary key constraint는 enable
    상태로 존재한다. not null은 insert시에 check되고 unique는 load후 index를
    구성하는 시점에 check된다.
    그러나 check constraint와 referential constraint는 load가 시작되면서
    disable상태로 된다. 전체 데이타가 load되고 난 후 이렇게 disable된
    constraints를 enable시키려면 control file내에 REENABLE이라는 option을
    지정하여야 한다. 이 reenable option은 각 constraint마다 지정할 수는 없으며
    control file에 한번 지정하면 전체 integrity/check constraint에 영향을
    미치게 된다. 만약 reenable되는 과정에서 constraint를 위배하는 data가
    발견되면 해당 constraint는 enable되지 못하고 disabled status로 남게 되며,
    이렇게 위배된 data를 확인하기 위해서는 reenable clause에 exceptions option을 다음과 같이 추가하면 된다.
    reenable [exceptions table_name]
    이 때 table_name은 $ORACLE_HOME/rdbms/admin/utlexcpt.sql을 다른
    directory로copy하여 table이름을 exceptions가 아닌 다른 이름으로 만들어 수행시키면 된다.
    insert trigger도 integrity/check constraint와 같이 direct load가 시작하는
    시점에 disable되며, load가 끝나면 자동으로 enable된다. 단 enable되고 나서도
    load에 의해 입력된 data에 대해 trigger가 fire되지는 않는다.

Maybe you are looking for

  • How to enter a table in FI_DOCUMNT's key_date field?

    When using archiving object FI_DOCUMNT, there is a field called key_date. My co-worker who quit the company says that a table OR functional module can be entered in that field. Actually it is true for some other fields of the same archiving object as

  • Error while pairing a resilient pair of Database Firewall

    Hello, I've downloaded and installed an Audit Vault Server and two Database Firewall 12.1.1 in three virtual machines using VMware workstation 9. I had no problem whatsoever with the installation of either of them and I was able to link both firewall

  • To sync or not to sync, that is the question

    Hi all, I've set our subscribers to use the variable DEST_VOLUME and have generally set that variable to be DATA:\ accross the country. All distributions, however, distribute to %DEST_VOLUME%\Replicated Files\<distribution> The Replicated Files direc

  • Why is adobe mad at apple?

    I don't get why adobe is mad at apple and why we can't use adobe flash player to view flash content.

  • How to get Activities in order ?

    I want to display all the activities associated with an item type to the user. I can get it from wf_activities_vl view. All these activities, I want to display in the same order, which they were defined in the process model. How can I get the order f