| Introduction to the Data Pump Architecture |
Using Export and Import Data Pump utilities you can:
Note : the export Data Pump user process launches a server-side process that writes data to disks on the server node, not the client that launches the utility.
Note: The new Data Pump technology lets you export data only to disk. You cannot use a tape drive when performing a Data Pump export.
Data Pump Components
Data-Access Methods
Data Pump automatically selects the most appropriate access method for each table. It always tries to first use the direct-path method. Under some conditions, such as the following, it may not able to use the direct method:
Note: The datafile format is identical in external tables and the direct-access methods.
Data Pump Files
Using Directory Objects
You can’t use absolute directory path location for Data Pump jobs; you must always use a directory object.
To create a directory, a user must have the CREATE ANY DIRECTORY privilege:
CREATE DIRECTORY dpump_dir1 as 'c:\oracle\product\10.1.0\oradata\export'
In order for a user to use a specific directory, the user must have access privileges to the directory object:
GRANT READ, WRITE ON DIRECTORY dpump_dir1 TO salapati
Note: In Oracle 10g Release 2, a directory object named DATA_PUMP_DIR as created by default in the database. In Windows, it is mapped to <ORACLE_BASE>\admin\<sid>\dpdump\ directory. By default, it is available only to privileged users.
expdp LOGFILE=dpump_dir2:salapati.log ...
You can use the DIRECTORY parameter to specify the name of the directory object:
expdp hr/hr DIRECTORY=dpump_dir1 ...
You can create a default directory with the name DATA_PUMP_DIR, and then not need to specify the DIRECTORY parameter in your export and import commands. Data Pump will write all dump files, SQL files, and log files automatically to the directory specified for DATA_DUMP_DIR.
You can use the DATA_DUMP_DIR environment variable on the client to point to the directory object on the server. Data Pump will automatically read and/or write its files from that directory object. In Windows, this variable is set in the Registry.
Order of Precedence for File Locations
As in the order indicated above.
The Mechanics of a Data Pump Job
The Master Process
The master process, or more accurately, the Master Control Process (MCP), has a process name of DMnn. The full master process name is of the format <instance>_DMnn_<pid>
The master process performs the following tasks:
Oracle creates the master table in the schema of the user who is running the Data Pump job at the beginning of every export job. The master table has the same name as the export job, such as SYS_EXPORT_SCHEMA_01. Master table will be automatically deleted by end of a successful export or import job.
Note: The master table contains all the necessary information to restart a stopped job. It is thus the key to Data Pump’s job restart capability, whether the job stoppage is planned or unplanned.
The Worker Process
The worker process is the process that actually performs the heavy-duty work of loading and unloading data, and has the name DWnn (<instance>_DWnn_<pid>).
MCP(DMnn) may create number of DWnn, if you choose the PARALLEL option for load. DWnn process maintains the object rows of the master table.
Shadow Process
The shadow process creates the job consisting of the master table as well as the master process.
Client Processes
The client processes call the Data Pump’s API. You perform export and import with the two clients, expdp and impdp.
| Using Data Pump Export and Import |
Data Pump Export Interfaces
Using the Command Line
expdp system/manager directory=dpump_dir1 dumpfile=expdat1.dmp
Using a Parameter File
expdp parfile=myfile.txt
Using Interactive-command Data Pump Export
In Data Pump export, you use the interactive-command interface for one purpose only: when you decide you need to change some export parameters midstream, while the job is still running. Note that the export or import job keeps running throughout, without any interruption.
This mode is enabled by pressing [Ctrl] + [C] during an export operation started with the command-line interface or the parameter file interface.
Using EM Database Control
Start the Database Control and go to the Maintenance | Utilities page.
Data Pump Export Modes
Data Pump Export Parameters
File- and Directory-Related Parameters
DIRECTORY
specifies the location of the dump and other files.
DUMPFILE
provides the name of the dump file to which the export dump should be written.
You can provide multiple dump filenames in several ways:
FILESIZE
this optional parameter specifies size of export file. The export job will stop if your dump file reaches its size limit.
PARFILE
used to specify the parameter file. Every parameter should be in a line.
Note: The directory object is not used by this parameter. The directory path is an operating system-specific directory specification. The default is the user's current directory.
LOGFILE and NOLOGFILE
You can use the LOGFLE parameter to specify a log file for your export jobs. If you don’t specify this parameter, Oracle will create a log file named export.log. If you specify the parameter NOLOGFILE, Oracle will not create its log file.
Export Mode-Related Parameters
The export mode-related parameters are the FULL, SCHEMAS, TABLES, TABLESPACES, TRANSPORT_TABLESPACES, and TRANSPORT_FULL_CHECK parameters. The TRANSPORT_FULL_CHECK parameter simply checks to make sure that the tablespaces you are trying to transport meet all the conditions to qualify for the job.
Export Filtering Parameters
CONTENT
It controls contents of exported data. The possible values are:
EXCLUDE and INCLUDE
Those are mutually exclusive parameters. The EXCLUDE parameter is used to omit specific database object types from an export or import operation. The INCLUDE parameter enables you to include only a specific set of objects.
The syntaxes of using them are as follows:
EXCLUDE=object_type[:name_clause]
INCLUDE=object_type[:name_clause]
Examples:
EXCLUDE=INDEX
EXCLUDE=TABLE:"LIKE 'EMP%'"
EXCLUDE=SCHEMA:"='HR'"
INCLUDE=TABLE:"IN ('EMP', 'DEPT')"
QUERY
This parameter lets you selectively export table row data with the help of a SQL statement.
QUERY=OE.ORDERS: "WHERE order_id > 100000"
Estimation Parameters
ESTIMATE
The ESTIMATE parameter will tell you how much space your new export job is going to consume.
By default, Oracle will used the blocks method to do its estimation.
Total estimation using BLOCKS method: 654 KB
When you set ESTIMATE=statistics, Oracle will use the statistics of the database objects to calculate its estimation.
Total estimation using STATISTICS method: 65.72 KB
ESTIMATE_ONLY
Use this parameter to estimate the required export file size without starting an actual export job.
The Network Link Parameter
NETWORK_LINK
You can initiate an export job from your server and have Data Pump export data from a remote database to dump files located on the instance from which you initiate the Data Pump export job.
expdp hr/hr DIRECTORY=dpump_dir1 NETWORK_LINK=source_database_link DUMPFILE=network_export.dmp
Interactive Mode Export Parameters
You can enter the interactive mode of Data Pump export in either of two ways:
expdp salapati/sammyy1 attach=SALAPATI.SYS_EXPORT_SCHEMA_01
You must be a DBA, or must have EXP_FULL_DATABASE or IMP_FULL_DATABASE roles, in order to attach and control Data Pump jobs of other users.
CONTINUE_CLIENT (interactive parameter)
This parameter will take you out of the interactive mode. Your client connection will still be intact, and you’ll continue to see the export messages on your screen.
EXIT_CLIENT (interactive parameter)
This parameter will stop the interactive session, as well as terminate the client session.
STOP_JOB (interactive parameter)
This parameter stops running Data Pump jobs.
START_JOB (interactive parameter)
This parameter resumes stopped jobs. You can restart any job that is stopped, whether it’s stopped because you issued a STOP_JOB command or due to a system crash, as long as you have access to the master table and an uncorrupted dump file set.
KILL_JOB (interactive parameter)
This parameter kills both the client and the Data Pump. If a job is killed using the KILL_JOB interactive command, the master table is dropped and the job cannot be restarted.
ADD_FILE (interactive parameter)
Use this parameter to add a dump file to your job.
expdp> ADD_FILE=hr2.dmp, dpump_dir2:hr3.dmp
HELP (can be used in interactive mode)
Displays online help.
STATUS (can be used in interactive mode)
This parameter displays detailed status of the job, along with a description of the current operation. An estimated completion percentage for the job is also returned.
In logging mode, you can assign an integer value (n) to this parameter. In this case, job status is displayed on screen every n second.
JOBNAME
Use this parameter to provide your own job name for a given Data Pump export/import job. If not provided, Oracle will give it a name of the format <USER>_<OPERATION>_<MODE>_%N.
Example: SYSTEM_EXPORT_FULL_01
PARALLEL
This parameter lets you specify more than a single active execution thread for your export job. You should specify number of dump files equal to the PARALLEL value.
expdp system/manager full=y
parallel=4
dumpfile=
DIR1:full1%U.dat,
DIR2:full2%U.dat,
DIR3:full3%U.dat,
DIR4:full4%U.dat
filesize = 2G
impdp system/manager
directory = MYDIR
parallel = 4
dumpfile = full1%U.dat,full2%U.dat,
full3%U.dat,full4%U.dat
Dumpfile Compression Parameter
COMPRESSION =(METADATA_ONLY | NONE)
This parameter applies from Oracle 10.2. It specifies whether to compress metadata before writing to the dump file set. Compression reduces the amount of disk space consumed by dump files.
Data Pump Import Parameters
You’ll need the IMPORT_FULL_DATABASE role to perform an import if the dump file for the import was created using the EXPORT_FULL_DATABASE role.
File- and Directory-Related Parameters
The Data Pump import utility uses the PARFILE, DIRECTORY, DUMPFILE, LOGFILE, and NOLOGFILE commands in the same way as the Data Pump export utility.
SQLFILE
This parameter enables you to extract the DDL from the export dump file, without importing any data.
impdp salapati/sammyy1 DIRECTORY=dpump_dir1 DUMPFILE=finance.dmp SQLFILE=dpump_dir2:finance.sql
REUSE_DATAFILES
This parameter tells Data Pump whether it should use existing datafiles for creating tablespaces during an import.
Import Mode-Related Parameters
You can perform a Data Pump import in various modes, using the TABLE, SCHEMAS, TABLESPACES, and FULL parameters, just as in the case of the Data Pump export utility.
Filtering Parameters
The Data Pump import utility uses the CONTENT, EXCLUDE and INCLUDE parameters in the same way as the Data Pump export utility. If you use the CONTENT=DATA_ONLY option, you cannot use either the EXCLUDE or INCLUDE parameter during an import.
QUERY can also be used but in this case Data Pump will use only the external table data method, rather than the direct-path method, to access the data.
TABLE_EXISTS_ACTION
Use this parameter to tell Data Pump what to do when a table already exists.
Job-Related Parameters
The JOB_NAME, STATUS, and PARALLEL parameters carry identical meanings as their Data Pump export counterparts.
Import Mode-Related Parameters
You can perform a Data Pump import in various modes, using the TABLES, SCHEMAS, TABLESPACES, and FULL parameters, just as in the case of the Data Pump export utility.
Remapping Parameters
REMAP_SCHEMA
Using this parameter, you can move objects from one schema to another.
impdp system/manager dumpfile=newdump.dmp REMAP_SCHEMA=hr:oe
REMAP_DATAFILE
Changes the name of the source datafile to the target datafile name in all SQL statements where the source datafile is referenced: CREATE TABLESPACE, CREATE LIBRARY, and CREATE DIRECTORY.
Remapping datafiles is useful when you move databases between platforms that have different file naming conventions.
impdp hr/hr FULL=y DIRECTORY=dpump_dir1 DUMPFILE=db_full.dmp REMAP_DATAFILE='DB1$:[HRDATA.PAYROLL]tbs6.f':'/db1/hrdata/payroll/tbs6.f'
REMAP_TABLESPACE
This parameter enables you to move objects from one tablespace into a different tablespace during an import.
impdp hr/hr REMAP_TABLESPACE='example_tbs':'new_tbs' DIRECTORY=dpump_dir1 PARALLEL=2 JOB_NAME=cf1n02 DUMPFILE=employees.dmp NOLOGFILE=Y
The Network Link Parameter
NETWORK_LINK
In case of network import, the server contacts the remote source database referenced by the parameter value, retrieves the data, and writes it directly back to the target database. There are no dump files involved.
impdp hr/hr TABLES=employees DIRECTORY=dpump_dir1 NETWORK_LINK=source_database_link EXCLUDE=CONSTRAINT
The log file is written to dpump_dir1, specified on the DIRECTORY parameter.
The TRANSFORM Parameter
TRANSFORM
This parameter instructs the Data Pump import job to modify the storage attributes of the DDL that creates the objects during the import job.
TRANSFORM = transform_name:value[:object_type]
transform_name: takes one of the following values:
SEGMENT_ATTRIBUTES
If the value is specified as y, then segment attributes (physical attributes, storage attributes, tablespaces, and logging) are included, with appropriate DDL. The default is y.
STORAGE
If the value is specified as y, the storage clauses are included, with appropriate DDL. The default is y. This parameter is ignored if SEGMENT_ATTRIBUTES=n.
OID
If the value is specified as n, the assignment of the exported OID during the creation of object tables and types is inhibited. Instead, a new OID is assigned. This can be useful for cloning schemas, but does not affect referenced objects. The default is y.
PCTSPACE
It accepts a greater-than-zero number. It represents the percentage multiplier used to alter extent allocations and the size of data files.
object_type: It can take one of the following values: CLUSTER,CONSTRAINT,INC_TYPE,INDEX,ROLLBACK_SEGMENT,TABLE,TABLESPACE,TYPE
impdp hr/hr TABLES=employees \
DIRECTORY=dp_dir DUMPFILE=hr_emp.dmp \
TRANSFORM=SEGMENT_ATTRIBUTES:n:table
impdp hr/hr TABLES=employees \
DIRECTORY=dp_dir DUMPFILE=hr_emp.dmp \
TRANSFORM=STORAGE:n:table
| Monitoring a Data Pump Job |
Viewing Data Pump Jobs
The DBA_DATAPUMP_JOBS view shows summary information of all currently running Data Pump jobs.
OWNER_NAME : User that initiated the job
JOB_NAME : Name of the job
OPERATION : Type of operation being performed
JOB_MODE : FULL, TABLE, SCHEMA, or TABLESPACE
STATE : UNDEFINED, DEFINING, EXECUTING, and NOT RUNNING.
DEGREE : Number of worker processes performing the operation
ATTACHED_SESSIONS : Number of sessions attached to the job.
Viewing Data Pump Sessions
The DBA_DATAPUMP_SESSIONS view identifies the user sessions currently attached to a Data Pump export or import job.
JOB_NAME : Name of the job
SADDR : Address of the session attached to the job.
Viewing Data Pump Job Progress
Use V$SESSION_LONGOPS to monitor the progress of an export/import job.
TOTALWORK : shows the total estimated number of megabytes in the job.
SOFAR : megabytes transferred thus far in the job.
UNITS : stands for megabytes.
OPNAME : shows the Data Pump job name.
| Creating External Tables for Data Population |
Features of External Table Population Operations
Creating External Tables
CREATE OR REPLACE DIRECTORY employee_data AS 'C:\employee_data'
CREATE TABLE employee_ext
(empid NUMBER(8),
emp_name VARCHAR2(30),
dept_name VARCHAR2(20),
hire_date date)
ORGANIZATION EXTERNAL
(TYPE ORACLE_LOADER -- or ORACLE_DATAPUMP
DEFAULT DIRECTORY employee_data
ACCESS PARAMETERS
( RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY ','
MISSING FIELD VALUES ARE NULL)
LOCATION ('emp.dat')
)
REJECT LIMIT UNLIMITED
Loading and Unloading Data
To load an Oracle table from an external table, you use the INSERT INTO ...SELECT clause.
To populate an external table (data unloading), you use the CREATE TABLE AS SELECT clause. In this case, the external table is composed of proprietary format flat files that are operating system independent.
CREATE TABLE dept_xt
ORGANIZATION EXTERNAL
(
TYPE ORACLE_DATAPUMP
DEFAULT DIRECTORY ext_tab_dir1
LOCATION ('dept_xt.dmp')
)
AS SELECT * FROM scott.DEPT
Note: You cannot use an external table population operation with an external table defined to be used with the ORACLE_LOADER access driver.
Note: If you wish to extract the metadata for any object, just use DBMS_METADATA, as shown here:
SET LONG 2000
SELECT DBMS_METADATA.GET_DDL('TABLE','EXTRACT_CUST') FROM DUAL
Parallel Population of External Tables
You can load external tables in a parallel fashion, simply by using the keyword PARALLEL when creating the external table.
The actual degree of parallelism is constrained by the number of dump files you specify under the LOCATION parameter.
CREATE TABLE inventories_xt
ORGANIZATION EXTERNAL
(
TYPE ORACLE_DATA PUMP
DEFAULT DIRECTORY def_dir1
LOCATION ('inv.dmp1',’inv.dmp2’,inv.dmp3’)
)
PARALLEL
AS SELECT * FROM inventories
Defining External Table Properties
The data dictionary view DBA_EXTERNAL_TABLES describes features of all the external tables.
TABLE_NAME
TYPE_OWNER
Owner of the implementation type for the external table access driver
TYPE_NAME
Name of the implementation type for the external table access driver
DEFAULT_DIRECTORY_OWNER
DEFAULT_DIRECTORY_NAME
REJECT_LIMIT
Reject limit for the external table
ACCESS_TYPE
Type of access parameters for the external table: BLOB or CLOB
ACCESS_PARAMETERS
Access parameters for the external table
PROPERTY
Property of the external table:
If the PROPERTY column shows the value REFERENCED, this means that only those columns referenced by a SQL statement are processed (parsed and converted) by the Oracle access driver. ALL (the default) means that all the columns will be processed even those not existing in the select list.
To change the PROPERTY value for a table:
ALTER TABLE dept_xt
PROJECT COLUMN REFERENCED
| Transporting Tablespaces Across Platforms |
Introduction to Transportable Tablespaces
In Oracle Database 10g, you can transport tablespaces between different platforms.
Transportable tablespaces are a good way to migrate a database between different platforms.
You must be using the Enterprise Edition of Oracle8i or higher to generate a transportable tablespace set. However, you can use any edition of Oracle8i or higher to plug a transportable tablespace set into an Oracle Database on the same platform.
To plug a transportable tablespace set into an Oracle Database on a different platform, both databases must have compatibility set to at least 10.0.
Many, but not all, platforms are supported for cross-platform tablespace transport. You can query the V$TRANSPORTABLE_PLATFORM view to see the platforms that are supported.
Limitations on Transportable Tablespace Use
Transporting Tablespaces Between Databases
You can find out your own platform name:
select platform_name from v$database
The following statement can be used to determine whether tablespaces sales_1 and sales_2 are self-contained, with referential integrity constraints taken into consideration:
DBMS_TTS.TRANSPORT_SET_CHECK( TS_LIST =>'sales_1,sales_2', INCL_CONSTRAINTS =>TRUE, FULL_CHECK =>TRUE)
Note: You must have been granted the EXECUTE_CATALOG_ROLE role (initially signed to SYS) to execute this procedure.
You can see all violations by selecting from the TRANSPORT_SET_VIOLATIONS view. If the set of tablespaces is self-contained, this view is empty.
Transport both the datafiles and the export file of the tablespaces to a place accessible to the target database.
Use RMAN as follows:
RMAN> CONVERT DATAFILE
'/hq/finance/work/tru/tbs_31.f',
'/hq/finance/work/tru/tbs_32.f',
'/hq/finance/work/tru/tbs_41.f'
TO PLATFORM="Solaris[tm] OE (32-bit)"
FROM PLATFORM="HP TRu64 UNIX"
DBFILE_NAME_CONVERT=
"/hq/finance/work/tru/", "/hq/finance/dbs/tru"
PARALLELISM=5
Note: The source and destination platforms are optional.
Note: By default, Oracle places the converted files in the Flash Recovery Area, without changing the datafile names.
Note: If you have CLOB data on a small-endian system in an Oracle database version before 10g and with a varying-width character set and you are transporting to a database in a big-endian system, the CLOB data must be converted in the destination database. RMAN does not handle the conversion during the CONVERT phase. However, Oracle database automatically handles the conversion while accessing the CLOB data.
If you want to eliminate this run-time conversion cost from this automatic conversion, you can issue the CREATE TABLE AS SELECT command before accessing the data.
IMPDP system/password DUMPFILE=expdat.dmp DIRECTORY=dpump_dir
TRANSPORT_DATAFILES=
/salesdb/sales_101.dbf,
/salesdb/sales_201.dbf
REMAP_SCHEMA=(dcranney:smith) REMAP_SCHEMA=(jfee:williams)
If required, put the tablespace into READ WRITE mode.
Using Transportable Tablespaces: Scenarios
Transporting and Attaching Partitions for Data Warehousing
ALTER TABLE sales ADD PARTITION jul98 VALUES LESS THAN (1998, 8, 1)
ALTER TABLE sales EXCHANGE PARTITION jul98 WITH TABLE jul_sales
INCLUDING INDEXES WITHOUT VALIDATION
Publishing Structured Data on CDs
A data provider can load a tablespace with data to be published, generate the transportable set, and copy the transportable set to a CD. When customers receive this CD, they can plug it into an existing database without having to copy the datafiles from the CD to disk storage.
Note: In this case, it is highly recommended to set the READ_ONLY_OPEN_DELAYED initialization parameter to TRUE.
Mounting the Same Tablespace Read-Only on Multiple Databases
You can use transportable tablespaces to mount a tablespace read-only on multiple databases.
Archiving Historical Data Using Transportable Tablespaces
Using Transportable Tablespaces to Perform TSPITR
Note: For information about transporting the entire database across the platforms, see the section "Cross-Platform Transportable Database".
Using Database Control to Transport Tablespaces
You can use the Transport Tablespaces wizard to move a subset of an Oracle database from one Oracle database to another, even across different platforms.
The Transport Tablespaces wizard automates the process of generating a transportable tablespace set, or integrating an existing transportable tablespace set. The wizard uses a job that runs in the Enterprise Manager job system.
You can access the wizard from the Maintenance | Transport Tablespaces link in the Move Database Files section.
| Transport Tablespace from Backup |
You can use the transport tablespace from backup feature to transport tablespaces at a point in time without marking the source tablespaces READ ONLY. This removes the need to set the tablespace set in READ ONLY mode while exporting its metadata which results in a period of unavailability.
The RMAN command TRANSPORT TABLESPACE is used to generate one version of a tablespace set. A tablespace set version comprises the following:
Note: this option is time-consuming compared to the method that requires setting the tablespace in READ ONLY mode.
Transport Tablespace from Backup Implementation
Following are the steps done by RMAN to implement the transport tablespace from backup:
Note: The tablespace set may be kept online and in READ WRITE mode at the source database during the cloning process.
RUN {
TRANSPORT TABLESPACE 'USERS'
AUXILIARY DESTINATION 'C:\oraaux'
DUMP FILE 'tbsUSERS.dmp'
EXPORT LOG 'tbsUSERS.log'
IMPORT SCRIPT 'imptbsUSERS.sql'
TABLESPACE DESTINATION 'C:\oraaux\ttbs'
UNTIL TIME "to_date('28-04-2007 14:05:00','dd-mm-yyyy, HH24:MI:SS')";}
DUMP FILE
specifies the name of the generated Data Pump export dump file. Its default value is dmpfile.dmp
EXPORT LOG
specifies the name of the log file for the Data Pump export job. Its default value is explog.log
IMPORT SCRIPT
specifies the name of the sample import script. Its default value is impscrpt.sql. The import script is written to the location specified by the TABLESPACE DESTINATION parameter.
TABLESPACE DESTINATION
it is a required parameter that specifies the default location for the data files in the recovery set.
UNTIL
The UNTIL clause is used to specify the point-in-time for the tablespace set version. You may specify the point-in-time as an SCN, TIME, or log SEQUENCE.
Versioning Tablespaces
In Oracle Database 10g Release 2, you can build a repository to store versions of tablespace, referred to as a tablespace rack. The repository may be located in the same database as the tablespaces being versioned, or may be located in a different database. Handling this option is not covered in this document.
| Loading Data from Flat Files by Using EM |
The new Load Data wizard enhancements enable you to load data from external flat files into the database. It uses the table name and data file name that you specify, along with other information, to scan the data file and define a usable SQL*Loader control file. The wizard will create the control file for you. It then uses SQL*Loader to load the data.
Note: Not all control file functionality is supported in the Load Data wizard.
You can access the Load Data page from: Maintenance tabbed page | Move Row Data section
| DML Error Logging Table |
DML Error Logging Table
This feature (in Release 2) allows bulk DML operations to continue processing, when a DML error occurs, with the ability to log the errors in a DML error logging table.
DML error logging works with INSERT, UPDATE, MERGE, and DELETE statements.
To insert data with DML error logging:
This can be automatically done by the DBMS_ERRLOG.CREATE_ERROR_LOG procedure. It creates an error logging table with all of the mandatory error description columns plus all of the columns from the named DML table.
DBMS_ERRLOG.CREATE_ERROR_LOG(<DML table_name>[,<error_table_name>])
default logging table name is ERR$_ plus first 25 characters of table name
You can create the error logging table manually using the normal DDL statements but it must contain the following mandatory columns:
ORA_ERR_NUMBER$ NUMBER
ORA_ERR_MESG$ VARCHAR2(2000)
ORA_ERR_ROWID$ ROWID
ORA_ERR_OPTYP$ VARCHAR2(2)
ORA_ERR_TAG$ VARCHAR2(2000)
LOG ERRORS [INTO <error_table>] [('<tag>')] [REJECT LIMIT <limit>]
If you do not provide an error logging table name, the database logs to an error logging table with a default name.
You can also specify UNLIMITED for the REJECT LIMIT clause. The default reject limit is zero, which means that upon encountering the first error, the error is logged and the statement rolls back.
DBMS_ERRLOG.CREATE_ERROR_LOG('DW_EMPL')
INSERT INTO dw_empl
SELECT employee_id, first_name, last_name, hire_date, salary, department_id
FROM employees
WHERE hire_date > sysdate - 7
LOG ERRORS ('daily_load') REJECT LIMIT 25
| Asynchronous Commit |
In Oracle 10.2 COMMITs can be optionally deferred.
This eliminates the wait for an I/O to the redo log but the system must be able to tolerate loss of asynchronously committed transaction.
COMMIT [ WRITE [ IMMEDIATE|BATCH] [WAIT | NOWAIT]
IMMEDIATE specifies redo should be written immediately by LGWR process when transaction is committed (default)
BATCH causes redo to be buffered to redo log
WAIT specifies commit will not return until redo is persistent in online redo log (default)
NOWAIT allows commit to return before redo is persistent in redo log
COMMIT; -- =IMMEDIATE WAIT
COMMIT WRITE; -- = COMMIT;
COMMIT WRITE IMMEDIATE;-- = COMMIT;
COMMIT WRITE IMMEDIATE WAIT; -- = COMMIT;
COMMIT WRITE BATCH; -- = BATCH WAIT
COMMIT WRITE BATCH NOWAIT; -- = BATCH NOWAIT
COMMIT_WRITE initialization parameter determines default value of COMMIT WRITE statement.
Can be modified using ALTER SESSION statement
ALTER SESSION SET COMMIT_WRITE = 'BATCH,NOWAIT'
![]() | ![]() | ![]() |