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.

Slides:



Advertisements
Similar presentations
Oracle Academy Egypt Virtual training week 8 Sections from 7 to 9.
Advertisements

INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Data Loading Copyright System Managers LLC 2003 all rights reserved.
Manipulating Data Schedule: Timing Topic 60 minutes Lecture
Loading & organising data. Objectives Loading data using direct-load insert Loading data into oracle tables using SQL*Loader conventional and direct paths.
9 Copyright © 2004, Oracle. All rights reserved. Managing Data.
7 Copyright © Oracle Corporation, All rights reserved. Producing Readable Output with i SQL*Plus.
OUTLINE OF THE LECTURE PART I GOAL: Understand the Data Definition Statements in Fig 4.1 Step1: Columns of the Tables and Data types. Step2: Single column.
Copyright  Oracle Corporation, All rights reserved. 10 Creating and Managing Tables.
9 Copyright © Oracle Corporation, All rights reserved. Creating and Managing Tables.
1 The Oracle Database System Building a Database Database Course The Hebrew University of Jerusalem.
CS 104 Introduction to Computer Science and Graphics Problems Introduction to Database (2) Basic SQL 12/05/2008 Yang Song.
1 Table Alteration. 2 Altering Tables Table definition can be altered after its creation Adding columns Changing columns’ definition Dropping columns.
Oracle8 - The Complete Reference. Koch & Loney1 Chapter 14. Changing Data: Insert, Update, Delete Presented by Victor M. Matos.
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.
DML- Insert. DML Insert Update Delete select The INSERT INTO Statement The INSERT INTO statement is used to insert new rows into a table. Syntax INSERT.
Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial Password: UWPstudent Password is case sensitive.
Ceng 356-Lab1. Objectives After completing this lesson, you should be able to do the following: Get Familiar with the development environment List the.
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Chapter 5 Introduction to SQL. Structured Query Language = the “programming language” for relational databases SQL is a nonprocedural language = the user.
ASP.NET Programming with C# and SQL Server First Edition
Adding New Users User as an entity - username(UID), GID. UID - typically a number for system to identify the user. GID – a number that recognizes a set.
Installing and Using MySQL and phpMyAdmin. Last Time... Installing Apache server Installing PHP Running basic PHP scripts on the server Not necessary.
Copyright  Oracle Corporation, All rights reserved. Writing Basic SQL Statements.
10-1 Copyright  Oracle Corporation, All rights reserved. Database Objects ObjectDescription TableBasic unit of storage; composed of rows and columns.
Oracle 11g DATABASE DEVELOPMENT LAB1. Introduction  Oracle 11g Database:-  Oracle 11g database is designed for some features, which helps to the organizations.
USING XML AS A DATA SOURCE. Data binding is a process by which information in a data source is stored as an object in computer memory. In this presentation,
Damian Tamayo Tutorial DTM Data Generator Fall 2008 CIS 764.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting MySQL – Inserting Data.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
A Guide to MySQL 3. 2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed.
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.
DatabaseDatabase cs453 Lab5 1 Ins.Ebtesam AL-Etowi.
D Copyright © Oracle Corporation, All rights reserved. Loading Data into a Database.
Structured Query Language
Oracle 11g DATABASE DEVELOPMENT LAB2. Chapter- 2  These commands, which could be issued from SQL*Plus or SQL Developer,  will make it possible to log.
1 Copyright © Oracle Corporation, All rights reserved. Writing Basic SQL SELECT Statements.
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.
1 Copyright © 2007, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement.
1 Designing Tables for a Database System. 2 Where we were, and where we’re going The Entity-Relationship model: Used to model the world The Relational.
1 Copyright © 2009, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement.
2 Copyright © 2009, Oracle. All rights reserved. Managing Schema Objects.
Copyright س Oracle Corporation, All rights reserved. 1 Writing Basic SQL Statements.
1 Copyright © 2004, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement.
D Copyright © 2009, Oracle. All rights reserved. Using SQL*Plus.
3 A Guide to MySQL.
Introduction To Oracle
Chapter 5 Introduction to SQL.
VBA - Excel VBA is Visual Basic for Applications
CHP - 9 File Structures.
Database structure and space Management
SQL and SQL*Plus Interaction
Using SQL*Plus.
SQL in Oracle.
Introduction to MySQL.
ATS Application Programming: Java Programming
Handling Exceptions.
Database System Implementation CSE 507
Designing Tables for a Database System
ORACLE SQL Developer & SQLPLUS Statements
Chapter 7 Working with Databases and MySQL
Company Requirements.
Database Tuning - Processes, Memory
Manipulating Data.
Using SQL*Plus.
Using screens and adding two numbers - addda.cbl
Database Design: Relational Model
ISC321 Database Systems I Chapter 4: SQL: Data definition, Constraints, and Basic Queries and Updates Fall 2015 Dr. Abdullah Almutairi.
SQLPLUS: Oracle SQL Interface
Presentation transcript:

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 directions to read in data file: contains actual data log file: contains the execution log data.

SQL*Loader Command line in EMP.BAT file sqlldr userid=USER_LOGIN_ID/USER_PASSWORD control=d:\Drexel\emp.ctl data=d:\Drexel\emp. log=d:\Drexel\emp.log The above command runs SQL*Loader in Oracle. In USER_LOGIN/USER_PASSWORD, you must supply your own Oracle User ID and Password, separated by a "/". control=d:\Drexel\emp.ctl specifies the location of the control file. data=d:\Drexel\emp. specifies the location of the data file. log=d:\Drexel\emp.log specifies the location of the log file.

