SlideShare a Scribd company logo
Oracle External Tables Gwendolyn Wright 11/07/02
Agenda Introduction Dictionary Objects and External Tables Creating an External Table Querying External Tables External Tables – Fixed Records Data Dictionary Views for External Tables Creating External Table Scripts External Table Advantages External Table Disadvantages Possible Issues Where to Get More Information
Introduction External tables are read-only tables that are defined in flat-files outside of the database but can be accessed by SQL inside of the database.  This feature can be used to load data into a database from flat files without using SQL*Loader.
Directory Objects and External tables Create a directory and grant read on the directory to a user. These tables are like regular SQL tables with some exceptions: - The metadata of external tables is created using the SQL “CREATE TABLE … ORGANIZATION EXTERNAL” statement. - The data resides outside the database in OS files, thus the EXTERNAL organization. - The OS files are identified inside the database through a logical directory defining the OS physical directory where they are located. - The data is read only. - You cannot perform any DML operations, nor create indexes. - The external table can be queried and joined directly, in parallel using the SQL statement SELECT.
Creating an External Table Create a flat file emp1.dat & emp2.dat Create a directory that defines the location of the directory where the flat files reside on the OS Create the external table (metadata) Select data from the external table to verify that data are visible
Querying External Tables External tables can be queried just like any other table.
External Tables – Fixed Records In addition to loading records with a variable format, we can also load them with a fixed format.
Data Dictionary Views for External Tables To get external tables names and characteristics, the DBA_EXTERNAL_TABLES view can be queried. If you need to retrieve the locations of the flat files, the view is DBA_EXTERNAL_LOCATIONS.
Creating External Table Scripts This is a new SQL*Loader option EXTERNAL_TABLE that can be used to create external tables as follows: - Create a sample data file for the external table - Create a SQL*Loader control script. - Run SQL*Loader using the control script to generate the commands for building an external table. - View the SQL*Loader log file.
External Tables Advantages The  EXTERNAL_TABLE command-line parameter: NOT USED  – This is the default value.  In this case, the load is done using conventional or direct path mode. GENERATE ONLY  – The load job is not performed.  Instead, all of the SQL statements to be executed for the whole load job are written to the specified SQL*Loader log file.  The load can be done later by executing the statements in the log file EXECUTE  – The load job is performed using external tables by executing SQL statements.  If any of the statements fail and return an error, the attempt to load stops.  Statements are always placed in the lof gile except the directory statements as they are executed. If the EXECUTE or GENERATE_ONLY option is specified, the userid that loads should be granted the following privileges: CREATE ANY DIRECTORY DROP ANY DIRECTORY
External Table Disadvantages In an external table load for which the data file character set is UTF8 or UTF16, it is not possible to suppress checking for byte-order marks.  The suppression is only necessary if the beginning of the data file contains binary data that matches the byte-order mark encloding.  It is possibel to suppress byte-order mark checking with usual loads.
Possible Issues Ownership of the External Tables
Where to Get More Information Oracle9i Recovering Lost Data  – Oracle Metalink – Doc 174425.1 Parameters FLASHBACK_SCN & FLASHBACK_TIME:   Point in Time Export – Oracle Metalink – Doc 204334.1 Flashback Query:  Confusion on SCN based  – Oracle Metalink –  Doc 302681.999 Oracle 9i New Features Flashback  – Oracle Metalink – Doc 143217.1

More Related Content

PDF
Oracle SQL Part 2
PPT
DOCX
PPT
Extracts from AS/400 Concepts & Tools workshop
DOCX
Sql loader good example
DOCX
Oracle sql loader utility
PPTX
Sql basics
PPTX
Dynamic Publishing with Arbortext Data Merge
Oracle SQL Part 2
Extracts from AS/400 Concepts & Tools workshop
Sql loader good example
Oracle sql loader utility
Sql basics
Dynamic Publishing with Arbortext Data Merge

What's hot (17)

ODP
Mysql database
ODT
ACADGILD:: HADOOP LESSON
PDF
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
ODP
Japer Reports
PPTX
PDF
Sql coding-standard-sqlserver
PPTX
Introduction to SQL
PPTX
Difference Between Sql - MySql and Oracle
PPTX
Building Adaptive Payment Systems with YQL
PPTX
Lab2 ddl commands
PPTX
Data stage
PPT
Sequences and indexes
PPTX
Unit1
PPT
SQL Server 2008 Performance Enhancements
PDF
Oracle10g External Tables
DOC
Mysql database
ACADGILD:: HADOOP LESSON
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
Japer Reports
Sql coding-standard-sqlserver
Introduction to SQL
Difference Between Sql - MySql and Oracle
Building Adaptive Payment Systems with YQL
Lab2 ddl commands
Data stage
Sequences and indexes
Unit1
SQL Server 2008 Performance Enhancements
Oracle10g External Tables
Ad

Similar to Oracle External Tables (20)

