Your SlideShare is downloading. ×
0
Oracle External Tables
Oracle External Tables
Oracle External Tables
Oracle External Tables
Oracle External Tables
Oracle External Tables
Oracle External Tables
Oracle External Tables
Oracle External Tables
Oracle External Tables
Oracle External Tables
Oracle External Tables
Oracle External Tables
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Oracle External Tables

3,649

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
3,649
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
64
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Oracle External Tables Gwendolyn Wright 11/07/02
  • 2. Agenda <ul><li>Introduction </li></ul><ul><li>Dictionary Objects and External Tables </li></ul><ul><li>Creating an External Table </li></ul><ul><li>Querying External Tables </li></ul><ul><li>External Tables – Fixed Records </li></ul><ul><li>Data Dictionary Views for External Tables </li></ul><ul><li>Creating External Table Scripts </li></ul><ul><li>External Table Advantages </li></ul><ul><li>External Table Disadvantages </li></ul><ul><li>Possible Issues </li></ul><ul><li>Where to Get More Information </li></ul>
  • 3. Introduction <ul><li>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. </li></ul>
  • 4. Directory Objects and External tables <ul><li>Create a directory and grant read on the directory to a user. </li></ul><ul><li>These tables are like regular SQL tables with some exceptions: </li></ul><ul><li>- The metadata of external tables is created using the SQL “CREATE TABLE … ORGANIZATION EXTERNAL” statement. </li></ul><ul><li>- The data resides outside the database in OS files, thus the EXTERNAL organization. </li></ul><ul><li>- The OS files are identified inside the database through a logical directory defining the OS physical directory where they are located. </li></ul><ul><li>- The data is read only. </li></ul><ul><li>- You cannot perform any DML operations, nor create indexes. </li></ul><ul><li>- The external table can be queried and joined directly, in parallel using the SQL statement SELECT. </li></ul>
  • 5. Creating an External Table <ul><li>Create a flat file emp1.dat & emp2.dat </li></ul><ul><li>Create a directory that defines the location of the directory where the flat files reside on the OS </li></ul><ul><li>Create the external table (metadata) </li></ul><ul><li>Select data from the external table to verify that data are visible </li></ul>
  • 6. Querying External Tables <ul><li>External tables can be queried just like any other table. </li></ul>
  • 7. External Tables – Fixed Records <ul><li>In addition to loading records with a variable format, we can also load them with a fixed format. </li></ul>
  • 8. Data Dictionary Views for External Tables <ul><li>To get external tables names and characteristics, the DBA_EXTERNAL_TABLES view can be queried. </li></ul><ul><li>If you need to retrieve the locations of the flat files, the view is DBA_EXTERNAL_LOCATIONS. </li></ul>
  • 9. Creating External Table Scripts <ul><li>This is a new SQL*Loader option EXTERNAL_TABLE that can be used to create external tables as follows: </li></ul><ul><li>- Create a sample data file for the external table </li></ul><ul><li>- Create a SQL*Loader control script. </li></ul><ul><li>- Run SQL*Loader using the control script to generate the commands for building an external table. </li></ul><ul><li>- View the SQL*Loader log file. </li></ul>
  • 10. External Tables Advantages <ul><li>The EXTERNAL_TABLE command-line parameter: </li></ul><ul><ul><li>NOT USED – This is the default value. In this case, the load is done using conventional or direct path mode. </li></ul></ul><ul><ul><li>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 </li></ul></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>If the EXECUTE or GENERATE_ONLY option is specified, the userid that loads should be granted the following privileges: </li></ul></ul><ul><ul><li>CREATE ANY DIRECTORY </li></ul></ul><ul><ul><li>DROP ANY DIRECTORY </li></ul></ul>
  • 11. External Table Disadvantages <ul><li>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. </li></ul>
  • 12. Possible Issues <ul><li>Ownership of the External Tables </li></ul>
  • 13. Where to Get More Information <ul><li>Oracle9i Recovering Lost Data – Oracle Metalink – Doc 174425.1 </li></ul><ul><li>Parameters FLASHBACK_SCN & FLASHBACK_TIME: Point in Time Export – Oracle Metalink – Doc 204334.1 </li></ul><ul><li>Flashback Query: Confusion on SCN based – Oracle Metalink – Doc 302681.999 </li></ul><ul><li>Oracle 9i New Features Flashback – Oracle Metalink – Doc 143217.1 </li></ul>

×