D Copyright © Oracle Corporation, 2002. All rights reserved. Loading Data into a Database.

Slides:



Advertisements
Similar presentations
11 Copyright © Oracle Corporation, All rights reserved. Managing Tables.
Advertisements

The Architecture of Oracle
18 Copyright © Oracle Corporation, All rights reserved. Transporting Data Between Databases.
Loading & organising data. Objectives Loading data using direct-load insert Loading data into oracle tables using SQL*Loader conventional and direct paths.
18 Copyright © 2005, Oracle. All rights reserved. Moving Data.
9 Copyright © 2004, Oracle. All rights reserved. Managing Data.
18 Copyright © 2005, Oracle. All rights reserved. Moving Data.
17 Copyright © 2007, Oracle. All rights reserved. Moving Data.
Acknowledgments Byron Bush, Scott S. Hilpert and Lee, JeongKyu
Oracle Architecture. Instances and Databases (1/2)
Copyright  Oracle Corporation, All rights reserved. 10 Creating and Managing Tables.
Basic Storage Concepts and Settings
A Guide to SQL, Seventh Edition. Objectives Create a new table from an existing table Change data using the UPDATE command Add new data using the INSERT.
1 - Oracle Server Architecture Overview
Harvard University Oracle Database Administration Session 2 System Level.
A Guide to Oracle9i1 Advanced SQL And PL/SQL Topics Chapter 9.
10 Copyright © 2009, Oracle. All rights reserved. Managing Undo Data.
Backup and Recovery Part 1.
9 Copyright © Oracle Corporation, All rights reserved. Oracle Recovery Manager Overview and Configuration.
Module 9: Managing Schema Objects. Overview Naming guidelines for identifiers in schema object definitions Storage and structure of schema objects Implementing.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Chapter 6 Additional Database Objects
11 Copyright © Oracle Corporation, All rights reserved. RMAN Backups.
Database Technical Session By: Prof. Adarsh Patel.
By Lecturer / Aisha Dawood 1.  You can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of.
CHAPTER 7 Tables and Constraints. Logical Progression of Steps in Creating a Database Environment 1. Install Oracle database binaries (Chapter 1) 2. Create.
1 Oracle Architectural Components. 1-2 Objectives Listing the structures involved in connecting a user to an Oracle server Listing the stages in processing.
Copyright  Oracle Corporation, All rights reserved. 1 Oracle Architectural Components.
Copyright © Oracle Corporation, All rights reserved. 1 Oracle Architectural Components.
Chapter 6 Additional Database Objects Oracle 10g: SQL.
An Oracle server:  Is a database management system that provides an open, comprehensive, integrated approach to information management.  Consists.
1 Chapter 14 DML Tuning. 2 DML Performance Fundamentals DML Performance is affected by: – Efficiency of WHERE clause – Amount of index maintenance – Referential.
10-1 Copyright  Oracle Corporation, All rights reserved. Database Objects ObjectDescription TableBasic unit of storage; composed of rows and columns.
Copyright  Oracle Corporation, All rights reserved. 10 Creating and Managing Tables.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
Introduction to Oracle. Oracle History 1979 Oracle Release client/server relational database 1989 Oracle Oracle 8 (object relational) 1999.
7 Copyright © 2005, Oracle. All rights reserved. Managing Undo Data.
Database structure and space Management. Segments The level of logical database storage above an extent is called a segment. A segment is a set of extents.
Oracle 11g: SQL Chapter 4 Constraints.
Chapter 4 Constraints Oracle 10g: SQL. Oracle 10g: SQL 2 Objectives Explain the purpose of constraints in a table Distinguish among PRIMARY KEY, FOREIGN.
Week 3 Lecture 2 Basic Storage Concepts and Settings.
14 Copyright © 2006, Oracle. All rights reserved. Tuning Block Space Usage.
13 Copyright © Oracle Corporation, All rights reserved. Maintaining Data Integrity.
Chapter 1Oracle9i DBA II: Backup/Recovery and Network Administration 1 Chapter 1 Backup and Recovery Overview MSCD642 Backup and Recovery.
Session 1 Module 1: Introduction to Data Integrity
SQL LOADER. SQL*Loader (sqlldr ) is the utility to use for high performance data loads. The data can be loaded from any text file and inserted into the.
A Guide to SQL, Eighth Edition Chapter Six Updating Data.
Relational Database Management System(RDBMS) Structured Query Language(SQL)
6 Copyright © Oracle Corporation, All rights reserved. Backup and Recovery Overview.
3 Copyright © 2004, Oracle. All rights reserved. Database Architecture Comparison.
20 Copyright © 2006, Oracle. All rights reserved. Best Practices and Operational Considerations.
11 Copyright © 2004, Oracle. All rights reserved. Performing a Migration Using Oracle Migration Workbench (Part II)
Oracle 11g: SQL Chapter 5 Data Manipulation and Transaction Control.
8 Copyright © Oracle Corporation, All rights reserved. Managing Tablespaces and Data files.
Oracle Database Architectural Components
1 Copyright © 2005, Oracle. All rights reserved. Oracle Database Administration: Overview.
2 Copyright © 2009, Oracle. All rights reserved. Managing Schema Objects.
11 Copyright © 2009, Oracle. All rights reserved. Enhancing ETL Performance.
D Copyright © 2009, Oracle. All rights reserved. Using SQL*Plus.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
9 Copyright © 2005, Oracle. All rights reserved. Managing Undo Data.
10 Copyright © 2007, Oracle. All rights reserved. Managing Undo Data.
Chapter 21 SGA Architecture and Wait Event Summarized & Presented by Yeon JongHeum IDS Lab., Seoul National University.
Fundamentals of DBMS Notes-1.
Database structure and space Management
Using SQL*Plus.
Using SQL*Loader The SQL*Loader command needs to be run from a DOS window or NT. The SQL*Loader uses the following three files: control file: contains.
Oracle Memory Internals
Using SQL*Plus.
Presentation transcript:

D Copyright © Oracle Corporation, All rights reserved. Loading Data into a Database

D-2 Copyright © Oracle Corporation, All rights reserved. Objectives After completing this lesson you should be able to do the following: Demonstrate usage of direct-load insert operations Describe the usage of SQL*Loader Perform basic SQL*Loader operations List guidelines for using SQL*Loader and direct- load INSERT

D-3 Copyright © Oracle Corporation, All rights reserved. Data Loading Methods SQL*Loader Other applications Export Import Direct-load INSERT Oracle database

D-4 Copyright © Oracle Corporation, All rights reserved. Direct-Load INSERT Direct-load INSERT can be performed in the following ways: Normal (serially) or in parallel Into partitioned tables, nonpartitioned tables, or single partitions of a table With or without logging of redo data

D-5 Copyright © Oracle Corporation, All rights reserved.

D-6 Copyright © Oracle Corporation, All rights reserved. Serial Direct-Load INSERT Free space after delete Blocks used by inserted rows High-water mark Used block EMPLOYEES table INSERT /*+ APPEND */ INTO emp NOLOGGING SELECT * FROM t_employees; COMMIT; Server process

D-7 Copyright © Oracle Corporation, All rights reserved. Parallel Direct-Load INSERT Free space after delete Temporary segments Used block Slave process ALTER SESSION ENABLE PARALLEL DML; INSERT /*+PARALLEL(hr.employees,2) */ INTO hr.employees NOLOGGING SELECT * FROM hr.old_employees; High-water mark Slave process EMPLOYEES table

D-8 Copyright © Oracle Corporation, All rights reserved.

D-9 Copyright © Oracle Corporation, All rights reserved. SQL*Loader Database datafiles Input datafiles Loader control file SQL*Loader Log file Inserted Selected Parameter file (optional) Rejected Bad file Rejected Record selection Accepted Discard file (optional) Discarded Field processing Oracle server

D-10 Copyright © Oracle Corporation, All rights reserved.

D-11 Copyright © Oracle Corporation, All rights reserved. Conventional and Direct Path Loads Direct path Array insert Data save Table High-water mark Space used only by conventional load Instance SGA Shared pool Conventional