PPT
aotc_120805_mwagner
PPTX
External Tables - not just loading a csv file
PDF
How to Load Data, Revisited, UTOUG
PDF
How to Load Data, Revisited
PPTX
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
PPTX
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
TXT
Oracle 9i notes(kamal.love@gmail.com)
DOC
Collaborate 2011– Leveraging and Enriching the Capabilities of Oracle Databas...
PPTX
Oracle Database 12c - New Features for Developers and DBAs
PPTX
Oracle Database 12c - New Features for Developers and DBAs
PPT
08 Dynamic SQL and Metadata
PPTX
PPTX
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
PPTX
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
PPTX
PL/SQL User-Defined Functions in the Read World
PPT
plsql les06
PDF
Oracle 11G Development Training noida Delhi NCR
PDF
Download full ebook of Oracle Sql Developer Narayanan Ajith instant download pdf
PPTX
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...
PPTX
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expre...
aotc_120805_mwagner
External Tables - not just loading a csv file
How to Load Data, Revisited, UTOUG
How to Load Data, Revisited
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
Oracle 9i notes(kamal.love@gmail.com)
Collaborate 2011– Leveraging and Enriching the Capabilities of Oracle Databas...
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
08 Dynamic SQL and Metadata
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
PL/SQL User-Defined Functions in the Read World
plsql les06
Oracle 11G Development Training noida Delhi NCR
Download full ebook of Oracle Sql Developer Narayanan Ajith instant download pdf
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expre...
Ad

Recently uploaded (20)

PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
observCloud-Native Containerability and monitoring.pptx
PPTX
Chapter 5: Probability Theory and Statistics
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PDF
project resource management chapter-09.pdf
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
Getting Started with Data Integration: FME Form 101
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
Enhancing emotion recognition model for a student engagement use case through...
A comparative study of natural language inference in Swahili using monolingua...
Developing a website for English-speaking practice to English as a foreign la...
DP Operators-handbook-extract for the Mautical Institute
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
1 - Historical Antecedents, Social Consideration.pdf
observCloud-Native Containerability and monitoring.pptx
Chapter 5: Probability Theory and Statistics
Module 1.ppt Iot fundamentals and Architecture
NewMind AI Weekly Chronicles - August'25-Week II
O2C Customer Invoices to Receipt V15A.pptx
project resource management chapter-09.pdf
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
NewMind AI Weekly Chronicles – August ’25 Week III
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Zenith AI: Advanced Artificial Intelligence
Getting Started with Data Integration: FME Form 101
Web App vs Mobile App What Should You Build First.pdf
Enhancing emotion recognition model for a student engagement use case through...

Oracle External Tables

  • 1. Oracle External Tables Gwendolyn Wright 11/07/02
  • 2. Agenda Introduction Dictionary Objects and External Tables Creating an External Table Querying External Tables External Tables – Fixed Records Data Dictionary Views for External Tables Creating External Table Scripts External Table Advantages External Table Disadvantages Possible Issues Where to Get More Information
  • 3. Introduction External tables are read-only tables that are defined in flat-files outside of the database but can be accessed by SQL inside of the database. This feature can be used to load data into a database from flat files without using SQL*Loader.
  • 4. Directory Objects and External tables Create a directory and grant read on the directory to a user. These tables are like regular SQL tables with some exceptions: - The metadata of external tables is created using the SQL “CREATE TABLE … ORGANIZATION EXTERNAL” statement. - The data resides outside the database in OS files, thus the EXTERNAL organization. - The OS files are identified inside the database through a logical directory defining the OS physical directory where they are located. - The data is read only. - You cannot perform any DML operations, nor create indexes. - The external table can be queried and joined directly, in parallel using the SQL statement SELECT.
  • 5. Creating an External Table Create a flat file emp1.dat & emp2.dat Create a directory that defines the location of the directory where the flat files reside on the OS Create the external table (metadata) Select data from the external table to verify that data are visible
  • 6. Querying External Tables External tables can be queried just like any other table.
  • 7. External Tables – Fixed Records In addition to loading records with a variable format, we can also load them with a fixed format.
  • 8. Data Dictionary Views for External Tables To get external tables names and characteristics, the DBA_EXTERNAL_TABLES view can be queried. If you need to retrieve the locations of the flat files, the view is DBA_EXTERNAL_LOCATIONS.
  • 9. Creating External Table Scripts This is a new SQL*Loader option EXTERNAL_TABLE that can be used to create external tables as follows: - Create a sample data file for the external table - Create a SQL*Loader control script. - Run SQL*Loader using the control script to generate the commands for building an external table. - View the SQL*Loader log file.
  • 10. External Tables Advantages The EXTERNAL_TABLE command-line parameter: NOT USED – This is the default value. In this case, the load is done using conventional or direct path mode. GENERATE ONLY – The load job is not performed. Instead, all of the SQL statements to be executed for the whole load job are written to the specified SQL*Loader log file. The load can be done later by executing the statements in the log file EXECUTE – The load job is performed using external tables by executing SQL statements. If any of the statements fail and return an error, the attempt to load stops. Statements are always placed in the lof gile except the directory statements as they are executed. If the EXECUTE or GENERATE_ONLY option is specified, the userid that loads should be granted the following privileges: CREATE ANY DIRECTORY DROP ANY DIRECTORY
  • 11. External Table Disadvantages In an external table load for which the data file character set is UTF8 or UTF16, it is not possible to suppress checking for byte-order marks. The suppression is only necessary if the beginning of the data file contains binary data that matches the byte-order mark encloding. It is possibel to suppress byte-order mark checking with usual loads.
  • 12. Possible Issues Ownership of the External Tables
  • 13. Where to Get More Information Oracle9i Recovering Lost Data – Oracle Metalink – Doc 174425.1 Parameters FLASHBACK_SCN & FLASHBACK_TIME: Point in Time Export – Oracle Metalink – Doc 204334.1 Flashback Query: Confusion on SCN based – Oracle Metalink – Doc 302681.999 Oracle 9i New Features Flashback – Oracle Metalink – Doc 143217.1