SERT operation, then the error is returned before the insert. ##传统路径插入是在插入过程中检查是否违反非空约束,因此,如果插入的数据违反了非空约束,那么会在插入过程中报错。直接路径插入在插入之前检查数据是否违反非空约束,因此,如果违反非空约束,那么会在插入之前报错。
How Direct-Path INSERT Works
You can use direct-path INSERT on both partitioned and nonpartitioned tables.
##可以对分区表和非分区表使用direct-path INSERT
Serial Direct-Path INSERT into Partitioned or Nonpartitioned Tables
The single process inserts data beyond the current high water mark of the table segment or of each partition segment. (Thehigh-water mark is the level at which blocks have never been formatted to receive data.) When aCOMMIT runs, the high-water mark is updated to the new value, making the data visible to users.
##使用高水位线之上的数据块进行插入,当执行commit提交以后,高水位线即被更新为新的值,使新插入的数据对用户变为可见(direct-path INSERT没有提交之前在同一个事物中,被插入的表是不能被dml,也不能被query的,否则会报ORA-12838错误。其他的会话可以查询该表,但是只能查到插入之前的数据)
Parallel Direct-Path INSERT into Partitioned Tables
This situation is analogous to serial direct-path INSERT. Each parallel execution server is assigned one or more partitions, with no more than one process working on a single partition. Each parallel execution server inserts data beyond the current high-water mark of its assigned partition segment(s). When a COMMIT runs, the high-water mark of each partition segment is updated to its new value, making the data visible to users.
##并行模式类似于串行模式。每一个并行进程被分配给一个或多个分区,但是不会出现多个程序处理一个分区的情况。
Parallel Direct-Path INSERT into Nonpartitioned Tables
Each parallel execution server allocates a new temporary segment and inserts data into that temporary segment. When aCOMMIT runs, the parallel execution coordinator merges the new temporary segments into the primary table segment, where it is visible to users.
##每一个并行进程被分配一个新的临时段并向临时段中插入数据。但执行commit时,并行执行的调度进程把这些临时段并入表所在的段中,这时数据对用户就是可见的了。
Loading Data with Direct-Path INSERT
You can load data with direct-path INSERT by using direct-path INSERT SQL statements, inserting data in parallel mode, or by using the Oracle SQL*Loader utility in direct-path mode. A direct-pathINSERT can be done in either serial or parallel mode.
##
Serial Mode Inserts with SQL Statements
You can activate direct-path INSERT in serial mode with SQL in the following ways:
##你可以使用如下方法激活直接路径加载
If you are performing an INSERT with a subquery, specify the APPEND hint in each INSERT statement, either immediately after theINSERT keyword, or immediately after the SELECT keyword in the subquery of theINSERT statement.##如果你是使用子查询的方式插入,那么在insert后加append提示
If you are performing an INSERT with the VALUES clause, specify theAPPEND_VALUES hint in each INSERT statement immediately after theINSERT keyword. Direct-path INSERT with the VALUES clause is best used when there are hundreds of thousands or millions of rows to load. The typical usage scenario is for array inserts using OCI. Another usage scenario might be inserts in a FORALL statement in PL/SQL.##如果你是使用带values从句的方式插入,那么在insert后加APPEND_VALUES提示
If you specify the APPEND hint (as opposed to the APPEND_VALUES hint) in anINSERT statement with a VALUES clause, the APPEND hint is ignored and a conventional insert is performed.
##如果你在带values从句的插入中使用的是append提示,而不是APPEND_VALUES提示,那么append提示会被忽略,执行的会是传统路径插入。
The following is an example of using the APPEND hint to perform a direct-pathINSERT:
INSERT /*+ APPEND */ INTO sales_hist SELECT * FROM sales WHERE cust_id=8890;
The following PL/SQL code fragment is an example of using the APPEND_VAL