D-12 Copyright © Oracle Corporation, All rights reserved.

D-13 Copyright © Oracle Corporation, All rights reserved. Comparing Direct and Conventional Path Loads Conventional Load Uses COMMIT s to make changes permanent Redo log entries always generated Enforces all constraints INSERT triggers fire Can load into clustered tables Other users can make changes to tables Direct Path Load Uses data saves Generates redo only under specific conditions Enforces only primary key, unique, and NOT NULL INSERT triggers do not fire Cannot load into clustered tables Other users cannot make changes to tables

D-14 Copyright © Oracle Corporation, All rights reserved.

D-15 Copyright © Oracle Corporation, All rights reserved. Parallel Direct-Path Load Temporary segments load2.dat load2.ctl load3.dat load3.ctl SQL*Loader Table High-water mark load1.dat load1.ctl

D-16 Copyright © Oracle Corporation, All rights reserved. Using SQL*Loader SQL*Loader case1.log case1.ctl EMPLOYEES table $sqlldr hr/hr \ > control=case1.ctl \ > log=case1.log direct=Y

D-17 Copyright © Oracle Corporation, All rights reserved.

D-18 Copyright © Oracle Corporation, All rights reserved. SQL*Loader Control File The loader control file tells SQL*Loader: Where to find the load data The data format Configuration details –Memory management –Record rejection –Interrupted load handling details How to manipulate the data

D-19 Copyright © Oracle Corporation, All rights reserved.

D-20 Copyright © Oracle Corporation, All rights reserved.

D-21 Copyright © Oracle Corporation, All rights reserved. Control File Syntax Considerations The syntax is free-format Syntax is case insensitive Comments extend from the two hyphens ( -- ) that mark the beginning of the comment to the end of the line The CONSTANT keyword is reserved

D-22 Copyright © Oracle Corporation, All rights reserved. Input Data and Datafiles SQL*Loader reads data from one or more files specified in the control file From SQL*Loader’s perspective, the data in the datafile is organized as records A datafile can be in one of three formats: –Fixed-record format –Variable-record format –Stream-record format

D-23 Copyright © Oracle Corporation, All rights reserved.

D-24 Copyright © Oracle Corporation, All rights reserved.

D-25 Copyright © Oracle Corporation, All rights reserved. Logical Records SQL*Loader can be instructed to follow one of the following two logical record-forming strategies: Combine a fixed number of physical records to form each logical record Combine physical records into logical records while a certain condition is true

D-26 Copyright © Oracle Corporation, All rights reserved. Data Conversion During a conventional path load, data fields in the datafile are converted into columns in the database in two steps: The field specifications in the control file are used to interpret the format of the datafile and convert it to a SQL INSERT statement using that data The Oracle database server accepts the data and executes the INSERT statement to store the data in the database

D-27 Copyright © Oracle Corporation, All rights reserved. Discarded or Rejected Records Bad file –SQL*Loader rejects records when the input format is invalid –If the Oracle database finds that the row is invalid, the record is rejected and SQL*Loader puts it in the bad file Discard file –This can be used only if it has been enabled –This file contains records that were filtered out because they did not match any record-selection criteria specified in the control file

D-28 Copyright © Oracle Corporation, All rights reserved.

D-29 Copyright © Oracle Corporation, All rights reserved. Log File Contents Header Information Global Information Table Information Datafile Information Table Load Information Summary Statistics Additional statistics for direct path loads and multithreading Information

D-30 Copyright © Oracle Corporation, All rights reserved.

D-31 Copyright © Oracle Corporation, All rights reserved. SQL*Loader Guidelines Use a parameter file to specify commonly used command line options Place data within the control file only for a small, one-time load Improve performance by: –Allocating sufficient space –Sorting the data on the largest index –Specifying different files for temporary segments for parallel loads

D-32 Copyright © Oracle Corporation, All rights reserved. Summary In this lesson, you should have learned how to: Describe the usage of SQL*Loader Perform basic SQL*Loader operations Demonstrate proficiency using direct-load INSERT operations List guidelines for using SQL*Loader and direct- load INSERT