Direct load insert  vs direct path insert vs nologging

Hello. I am trying to load data from table A(only 4 columns) to table B. Table B is new. I have 25 million records in table A. I have debating between direct load insert,, direct path insert and nologging. What is the diference between the three methods of data load? What is the best approach??

Hello,
The fastest way to move data from Table A to Table B is by using direct path insert with no-logging option turned on table B. Meaning this will be produce minimum logging and in case of DR you might not be able to recover data in table B. Now Direct path insert is equivalence of loading data from flat using direct load method. Generally using conventional method it's six phases to move your data from source (table, flat file) to target (table). But with direct path/load it will cut down to 3, and if in addition you will use PARALLEL hint on select and insert you might have faster result.
INSERT /*+ APPEND */ INTO TABLE_B SELECT * from TABLE_A;Regards
Correction to select statement
Edited by: OrionNet on Feb 19, 2009 11:28 PM

Similar Messages

  • Insert /*+ Append */ and direct-path INSERT

    Hi Guys
    Does insert /*+ Append */ into hint cause Oracle 10G to use direct-path INSERT?
    and if insert /*+ Append */ into hint does cause Oracle to use direct-path INSERT, does insert /*+ Append */ is subject to the same restrictions as direct-path such as "The target table cannot have any triggers or referential integrity constraints defined on it."
    Thanks

    Dear,
    Here below a simple example showing the effet of existing trigger on the append hint
    mhouri@mhouri> select * from v$version where rownum=1;
    BANNER                                                                         
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production         
    mhouri@mhouri> create table b as select * from all_objects where 1 = 2;
    Table créée.
    mhouri@mhouri> insert /*+ append */ into b
      2  select * from all_objects;
    70986 ligne(s) créée(s).
    mhouri@mhouri> select * from b;
    select * from b
    ERREUR à la ligne 1 :
    ORA-12838: impossible de lire/modifier un objet après modification en parallèle
    mhouri@mhouri> rollback;
    Annulation (rollback) effectuée.The direct path took place as far as I can't select from the table before I commit
    mhouri@mhouri> create trigger b_trg before insert on b
      2  for each row
      3  begin
      4  null;
      5  end;
      6  /
    Déclencheur créé.
    mhouri@mhouri> insert /*+ append */ into b
      2  select * from all_objects;
    70987 ligne(s) créée(s).
    424 ligne(s) sélectionnée(s).
    mhouri@mhouri> select count(1) from b;
      COUNT(1)                                                                     
         70987                                                                      While in the presence of this trigger on the table, the append hint has been silently ignored by Oracle. The fact that I can select from the table immediately afte the insert has finished is the indication that the table has not be inserted using direct path load
    Best Regards
    Mohamed Houri

  • Direct path insert

    Hi Friends,
    If i used direct path insert from a (LAN) remote table with 5 million rows using:
    sql> insert /*+ append */ into EMP using select * from EMP@dblink1;
    1) Do i need to create big rollback segment?
    *Note that in direct path sqlloader, no big rollback is needed.
    2.) Can i still undo it or rollback it the 5 millions rows?
    If i can then it sure holds or need a big rollback segment.
    Thanks a lot
    Message was edited by:
    [email protected]

    From same link see below points from Tom
    b) a direct path load always loads above the high water mark, since it is formatting and writing blocks directly to disk - it cannot reuse any existing space. Think about this - if you direct pathed an insert of a 100 byte row that loaded say just two rows - and you did that 1,000 times, you would be using at least 1,000 blocks (never reuse any existing space) - each with two rows. Now, if you did that using a conventional path insert - you would get about 70/80 rows per block in an 8k block database. You would use about 15 blocks. Which would you prefer?+
    c) you cannot query a table after direct pathing into it until you commit.+
    See point c. So, this will mark block header transaction flag to commit. if you rollback as they are written above HWM and since there is no commit flag yet it just need to set table HWM to original one and that's it.

  • Direct Path Insert on Forms

    Hi,
    I am using following insert statement on my forms application to do direct path insert.
    insert into /*+append*/ abc select * from xyz;
    as redo is not generated if you do direct path insert but in above case redo is generating for the above insert statement.
    I then created a procedure test_insert as below
    create procedure test_insert is
    begin
    insert into /*+append*/ abc select * from xyz;
    end;
    i then replaced the insert statement with above procedure on form and after that redo for the insert statement stopped.
    i was wondering if we could use append hint for direct path insert on forms?

    My point, though, is that if you're doing your hourly load into a separate table and building the index(es) on that table before moving the partition into the partitioned table, there is no risk of doing anything to screw up the partitioned table. It's also a very handy way to ensure that your load process doesn't interfere with your production data.
    If i have understood your point right, what about the space required ( tablespaces and the indexes). Trust me, my table at source gets populated @ over 230 MIL records /day. If i have a temp table, i will have to maintain hourly partitions/indexes/tablespaces for the temp table to hold so much data, isn't it? And, the data i move (say today's data) will be used by the user only after 4 days (because it is available in the source). We have provisioned our user interface to connect to 2 databases, one with 5 days of data (incl. sysdate) and the other one is a archive DB that holds 45 days worth of data.
    </>
    I wouldn't expect that a direct path load into a single partition of a partitioned table would invalidate local indexes on other partitions, but since I'd never do a direct path load into a single partition of a partitioned table, I've not tested this to make sure.
    No problem, if i try this out i will share it in the forum. </>Thanks

  • How can I tell if direct-path insert is really being used?

    I have a number of INSERT statements with /*+ APPEND */ hints, that I suspect are not using direct-path insert processing. How can I tell (via the plan, via Enterprise Manager, whatever) if direct-path is being used?
    If it is not being used, then I can research why that might be, and try to resolve the obstacles there. But if it is being used, then I want to know that so I can focus elsewhere.
    Thanks,
    Mike

    mtefft wrote:
    The question of whether direct-path is possible with multi-table inserts has been on my mind...
    Moreover, in another forum post, we have eyewitnesses that it has happened at least once:
    APPEND Hint in Multi-table insert
    So I think that post (giving examples of Explain plans with multi-table inserts successfully using direct-path) answers my question.
    Mike,
    Thanks for that link. When I checked my example again I realised that it had a foreign key constraint between the two tables I was inserting into. (It was a demonstration of how to normalise an incoming denormalised address table, so converted a flat table into address/address lines). When I removed the constraint I got the multi-table insert.
    However, I followed this up with a check on the execution plans and for the 10.2.0.3 I was running noted the following:
    Plan reported after running the insert and select from dbms_xplan.display_cursor()
    | Id  | Operation           | Name | Rows  | Bytes | Cost  |
    |   0 | INSERT STATEMENT    |      |       |       |    30 |
    |   1 |  MULTI-TABLE INSERT |      |       |       |       |
    |   2 |   TABLE ACCESS FULL | T3   | 10000 |  1240K|    30 |
    ------------------------------------------------------------Plan reported after explain plan / select from dbms_xplan.display()
    | Id  | Operation           | Name | Rows  | Bytes | Cost  |
    |   0 | INSERT STATEMENT    |      | 10000 |  1240K|    30 |
    |   1 |  MULTI-TABLE INSERT |      |       |       |       |
    |   2 |   DIRECT LOAD INTO  | T1   |       |       |       |
    |   3 |   DIRECT LOAD INTO  | T2   |       |       |       |
    |   4 |    TABLE ACCESS FULL| T3   | 10000 |  1240K|    30 |
    ------------------------------------------------------------If you try to check for direct path inserts by looking at the in-memory plans, you might not see the direct load that is really happening. (Perhaps the a check that both / all the target tables are locked with TM mode 6 may give you a clue.)
    Regards
    Jonathan Lewis

  • SQL Loader- Default value is not inserted in table by direct method

    Hi All,
    I am trying to load data from a file to a table by SQL Loader. There is a particular date column which I am not loading from the File but have used a Default constraint to put SYSDATE in it. When I am using direct method load then it is not inserting nothin in this column but in conventional method it is inserting SYSDATE. But I want to do the load by direct method. Can anybody provide me a solution as how to load default value in direct method?
    Thanks & regards.
    Sudipta

    For this special case, you can specify:
    column_name SYSDATE
    in your SQL*Loader control file.

  • Direct Path Inserts = By DBWR or by Shadow Process

    Hello guys,
    if i use the append hint (direct path inserts) - which process is writting the data to the datafile?
    In the documentation of oracle:
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96524/c21dlins.htm#10778
    Oracle appends the inserted data after existing data in the table. Data is written directly into datafiles, bypassing the buffer cache Ok that is clear - but who is writing down the data? The shadow process which is handling the insert statement or is it given to the dbwr and it flushes the data directly to the datatfile without putting it into the buffer cache.
    And another question regarding direct path inserts:
    http://sai-oracle.blogspot.com/2006/03/parallel-query-is-it-good-or-bad.html
    If you want to do direct path insert in parallel, you would block all other non direct path insert operations on that table. This is because direct path insert would append above highwater mark, and no other process is allowed to update HWM until your operation is doneIf i insert data in serial with direct path insert... i also write data behind the High-HWM .. why is it only locked in parallel mode?
    And why does oracle not check if there is enough space in some other blocks below the High-HWM and using these blocks for "normal" inserts?
    Regards
    Stefan

    It's the server process that's responsible for writing direct path blocks to disk.
    DBWR only ever flushes out of the buffer cache.
    You do NOT write "data behind the HWM" in direct path mode, ever. Direct path works so fast because all you do is slam whole blocks of data onto disk ABOVE the high water mark. You can slam whole blocks down without worrying about what you're over-writing precisely because the blocks are above the HWM and thus cannot possibly be in use by anyone for anything. Under the HWM and you have to start worrying about locking and contention and stuff like that.
    Parallel operations (or simultaneous serial operations by two different users) inevitably have to block each other for this sort of thing: if I am busy writing to blocks above the HWM, great. But if you want to do it too... well, what's to stop us from over-writing each other's blocks?! Nothing, actually. So Oracle simply has to lock the entire table from any other direct path operation to make the situation manageable.

  • Forcing DIRECT PATH INSERT to go CONVENTIONAL.

    According to Oracle, to force a statement to avoid using DIRECT-PATH insert it must fall into the following:
    Direct-path INSERT is subject to a number of restrictions. If any of these restrictions is violated, then Oracle Database executes conventional INSERT serially without returning any message, unless otherwise noted:
        *     You can have multiple direct-path INSERT statements in a single transaction, with or without other DML statements. However, after one DML statement alters a particular table, partition, or index, no other DML statement in the transaction can access that table, partition, or index.
        *      Queries that access the same table, partition, or index are allowed before the direct-path INSERT statement, but not after it.
        *      If any serial or parallel statement attempts to access a table that has already been modified by a direct-path INSERT in the same transaction, then the database returns an error and rejects the statement.
        *      The target table cannot be part of a cluster.
        *      The target table cannot contain object type columns.
        *      Direct-path INSERT is not supported for an index-organized table (IOT) if it is not partitioned, if it has a mapping table, or if it is reference by a materialized view.
        *      Direct-path INSERT into a single partition of an index-organized table (IOT), or into a partitioned IOT with only one partition, will be done serially, even if the IOT was created in parallel mode or you specify the APPEND hint. However, direct-path INSERT operations into a partitioned IOT will honor parallel mode as long as the partition-extended name is not used and the IOT has more than one partition.
        *      The target table cannot have any triggers or referential integrity constraints defined on it.
        *      The target table cannot be replicated.
        *      A transaction containing a direct-path INSERT statement cannot be or become distributed.Are there any others that are not documented here? We have a vendor based app and want to avoid the DIRECT PATH INSERT and have it go CONVENTIONAL. We tried the TRIGGER approach, but that did not help at all.

    Why are you wanting to force conventional ?
    Are you sure the application uses direct path ?

  • Archive log / nologging/ direct path insert

    Could you please confirm if following are true or correct me if my understanding is wrong:
    1 ) Archive log mode and LOGGING is needed to deal with media recovery; it was not needed for instance recovery.
    2) IF insert is in NO APPEND mode , redo is generated even if table is in nologging mode and database is in noachive log mode. This redo is needed for instance recovery.
    3) Direct path insert skips undo generation and may skip redo generation if the object is in nologging mode.
    Thanks.
    In case if it is relevant , I am using Oracle 11.2.0.3.

    1) Yes, Archive logs are needed for media recovery.
    2 and 3) Even if the table is in nologging mode , it generates little bit of redo for index maintenance and dictionary data. Upon a restart from a failure - Oracle will read the online redo logs and replay any transaction it finds in there. That is the "roll forward" bit. The binary redo information is used to replay everything that did not get written to the datafiles. This replay included regenerating the UNDO information (UNDO is protected by redo).
    After the redo has been applied, the database is typically available for use now - and the rollback phase begins. For any transaction that was being processed when the instance failed - we need to undo its changes, roll it back. We do that by processing the undo for all uncommitted transactions.
    The database is now fully recovered.
    Also read he following link
    http://docs.oracle.com/cd/B19306_01/server.102/b14220/startup.htm
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:5280714813869

  • Direct path read caused by direct path insert?

    Oracle 9.2
    ========
    Consider this INSERT statement
    INSERT /*+ APPEND USE_HASH*/ INTO schema.tablename (...)
    SELECT * FROM view_tablename;
    This statement takes about 30 minutes to complete.
    If I look at the v$session_wait, I can see that the session waits denoting db file scattered read (which is understandable). However, at the very end of the 30-minute wait, the v$session_wait view shows that it is waiting denoting direct path read. I want to understand how can a direct path INSERT (or for that matter a simple INSERT statement) can cause a direct path read wait. Can you show me some doc which expalain this in more detail than Oracle doc? Thanks in advance.

    Hmm....ok, well,first, there's a problem w/ the hint specification.
    The USE_HASH hint makes no sense as a hint to the insert statement. It only makes sense in the context of a select statement. Also, it should specify a table alias. So, you could have something like:
    insert /*+ APPEND */.into some_tab
    select /*+ use_hash(tab_alias) */ col1,col2,col3 from .....
    Now, as to the question of direct path read:
    The direct path read event indicates a disk sort. So, it's likely the source of the direct path read wait was due to sorting in the processing of the select statement. I can't imagine how the insert would cause direct path read.
    Hope that helps,
    -Mark

  • Nologging direct-path insert into an indexed table

    Hello,
    Does anyone have an idea how I can suppress generation of undo logs for direct-path insert into an indexed table on 11.2.0.1.0:
    CREATE TABLE TBL(ID NUMBER) NOLOGGING;
    CREATE INDEX IDX ON TBL(ID) NOLOGGING;
    INSERT /*+ APPEND */ INTO TBL SELECT /*+ APPEND */ ROWNUM FROM ...; -- Source table has 400,000,000+ rows
    Regards,
    Angel Tsankov

    Pl do not post duplicates - Why does Oracle not use direct-path insert when instructed to do so - pl continue the discussion in your original thread

  • Direct load insert internals

    Hi,
    I usually posts threads regarding the internals of oracle. today the topic is direct load inserts.
    Here is the mains concept
    in direct load insert oracle by pass the buffer cache and inserts in directly into the data file. By by passing the buffer cache oracle avoid redo log generation and other over head. oracle builds a block in the memory and inserts it into the data file above the high water mark.
    here are the questions
    where does oracle builds the data block in memory is it in server process PGA.
    does oracle builds more than one data blocks
    does increasing the size of PGA memory can have any effect on direct load inserts.
    if oracle by pass buffer cache than rollback segament are still generated. What its mechanism under direct load inserts
    regards
    Nick

    Nick Naughty wrote:
    from above document. it seems that oracle streams and array size play an important role in performance but the above document is regarding sql loader what about this statementFor SQL Loader...only
    insert /*+ append */ into dest_table
    select * from source_table;
    here we could not set oracle stream or array size a mentioned in above document. kindly elobrate with respect to above statement. Does not apply.
    Perhaps you could explain what you are trying to do, or add some context of the problem. This would aid with responses.
    Regards,
    Greg Rahn
    http://structureddata.org

  • Direct-Load INSERT

    Can I use two select statement in Direct-Load INSERT;
    I have one table test with
    NO NUMBER
    NAME VARCHAR2(20)
    Columns
    I would like insert in no column by SEQUENCE & one from another
    table.
    Can anybody tell me HOW?
    Regards, Chaitanya

    If you do not really care what the sequence is, you can do
    something like
    INSERT INTO table1 (numbercol,othercol)
    SELECT rownum,othercol2
    FROM table2;

  • Direct Load Insert problem

    Hello,
    we want to make bulk insert in C++ faster by avoiding generating redo logs. I plan to use Direct Load Insert. The problem is, DLI works only on insert /*+ APPEND */ into .. select ... but not with 'values' clause. To get rid of this, I want to bulk insert the rows into a temporary table, and than, at the end of the transaction, issue an insert /*+ APPEND */ into target_tab select * from temp_tab. After truncate temp_tab, I commit the transaction.
    I know, REDO will be generated on the UNDO, but inserts generate only very low UNDO. By the way, can I avoid generating UNDO for temp tables?
    What do you think about this? Any oppinion? Will it be really faster? Do you have any other idea?
    Thank you,
    Balazs

    There is no hint call "NOLOGGING".So /*+ APPEND NOLOGGING */ will be ignored in your case.You may be better performance ,if you do it this way..
    1) Create temp_tab with required columns matching target table. using CTAS method.
    Create table temp_tab
    tablespace &lt;TS_name&gt;
    storage( ..................)
    PCTFREE 0
    NOLOGGING
    as
    select /*+ PARALLE(a,4) */ col1,col2,col3.....
    from soruce_table a;
    Comments: Above operation will be with NO REDO and NO UNDO. I used PCTFREE 0 to pack as many rows in the block,so that it helps in querying the temp_tab table in next steps.
    2) Load the data into target table .Using parallel direct load , instead of serial-Direct load ( /*+ APPEND */ )
    sql &gt; alter session enable parallel dml;
    sql &gt; INSERT /*+ PARALLEL(a,4) */ INTO target_table a
    SELECT /*+ PARALLEL(b,4) */ from temp_tab b;
    sql&gt;commit;
    To give to some benchmarks , a 14 GB table is loaded with above method within 9 minutes on 12cpus busy unixbox.
    Note : Check the other effect of parallel direct load in 8i concept

  • Direct-load Insert. ORA-00907: missing right parenthesis

    Hi All,
    i created one dummy table with two character columns
    im trying to insert values like this.
    insert into dummy select ('x','y') from dual;
    the error is
    ERROR at line 1:
    ORA-00907: missing right parenthesis
    Thanks in advance

    SQL> insert into dummy1 select 'x','y' from dual;
    1 row created.
    SQL> select * from dummy1;
    COL1 COL2
    x y
    Regards,
    Sanju

