CHAPTER 14 External Tables. External Table Features An external table allows you to create a database table object that uses as its source an operating.

Slides:



Advertisements
Similar presentations
CHAPTER 4 Tablespaces and Datafiles. Introduction After installing the binaries, creating a database, and configuring your environment, the next logical.
Advertisements

CC SQL Utilities.
CHAPTER 13 Data Pump. Tool that replaces legacy exp/imp utilities Data Pump is a scalable, feature-rich utility that allows you to extract objects and.
Module 8 Importing and Exporting Data. Module Overview Transferring Data To/From SQL Server Importing & Exporting Table Data Inserting Data in Bulk.
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.
18 Copyright © 2005, Oracle. All rights reserved. Moving Data.
5 Copyright © 2005, Oracle. All rights reserved. Extraction, Transformation, and Loading (ETL) Loading.
17 Copyright © 2007, Oracle. All rights reserved. Moving Data.
The New Data Pump Caleb Small Next generation Import / Export New features Better performance Improved security Versatile interfaces.
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 12 System and Object Privileges.
Tables Lesson 6. Skills Matrix Tables Tables store data. Tables are relational –They store data organized as row and columns. –Data can be retrieved.
Let’s try Oracle. Accessing Oracle The Oracle system, like the SQL Server system, is client / server. For SQL Server, –the client is the Query Analyser.
Quick-and-dirty.  Commands end in a semi-colon ◦ If you forget, another prompt line shows up  Either continue the command or…  End it with a semi-colon.
1 Table Alteration. 2 Altering Tables Table definition can be altered after its creation Adding columns Changing columns’ definition Dropping columns.
Concepts of Database Management Sixth Edition
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
1 Chapter Overview Transferring and Transforming Data Introducing Microsoft Data Transformation Services (DTS) Transferring and Transforming Data with.
Copying, Managing, and Transforming Data With DTS.
1 Access Lesson 6 Integrating Access Microsoft Office 2010 Introductory Pasewark & Pasewark.
CHAPTER 11 Large Objects. Need for Large Objects Data type to store objects that contain large amount of text, log, image, video, or audio data. Most.
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 4 – Creating New.
CHAPTER 6 Users and Basic Security. Progression of Steps for Creating a Database Environment 1. Install Oracle database binaries (Chapter 1) 2. Create.
Chapter 4 The Relational Model 3: Advanced Topics Concepts of Database Management Seventh Edition.
Week 6 Lecture 2 System and Object Privileges. Learning Objectives  Identify and manage system and object privileges  Grant and revoke privileges to.
Hive : A Petabyte Scale Data Warehouse Using Hadoop
ETL There’s a New Sheriff in Town: Oracle OR… Not Just another Pretty Face Presented by: Bonnie O’Neil.
Advanced PL/SQL and Oracle ETL Doug Cosman Senior Oracle DBA SageLogix, Inc. Open World 2003.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
The Oracle9i Multi-Terabyte Data Warehouse Jeff Parker Manager Data Warehouse Development Amazon.com Session id:
A NoSQL Database - Hive Dania Abed Rabbou.
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
Chapter 9 Query-by-Example Pearson Education © 2009.
20 Copyright © Oracle Corporation, All rights reserved. Oracle9 i Extensions to DML and DDL Statements.
Most information comes from Chapter 3, MySQL Tutorial: 1 MySQL: Part.
DataMAPPER - Applied Database Tech. 이화여대 과학기술대학원 석사 3 학기 992COG08 김지혜.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting MySQL – Inserting Data.
Transportation: Loading Warehouse Data Chapter 12.
A Guide to MySQL 3. 2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed.
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
IT Auditing & Assurance, 2e, Hall & Singleton Chapter 3: Data Management Systems.
D Copyright © Oracle Corporation, All rights reserved. Loading Data into a Database.
Access Chapter 5-Table Tricks, Advanced Queries and Custom Forms.
Database Security. Multi-user database systems like Oracle include security to control how the database is accessed and used for example security Mechanisms:
Database Management System. DBMS A software package that allows users to create, retrieve and modify databases. A database is a collection of related.
2 Copyright © 2006, Oracle. All rights reserved. Managing Schema Objects.
1 © 2005 Julian Dyke Reducing Redo Julian Dyke Independent Consultant Web Version juliandyke.com.
A table is a set of data elements (values) that is organized using a model of vertical columns (which are identified by their name) and horizontal rows.
CHAPTER 14 External Tables. External Table Features An external table allows you to create a database table object that uses as its source an operating.
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.
Starting with Oracle SQL Plus. Today in the lab… Connect to SQL Plus – your schema. Set up two tables. Find the tables in the catalog. Insert four rows.
SunGard SCT Converter Tool Technical Consultant Welcome.
Programming with Microsoft Visual Basic 2012 Chapter 14: Access Databases and SQL.
11 Copyright © 2004, Oracle. All rights reserved. Performing a Migration Using Oracle Migration Workbench (Part II)
2 Copyright © 2009, Oracle. All rights reserved. Managing Schema Objects.
D Copyright © 2009, Oracle. All rights reserved. Using SQL*Plus.
3 A Guide to MySQL.
Tim Hall Oracle ACE Director
Introduction to MySQL.
1Z0-071 Exam : Oracle Database 12c SQL
1Z0-148 Dumps Oracle Database 12c: Advanced PL/SQL Exam Just 1 day study required to pass exam 100% Passing Assurance.
Chapter 3: Data Management Systems
DATABASE MANAGEMENT SYSTEM
Chapter 7 Working with Databases and MySQL
Creating and Managing Database Tables
Chapter 9 Query-by-Example Pearson Education © 2009.
Alternative Storage Techniques
Presentation transcript:

