Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
SQL Loader

SQL Loader

Ratings: (0)|Views: 477|Likes:
Published by Ganesh.am
Oracle SQL loder
Oracle SQL loder

More info:

Published by: Ganesh.am on Aug 12, 2010
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





SQL Loader Overview
SQL Loader:
SQL*Loader is the primary method for quickly populating Oracle tables withdata from external files. It has a powerful data-parsing engine that puts little limitation onthe format of the data in the datafile. SQL*Loader is invoked when you specify the sqlldr command.
SQL*Loader can be used to do the following:
Load data across a network. This means that a SQL*Loader client can be run on adifferent system from the one that is running the SQL*Loader server.
Load data from multiple datafiles during the same load session
Load data into multiple tables during the same load session
Specify the character set of the data
Selectively load data
Load data from disk, tape, or named pipe
Specify the character set of the data
Generate sophisticated error reports, which greatly aid troubleshooting
Load arbitrarily complex object-relational data
Use either conventional or direct path loading.
SQL*Loader Control File: 
The control file is a text file written in a language that SQL*Loader understands.The control file tells SQL*Loader where to find the data, how to parse and interpret thedata, and where to insert the data.
Input Data and Datafiles: 
SQL*Loader reads data from one or more files specified in the control file. FromSQL*Loader's perspective, the data in the datafile is organized as records. A particular datafile can be in fixed record format, variable record format, or stream record format.The chosen format depends on the data and depends on the flexibility and performancenecessary for the job.
 SQL*Loader Discards:
As SQL*Loader executes, it may create a file called the
discard file
. This file iscreated only when it is needed, and only if you have specified that a discard fileshould be enabled .The discard file contains records that were filtered out of theload because they did not match any record-selection criteria specified in thecontrol file.http://peoplesoftlearnings.blogspot.com/
The discard file therefore contains records that were not inserted into any table inthe database. You can specify the maximum number of such records that thediscard file can accept. Data written to any database table is not written to thediscard file.
The discard file is written in the same format as the datafile. The discard data can be loaded with the existing control file, after any necessary editing or correcting.
Loading into Empty Tables:
If the tables you are loading into are empty, use the INSERT option.
Loading into Non-Empty Tables:
If the tables you are loading into already contain data, you have three options:APPENDREPLACETRUNCATE
When the REPLACE or TRUNCATE keyword is specified, the entire
is replaced, not just individual rows. After the rows are successfully deleted, a commit isissued. You cannot recover the data that was in the table before the load, unless it wassaved with Export or a comparable utility.
If data already exists in the table, SQL*Loader appends the new rows to it. If data doesn'talready exist, the new rows are simply loaded. You must have SELECT privilege to usethe APPEND option.
All rows in the table are deleted and the new data is loaded. The table must be in your schema, or you must have DELETE privilege on the table.The row deletes cause any delete triggers defined on the table to fire. If DELETECASCADE has been specified for the table, then the cascaded deletes are carried out, aswell.
Updating Existing Rows:
The REPLACE method is a
replacement, not a replacement of individual rows.SQL*Loader does not update existing records, even if they have null columns. To updateexisting rows, use the following procedure:1.Load your data into a work table.2.Use the SQL language UPDATE statement with correlated subqueries.http://peoplesoftlearnings.blogspot.com/
Using this method, SQL*Loader uses the SQL TRUNCATE command to achieve the best possible performance. For the TRUNCATE command to operate, the table'sreferential integrity constraints must first be disabled. If they have not been disabled,SQL*Loader returns an error.Once the integrity constraints have been disabled, DELETE CASCADE is no longer defined for the table. If the DELETE CASCADE functionality is needed, then thecontents of the table must be manually deleted before the load begins.The table must be in your schema, or you must have the DELETE ANY TABLE privilege.
 Unlike the SQL TRUNCATE option, this method re-uses a table's extents.INSERT is SQL*Loader's default method. It requires the table to be empty beforeloading. SQL*Loader terminates with an error if the table contains rows.
Steps to Run a SQL loader:
Open Command prompt.
Then enter the Database details in the below mentioned format.SQLLDR Database Username/Password@Database Name.Eg: SQLLDR SYSADM/SYSADM&HRMS90DM
Press enter.
You will seeControl= (in the Next Line, Enter the Control file Path.)Eg: Control=X:\appserv\prcs\HRMS90DM\files\Course_Catalog_Control.CTL(AndEnter)
System takes the input from the file path mentioned in the control file and startloading the file with data accordingly.
Sample CTL (Control) File:
File name should be stored with the extension *.CTL.LOAD DATAINFILE 'X:\appserv\prcs\HRMS90DM\files\Course_Catalog.txt'BADFILE 'X:\appserv\prcs\HRMS90DM\files\Course_Catalog.BAD'DISCARDFILE 'X:\appserv\prcs\HRMS90DM\files\Course_Catalog.DIS'APPENDINTO TABLE PS_PMR_AD_CRS_CATLfields terminated by "|"http://peoplesoftlearnings.blogspot.com/

Activity (5)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
ALi liked this
yakovkhanuk liked this
Nirmal Kumar liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->