Maybe you are looking for

  • Remove Duplicate Rows in Numbers 09

    Is there a way to remove duplicate rows in Numbers 09? For example I have 2 Tables and the values of Column A are mainly the same, but there are definitely a few dozen unique values in 1 table which are not in table 2 and visa versa. I'd like to make

  • What is Business Transaction in CRM

    Hi, What is Business Transaction in CRM? What is deifference between partner and partner_guid? What is significance? and also product, prodcut_guid? Thanks, Shashikanth

  • Weblogic generates incorrect WSDL when policy is applied

    Hello all! Please help. It looks like a bug. I have and WebLogic 10.3.3 instance and some JAX-WS services. It works fine till I turn on WS-Security. Weblogic generates a non-standard WSDL when I apply any Policy for any webservice. So, look an exampl

  • Shuffle appears for a few second and then it's gone! (itune 7.3)

    Can't access my Shuffle since last night! (right after the software update for sound). My shuffle mount on the desktop for a few second than disappears, it is available in Itune under devices but you can't copied or erased anything on it. I have trie

  • Gsmartcontrol polkit problem: Not asking for password anymore [solved]

    polkit 0.112-2 polkit-gnome 0.105-2 gsmartcontrol 0.8.7-4 DE: LXDE When trying to use gsmartcontrol as normal user it does not ask for permission anymore but starts and the drives are shown as 'unknown model' now. The polkit-gnome-authentication is a