Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Semestr2 / 1 - Oracle / Oracle selected docs / Database concepts.pdf
Скачиваний:
29
Добавлен:
12.05.2015
Размер:
6.96 Mб
Скачать

19

Direct-Path INSERT

This chapter describes the Oracle direct-path INSERT feature for serial or parallel inserts. It also describes the NOLOGGING feature available for direct-path INSERT and some DDL statements. This chapter’s topics include:

Introduction to Direct-Path INSERT

Advantages of Direct-Path INSERT

Serial and Parallel Direct-Path INSERT

Direct-Path INSERT Into Partitioned and Nonpartitioned Tables

Direct-Path INSERT and Logging Mode

Additional Considerations for Direct-Path INSERT

Note: The parallel direct-path INSERT feature described in this chapter is available only if you have purchased the Oracle9i Enterprise Edition. See Oracle9i Database New Features for more information.

See Also:

Chapter 18, "Parallel Execution of SQL Statements" for more information about parallel execution INSERT issues

Oracle9i Data Warehousing Guide

Direct-Path INSERT 19-1

Introduction to Direct-Path INSERT

Introduction to Direct-Path INSERT

Oracle inserts data into a table in one of two ways:

During conventional insert operations, Oracle reuses free space in the table, interleaving newly inserted data with existing data. During such operations, Oracle also maintains referential integrity constraints.

During direct-path INSERT operations, Oracle appends the inserted data after existing data in the table. Data is written directly into datafiles, bypassing the buffer cache. Free space in the existing data is not reused, and referential integrity constraints are ignored. These procedures combined can enhance performance.

You can implement direct-path INSERT operations by using direct-path INSERT statements or by using Oracle’s direct-path loader utility, SQL*Loader. This section discusses direct-path INSERT.

See Also:

Oracle9i Database Utilities for information on direct-path load and SQL*Loader

Oracle9i SQL Reference for a list of direct-path INSERT restrictions

Advantages of Direct-Path INSERT

The following are performance benefits of direct-path INSERT:

During direct-path INSERT, you can disable the logging of redo and undo entries. Conventional insert operations, in contrast, must always log such entries, because those operations reuse free space and maintain referential integrity.

To create a new table with data from an existing table, you have the choice of creating the new table and then inserting into it, or executing a CREATE TABLE

... AS SELECT statement. By creating the table and then using direct-path INSERT operations, you update any indexes defined on the target table during the insert operation. The table resulting from a CREATE TABLE ... AS SELECT statement, in contrast, does not have any indexes defined on it; you must define them later.

19-2 Oracle9i Database Concepts

Serial and Parallel Direct-Path INSERT

Direct-path INSERT operations ensure atomicity of the transaction, even when run in parallel mode. Atomicity cannot be guaranteed during parallel direct-path loads (using SQL*Loader).

If errors occur during parallel direct-path loads, some indexes could be marked UNUSABLE at the end of the load. Parallel direct-path INSERT, in contrast, rolls back the statement if errors occur during index update.

Serial and Parallel Direct-Path INSERT

When you are inserting in parallel DML mode, direct-path INSERT is the default. In order to run in parallel DML mode, the following requirements must be met:

You must have Oracle Enterprise Edition installed.

You must enable parallel DML in your session. To do this, run the following statement:

ALTER SESSION { ENABLE | FORCE } PARALLEL DML;

You must specify the parallel attribute for the target table, either at create time or subsequently, or you must specify the PARALLEL hint for each insert operation.

To disable direct-path INSERT, specify the NOAPPEND hint in each INSERT statement. Doing so overrides parallel DML mode.

See Also: Oracle9i Database Performance Tuning Guide and Reference for more information on using hints

When you are inserting in serial mode, you must activate direct-path INSERT by specifying the APPEND hint in each insert statement, either immediately after the INSERT keyword, or immediately after the SELECT keyword in the subquery of the INSERT statement.

Note: Direct-path INSERT supports only the subquery syntax of the INSERT statement, not the VALUES clause. For more information on the subquery syntax of INSERT statements, see

Oracle9i SQL Reference.

Direct-Path INSERT 19-3

Соседние файлы в папке Oracle selected docs