CHAPTER 14 External Tables

External Table Features An external table allows you to create a database table object that uses as its source an operating system file. Directly select information from operating-system flat files via SQL, which allows you to do tasks such as loading operating-system comma-separated-value (CSV) files into the database. Create platform-independent dump files that can be used to transfer data. You can also create these files as compressed and encrypt them for efficient and secure data transportation.

SQL*Loader versus External Tables Loading data with external tables is more straightforward and requires fewer steps. The interface for creating and loading from external tables is SQL*Plus. Many DBAs/developers find using SQL*Plus more intuitive and powerful than SQL*Loader’s parameter-file interface. You can view data in an external table before it’s loaded into a database table. You can load, transform, and aggregate the data without an intermediate staging table. For large amounts of data, this can be a huge space savings.

Loading an External Table from a CSV File 1. Create a database-directory object that points to the location of the CSV file. 2. Grant read and write privileges on the directory object to the user creating the external table. I usually use a DBA privileged account, so I don’t need to perform this step. 3. Run the CREATE TABLE...ORGANIZATION EXTERNAL statement. 4. Use SQL*Plus to access the contents of the CSV file.

Loading an External Table from a CSV File

Creating External Table Statement create table exadata_et( exa_id NUMBER,machine_count NUMBER,hide_flag NUMBER,oracle NUMBER,ship_date DATE,rack_type VARCHAR2(32) ) organization external ( type oracle_loader default directory exa_dir access parameters ( records delimited by newline fields terminated by '|' missing field values are null (exa_id,machine_count,hide_flag,oracle,ship_date char date_format date mask "mm/dd/yyyy",rack_type) ) location ('ex.csv') ) reject limit unlimited;

Viewing External-Table Metadata Use the DBA_EXTERNAL_TABLES, DBA_EXTERNAL_LOCATIONS views: select owner,table_name,default_directory_name,access_parameters from dba_external_tables; select owner,table_name,location from dba_external_locations;

Load a Regular Table with Data from an External Table Use APPEND hint to direct path load. Very efficient way to transfer data from an external table to a regular table where the data can be manipulated. SQL> insert /*+ APPEND */ into exa_info select * from exadata_et;

Performing Advanced Transformations 1. Create an external table. 2. Create a record type that maps to the columns in the external table. 3. Create a table based on the record type created in Step 2 4. Create a piplelined function that is used to inspect each row as it’s loaded and transform data based on business requirements. 5. Use an INSERT statement that selects from the external table and uses the pipelined function to transform data as it’s loaded.

Basing an External Table on an OS Text File This example bases an external table on the alert.log file. This allows users to query the alert.log file via SQL*Plus

Basing an External Table on an OS Text File create table alert_log_file( alert_text varchar2(4000)) organization external ( type oracle_loader default directory t_loc access parameters ( records delimited by newline nobadfile nologfile nodiscardfile fields terminated by '#$~=ui$X' missing field values are null (alert_text) ) location ('alert_O11R2.log') ) reject limit unlimited;

Transferring Data using External Tables

Using Parallelism when Unloading CREATE TABLE inv_et ORGANIZATION EXTERNAL ( TYPE ORACLE_DATAPUMP DEFAULT DIRECTORY dp LOCATION ('inv1.dmp','inv2.dmp') ) PARALLEL 2 AS SELECT * FROM inv;

Compressing a Dump File ACCESS PARAMETERS clause: CREATE TABLE inv_et ORGANIZATION EXTERNAL ( TYPE ORACLE_DATAPUMP DEFAULT DIRECTORY dp ACCESS PARAMETERS (COMPRESSION ENABLED) LOCATION ('inv1.dmp') ) AS SELECT * FROM inv;

Encrypting a Dump File CREATE TABLE inv_et ORGANIZATION EXTERNAL ( TYPE ORACLE_DATAPUMP DEFAULT DIRECTORY dp ACCESS PARAMETERS (ENCRYPTION ENABLED) LOCATION ('inv1.dmp') ) AS SELECT * FROM inv;

Summary External tables are flexible objects that allow you to create a database table that uses an operating system file as its input. Allows for easy loading of data from CSV and text files. External tables can also be used to efficiently and securely transfer data from one database environment to another.