SQL*Loader Command line in EMP.BAT file While you may type the line above at the command line, I suggest you enter it into a .BAT file and execute it that way. Too much chance for typing mistakes. You do not need to specify a log file name or directory, but you must do so if you want it named something other than the name of the .CTL file and you want it someplace other than the current directory. It will look for the .DAT extension on the data file. If you do not have an extension, you must end the filename, as I did above, with a "."

DATA file The above two lines feed the two records for EMP table Tony|Hu||111223333|07-FEB-50|123 st.|M|99000||1|01-jan-18|| Yuan|An||112223333|07-FEB-40|456 st.|M|29000||1|01-jan-18|| The above two lines feed the two records for EMP table You must enter data for all NOT NULL fields, including those which have a default value. You don't have to quote dates or strings. Each data field is separated by the line (|) as specified in the control file. Each record is ended by the double lines.

CONTROL file: EMP.ctl LOAD REPLACE INTO TABLE employee FIELDS TERMINATED BY '|' (fname,lname,minit,ssn,bdate,address,sex,salary,superssn,dno,start_date,end_date)

CONTROL file: EMP.ctl There are many options in the control file not demonstrated here. Oracle will use defaults for any options not explicitly stated. You have the option of REPLACEing (empties table then adds rows), APPENDing (simply adds rows to the table) or INSERTing (adds rows only to an empty table). You will note that I have all the fields in the table named explicitly. This is not necessary. Only those fields where data might be added need be named. But you must include all NOT NULL fields.

CONTROL file: EMP.ctl You may include the data to be added in the .CTL file itself. If you do so, your control file would look like this:

CONTROL file: EMP.ctl LOAD REPLACE INTO TABLE employee FIELDS TERMINATED BY '|' (fname,lname,minit,ssn,bdate,address,sex,salary,superssn,dno,start_date,end_date) BEGINDATA Tony|Hu|111223333|07-FEB-50|123 st.|M|99000||1|01-jan-18|| Yuan|An||112223333|07-FEB-40|456 st.|M|29000||1|01-jan-18||

EMP.LOG file SQL*Loader: - Production on Mon Jun 22 16:4:25 1998 (c) Copyright 2018 Oracle Corporation. All rights reserved. Control File: d:\Drexel\emp.ctl Data File: d:\Drexel\emp. Bad File: d:\Drexel\emp.bad Discard File: none specified (Allow all discards) Number to load: ALL Number to skip: 0 Errors allowed: 50 Bind array: 64 rows, maximum of 65536 bytes

EMP.LOG file cont’d Continuation: none specified Path used: Conventional Table EMPLOYEE, loaded from every logical record. Insert option in effect for this table: REPLACE

EMP.LOG file cont’d Continuation: none specified Path used: Conventional Table EMPLOYEE, loaded from every logical record. Insert option in effect for this table: REPLACE Column Name Position Len Term Encl Datatype ------------------------------ ---------- ----- ---- ---- --------------------- FNAME FIRST * | CHARACTER LNAME NEXT * | CHARACTER MINIT NEXT * | CHARACTER SSN NEXT * | CHARACTER BDATE NEXT * | CHARACTER ADDRESS NEXT * | CHARACTER SEX NEXT * | CHARACTER SALARY NEXT * | CHARACTER SUPERSSN NEXT * | CHARACTER DNO NEXT * | CHARACTER START_DATE NEXT * | CHARACTER END_DATE NEXT * | CHARACTER Table EMPLOYEE: 2 Rows successfully loaded. 0 Rows not loaded due to data errors. 0 Rows not loaded because all WHEN clauses were failed. 0 Rows not loaded because all fields were null. Space allocated for bind array: 64584 bytes(46 rows) Space allocated for memory besides bind array: 0 bytes Total logical records skipped: 0 Total logical records read: 2 Total logical records rejected: 0 Total logical records discarded: 0 Run began on Mon Jun 22 16:04:25 1998 Run ended on Mon Jun 22 16:04:26 1998 Elapsed time was: 00:00:01.15 CPU time was: 00:00:00.11

EMP.LOG file cont’d Column Name Position Len Term Encl Datatype ------------------------------ ---------- ----- ---- ---- --------------------- FNAME FIRST * | CHARACTER LNAME NEXT * | CHARACTER MINIT NEXT * | CHARACTER SSN NEXT * | CHARACTER BDATE NEXT * | CHARACTER ADDRESS NEXT * | CHARACTER SEX NEXT * | CHARACTER SALARY NEXT * | CHARACTER SUPERSSN NEXT * | CHARACTER DNO NEXT * | CHARACTER START_DATE NEXT * | CHARACTER END_DATE NEXT * | CHARACTER

EMP.LOG file cont’d Table EMPLOYEE: 2 Rows successfully loaded. 0 Rows not loaded due to data errors. 0 Rows not loaded because all WHEN clauses were failed. 0 Rows not loaded because all fields were null. Space allocated for bind array: 64584 bytes(46 rows) Space allocated for memory besides bind array: 0 bytes

EMP.LOG file cont’d Total logical records skipped: 0 Total logical records read: 2 Total logical records rejected: 0 Total logical records discarded: 0 Run began on Mon Jun 22 16:04:25 1998 Run ended on Mon Jun 22 16:04:26 1998 Elapsed time was: 00:00:01.15 CPU time was: 00:00:00.11