21
Overview of the TOAD SQL*Loader Interface Mark Lerch October 25, 2000 Overview Examples Inserting from a single data file, with one error, into one table specifying table level parameters Loading into multiple tables by extracting multiple logical records Conditional load into partitions Loading from several data files, each with a different format Column-level delimiters and conditions, command-line options and constraint exception management Using the Scheduler Execution Options Frequently Asked Questions Executable Location Executable Names per Oracle Version My Environment Future Enhancements In Summary Overview The TOAD SQL*Loader Interface is a utility which allows the user to graphically build a control file for use with SQL*Loader. It also has the capability to run SQL*Loader with the control file, optionally running in either the foreground or the background. It can also schedule the SQL*Loader execution as a Windows Job for later execution. Most of this document consists of real-world examples in using the loader, since that seems to be the best way to learn about it. In the first example I will explain step by step what each tab in the window does, so it is worth looking it over to get an understanding of the GUI. Examples These example runs will start with the most common uses and increase in complexity to demonstrate some of the more advanced features of SQL*Loader.

TOAD SQL Loader Overview

Embed Size (px)

DESCRIPTION

TOAD SQL Loader Overview

Citation preview

Page 1: TOAD SQL Loader Overview

Overview of the TOAD SQL*Loader InterfaceMark LerchOctober 25, 2000

OverviewExamples

Inserting from a single data file, with one error, into one table specifying tablelevel parametersLoading into multiple tables by extracting multiple logical recordsConditional load into partitionsLoading from several data files, each with a different formatColumn-level delimiters and conditions, command-line options and constraintexception management

Using the SchedulerExecution OptionsFrequently Asked QuestionsExecutable LocationExecutable Names per Oracle VersionMy EnvironmentFuture EnhancementsIn Summary

OverviewThe TOAD SQL*Loader Interface is a utility which allows the user to graphically build acontrol file for use with SQL*Loader. It also has the capability to run SQL*Loader withthe control file, optionally running in either the foreground or the background. It can alsoschedule the SQL*Loader execution as a Windows Job for later execution.

Most of this document consists of real-world examples in using the loader, since thatseems to be the best way to learn about it. In the first example I will explain step by stepwhat each tab in the window does, so it is worth looking it over to get an understandingof the GUI.

ExamplesThese example runs will start with the most common uses and increase in complexity todemonstrate some of the more advanced features of SQL*Loader.

Page 2: TOAD SQL Loader Overview

Inserting from a single data file, with one error, into one table specifyingtable-level parameters

Let’s start by creating and populating a sample table. Here’s the script you can copy andpaste right into TOAD:

create table MarksFavoriteFoods (Name varchar2(30), Rank number)

insert into MarksFavoriteFoods values ('Tuna', 1)

insert into MarksFavoriteFoods values ('Salmon', 2)

insert into MarksFavoriteFoods values ('Broccoli', 3)

insert into MarksFavoriteFoods values ('Asparagus', 4)

insert into MarksFavoriteFoods values ('Bell peppers', 5)

insert into MarksFavoriteFoods values ('Chicken', 6)

insert into MarksFavoriteFoods values ('Yogurt', 7)

insert into MarksFavoriteFoods values ('Brown rice', 8)

insert into MarksFavoriteFoods values ('Carrots', 9)

insert into MarksFavoriteFoods values ('Lean ground beef', 10)

(I happen to be eating Salmon, brown rice and bell peppers while typing this).

Start up Schema Browser, find the table, select the Data tab on the right, right-click,select Save As, choose “ASCII, Comma delimited”, select “Save To File” on the bottomand choose “C:\MarksDiet.Dat” or any other filename you wish. Select OK.

Now let’s empty our table with this line:delete from MarksFavoriteFoods

And you can verify in Schema Browser that it is empty.

Here is what the first couple of lines look like from our data file:

Tuna,1Salmon,2

This is our data, or input, file. What I’m going to do is open up Notepad and edit the firstline, replacing the comma with a tab, to intentionally create “bad” data. Here is what thefirst line now looks like:

Tuna 1

Save the file.

Page 3: TOAD SQL Loader Overview

Open up the SQL*Loader interface (DBA | SQL*Loader Interface). The first tab is“Source Files”. Here is where we enter the list of the data files we want to load into oneor more tables. At least one input file is required. Let me briefly describe each:

Input file – This is the actual data file. It can be in three different formats: stream, fixedand variable. Stream format is the default. With stream format, lines are read until anend-of-record marker is found (end of line character, by default). With fixed recordformat, each record must be a fixed number of bytes in length. With variable recordformat, each record may be a different length, as specified by a special field – the firstfield in each record. The user must specify the length of this field.

Examples:Stream record format, end-of-line character – the default: Tuna,1Stream record format, ‘|’ character specified: Tuna,1|Fixed record format - all data records must be same lengthVariable record format, specifier field is 3 bytes long: 006Tuna,1

Bad file – This file will contain rejected records. By default, it gets named the same asthe input file, with a .BAD extension. In our example, this file should (if everythingworks right!) contain our bad Tuna record because it doesn’t conform to the parameterswe will specify.

Discard file – The discard file contains records that were not inserted during the loadbecause they did not match any of the selection criteria. We will see in a later examplethat we can actually tell SQL*Loader WHEN we want a record inserted – it must matchcriteria we specify.

Select “Add” to add our data file. The following dialog appears:

Page 4: TOAD SQL Loader Overview

(Notice that when the mouse passes over each field, “MicroHelp” is displayed in thestatus bar).

Click on the ellipse button next to Input filename and choose the data file:

The Bad file and Discard file are automatically entered with their default extensions.Stream is chosen by default, and we’ll take that. We’ll also leave the “end of recordstring” field empty, taking the end of line character as the default.

The “Discard” field indicates the maximum number of records to put into the discard file.We’ll leave this empty also, indicating that we want all of them.

Click OK to close.

Note at this point we could choose as many different input files as we wanted – as long asthey all had the same record layout. This is not to say they couldn’t each have a differentrecord format, as we will see in a later example.

Move to the Destination Tables tab. This is where we will choose the destination tablefor the load. Select MarksFavoriteFoods from the list. Since our data is comma-delimited, move to the All fields delimited by and enter a comma. If our data fields weresurrounded by double-quotes, as:

“Tuna”,”1”

then we would enter a double-quote in the All fields enclosed by field. If the trailingfield enclosure was different than the initial field enclosure character, we would enter itinto the second field. For example, if our data looked like:

Page 5: TOAD SQL Loader Overview

“Tuna#,”1#

we would enter double quotes into the first “enclosed by” field, and # into the secondfield.

As it is, we are not using field enclosure characters, so leave those fields blank.Our screen now looks like:

Let’s move on to the Parameters tab.

For a control file name, I’m going to enter D:\confile.ctl. You can name it whatever youwant, however, including the extension. The SQL*Loader EXE field automatically fillsin with the full path to the SQL*Loader. The rest of the fields on this tab are variousoptions that we’re not going to worry about right now.

We can preview the control file any time we want by clicking on the Preview ControlFile tab. Let’s do it now. Here is what mine looks like at this point:

LOAD DATAINFILE 'C:\marksdiet.dat'BADFILE 'C:\marksdiet.bad'DISCARDFILE 'C:\marksdiet.dsc'

INTO TABLE "MARKSFAVORITEFOODS"

Page 6: TOAD SQL Loader Overview

FIELDS TERMINATED BY ','

(NAME, RANK)

This is what the actual contents of the control file will be. At any time you can clickSave to save the control file. The control file is also saved when you choose ExecuteNow.

Let’s go for it! Click Execute Now. Here, hopefully, is what you will get for a result:

This is a very information-packed screen. The first tab is a “messages” tab, and providesthe standard output from running the loader. If any errors occurred when running theloader itself, they would be displayed here. The second tab contains the text of the logfile ,which presents detailed information about what occurred.

The first thing we discover on the Messages tab is some information about SQL*Loaderitself – its version and the date and time it was executed.

The last line states that 10 rows were inserted into our table. You can verify this withSchema Browser. Success!

The log file contains a lot of great data about what happened. We won’t go into all thedetails here, but scroll down a bit in the window. You’ll see that “1 record was rejected”.

Page 7: TOAD SQL Loader Overview

And moving out to Windows Explorer, we see that the file named “MarksDiet.bad” wascreated in the same directory as our data file. Open it up. It contains one row:

Tuna 1

This row did not match the criteria we specified for the load, namely, that each record iscomma delimited.

Just for fun, let’s close our Status window and click “Execute Now” again. Our statuswindow will open, and the line:

SQL*Loader-601: For INSERT option, table must be empty. Error on table"MARKSFAVORITEFOODS"

Appears in the window. What happened here? Well, by default, INSERTs areperformed. Since we didn’t change our load method, that is what it tried to do. But thetable already had data.

Move back to the Parameters tab and find the Load method field (there is another on theDestination Tables tab since this option can be specified at the table level, but we want todo it for all tables, even though we’ve only one). Select “Append” from the drop downlist. Click Execute again. We will discover by reading the Messages and Log file (orsimply by looking in Schema Browser) that we’ve successfully appended all 9 records (1is still bad, remember) into our table.

Well, that was a great start. This is a good time for a break, because we’re about to get abit more complex!

Loading into multiple tables by extracting multiple logical records

For this example, make another table just like MarksFavoriteFoods. Ensure both tablesare empty. Edit the data file to make it look like this:

I use a screen shot here because its important that the data be lined up exactly. And thoseare spaces in there – not tabs!

Page 8: TOAD SQL Loader Overview

This example is going to demonstrate how we can load data from one data file intomultiple tables by using logical records. What is different about this data is that eachline of the data file corresponds to more than one physical record. There are two logicalrecords in each line.

Here’s how we do this. Select the data file as the source file (actually if you haven’tclosed the window yet its still there. I kept mine open). On the Destination Tables tabwe’re going to select our two tables.

In the Destination Tables tree view, open up the first table. Select the Name column. Onthe right side, select the Column Parameters tab.

In the From/To column fields on the right, enter 1 and 12 respectively. This means wewant this table to read the first 12 columns in our data file to extract the Name field.Click on the Rank column and enter 13 and 14 for the From/To. That is where the Rankdata lives in our input file for that field.

Open up the second table in the tree view and select its Name column. The From/Tovalues for this are 18 and 33. Finally, select the last Rank column and enter 34 and 36 forthe From/To.

Make sure you’ve entered a control file. Here’s what the control file looks like:

LOAD DATAINFILE 'd:\marksdiet.dat'

INTO TABLE "MARKSFAVORITEFOODS"

FIELDS TERMINATED BY ',' (NAME POSITION(1:12), RANK POSITION(13:14))

INTO TABLE "TESTTHIS"

(NAME POSITION(18:33), RANK POSITION(34:36))

Click Execute and you will see that the foods ranked 1, 3, 5, 7 and 9 went into the firsttable, while those ranked 2, 4, 6, 8 and 10 went into the second table.

Conditional load into partitions

This example will demonstrate loading into a partition with conditions.

Page 9: TOAD SQL Loader Overview

NOTE: At this time when you select a table the subpartitions field does not get populatedwith the available subpartitions (as the partitions field does with the tables’ partitions);you must enter the name directly.

Let’s drop and recreate our table with range partitions. Run the following:

drop table marksfavoritefoods

CREATE TABLE MARKSFAVORITEFOODS (NAME VARCHAR2 (30),RANK NUMBER)PARTITION BY RANGE (RANK)

(PARTITION FoodRank1 VALUES LESS THAN (5),PARTITION FoodRank2 VALUES LESS THAN (MAXVALUE))

If we were to run our first example, foods with a ranking up through and including fourwould go into the partition named FoodRank1, and all the rest would go into the partitionnamed FoodRank2. Try it if you like, and verify the contents through the following SQL:

select * from MarksFavoriteFoods partition (FoodRank1)

select * from MarksFavoriteFoods partition (FoodRank2)

For this example, however, we will attempt to load all our data into partition FoodRank1.Let’s use our original, comma delimited file from the beginning of example 1. Select itand add it to the input file list on the first tab, if it isn’t already there. For our DestinationTable we’ll chose MarksFavoriteFoods again. This time, we will select the Partitionradio button on the Table Parameters tab. Click the drop down list and you will see thetwo partitions listed that we created. Choose FOODRANK1. Remember to enter acomma in the Delimiter field below it. (By the way, if our data were tab delimited, wewould choose WHITESPACE in the drop down).

On the right side of the Table Parameters tab is a field called “Load rec when”. Thismeans “load the record into the table when the following condition(s) are present”. Inthis field, enter the following:

RANK != “1”

This says that we only want records whose RANK field is not equal to the character “1”.(All character data is interpreted automatically by Oracle, by the way. If we wanted toenforce certain data types for special conditions we could do so under the ColumnParameters data type field).

On the Parameters tab choose a control file name to create. At this point, your controlfile should look something like the following:

LOAD DATAINFILE 'd:\marksdiet.dat'

Page 10: TOAD SQL Loader Overview

INTO TABLE "MARKSFAVORITEFOODS"PARTITION (FOODRANK1)WHEN RANK != "1"

FIELDS TERMINATED BY ','

(NAME, RANK)

Give it a whirl. If you were successful, the status window should open. Let’s go to theLog File tab. Move down through and you should come to these lines:

Record 1: Discarded - failed all WHEN clauses.Record 5: Rejected - Error on table "MARKSFAVORITEFOODS", partitionFOODRANK1.ORA-14401: inserted partition key is outside specified partition[and so on for the rest of the records]

This says that the first record failed the WHEN clause. It certainly did – it had a rank of1 and we didn’t want to load any records with that rank. The rest of the rejection linesstate that the inserted partition key is outside the partition bounds. This is becauserecords with a rank of 5 and above exceed the partition bounds we chose forFOODRANK1. Look in Schema Browser and you should find my foods ranked 2through 4 in the data.

Loading from several data files, each with a different format

This example will use three different data files and demonstrate the three supportedformat types: stream, fixed and variable.

Split the data file MarksDiet.dat into three separate files. Use Notepad (important!) as aneditor. Create three files, MarksDiet1.dat, MarksDiet2.dat and MarksDiet3.dat. Edit thefirst file. Make it look like this:

Tuna,1*Salmon,2*Broccoli,3*

Important! There are no extra spaces or new line characters at the end of that line. Thissample demonstrates using an asterisk as an end of record marker. Up until now, wehave been using the carriage return/new line character combo to designate physicalrecords.

Edit MarksDiet2.dat and make it look like this:

Asparagus, 4,Bell peppers,5,Chicken, 6,

Page 11: TOAD SQL Loader Overview

Once again, no spaces or new line characters at the end of the line. This is going to beour fixed record length file. Each record is fixed at precisely 15 characters.

The third file should be named MarksDiet3.dat and look like this:

0009Yogurt,7,0015Brown rice,8,0010Carrots,9,0019Lean ground beef,10

(Note: On SQL Loader versions prior to 8 (7.3, e.g.), a space is required after the recordlength field)

This is our variable format file. At the beginning of each record is a field whichdesignates how long that record is. Notice Brown Rice on the first line. You may count13 characters. But Notepad also adds two more characters – a carriage return/line feedpair. We need to account for that! (That’s why I had you use Notepad, some editors mayonly add one line feed character). Once again, no extra spaces or carriage returns at theend of the second line.

This time when we add each file, we will specify “Stream” format for the first, and enteran asterisk into the “end of record string” field. MarksDiet2.dat should be specified asFixed format, with a length of 15. And MarksDiet3.dat is variable format, and the lengthindication field is 4 bytes long. After adding these, here is what your Source Files tabshould look like:

Page 12: TOAD SQL Loader Overview

Select the same Destination table, enter the comma delimiter and the control file name,and all the data will be loaded (did you remember to empty the table first?).

If your table is still partitioned, as mine was, you can use these lines to see the data ineach one:

select * from MarksFavoriteFoods partition (FoodRank1)

select * from MarksFavoriteFoods partition (FoodRank2)

Column-level delimiters and conditions, command-line options andconstraint exception management

This final example will demonstrate specifying input data delimiters at the column level,capturing constraint errors and some of the command line options available.

For this example, we are going to create a foreign key to a table containing all of our foodranks. Here’s the SQL and PL/SQL I’d like you to execute:

drop table marksfavoritefoods

create table foodrank (Rank number primary key)

declarei integer;

begini := 1;loopinsert into foodrank values (i);i := i + 1;if i > 10 then

exit;end if;end loop;

end;

create table MarksFavoriteFoods (Name varchar2(20), Rank Number)

create table loaderexceptions(row_id urowid,owner varchar2(30), table_name varchar2(30), constraint varchar2(30))

alter table MarksFavoriteFoods add constraint check_rank foreign key(Rank) references FoodRank(Rank)exceptions into loaderexceptions

We’re also going to modify our input data file. I’ll provide it here, but be very carefulabout copying and pasting into an editor. Make sure you don’t get an empty line at theend.

"Grease^#1"Tuna^#1

Page 13: TOAD SQL Loader Overview

"Salmon^#02"Broccoli^#3"Asparagus^#4"Bell peppers^#5"Chicken^#6"Yogurt^7"Brown rice^#8"Carrots^#9Lean ground beef#10"Egg whites^#11"Congealed Fat^#99

Let’s look at this briefly. It is clear that our first field, Food Name, has a double-quote asits first delimiter. It’s closing delimiter is a caret. And its ending field specifier is a #character. The Rank field is not delimited. Or is it? Copy and paste that data into aneditor and again, make sure there are no hidden characters anywhere.

(Incidentally, how did Grease and Congealed Fat make it into the list? We’ll have to dosomething about that…)

Save the data file and select it as the input file. Go to the Destination Tables tab andselect MarksFavoriteFoods. Select it then go to the Table Parameters tab and enter orpick “LOADEREXCEPTIONS” as the Exceptions table (as of this writing, there is arefresh problem in the Table pick list, so it doesn’t appear there for me even though I’vecreated it. So manually enter the name). What this is going to indicate is that we wantany constraint exceptions to go into LOADEREXCEPTIONS. The exceptions table mustbe in the format as shown above. The RowID of the violated rows will go into this table.

Notice when you entered a name that “Reenable Constraints” automatically becamechecked. We’re asking that constraints be reenabled after the load is finished. When theconstraints become reenabled, then the referential integrity checks will fire, which willcause some of the data to fail and the row to be marked in our exceptions table. Inlooking back at our data, its pretty clear that “Congealed Fat” with a food rank of 99, willclearly violate our referential integrity constraint. We only have ten ranks in ourFOODRANK table - 1 through 10, so anything else will not be allowed.

Display the columns for MarksFavoriteFoods. Select the Name column and go over tothe Column Parameters tab. Enter # in the Field is terminated by. The Field is enclosedby “ and ^, so enter those characters as well. In looking back at our data, we find that notall the food name fields are delimited, so we will check the “optionally” check box

Move across to the Null If field. Null If says “set character columns to null, and numbercolumns to zero, upon this condition”. Enter RANK=”3” in the Null If field. This willblank out the Food Name column when Rank is 3. The food for that rank is Broccoli, soit will never appear, sadly.

Page 14: TOAD SQL Loader Overview

Move to the Default if field. Enter NAME=”Bell peppers”. This is also going to set theFood Name column to null whenever the Name is “Bell peppers”. (There is some subtledistinction between these two fields that escapes me at the moment. Perhaps it is thatNull If sets numeric fields to zero, while Default if sets them to null. The documentationsuggests that our example is redundant but who cares. I’ll leave this to the reader toinvestigate further).

Here is what my screen looks like at this time:

Let’s go on to the Parameters tab. Enter a control file name (I’ve been usingD:\confile.ctl, but you can name it anything). Go down to the command line options(these are options which can be specified on the executable command line). Enter a 1into Skip. This says we want to skip 1 record. I told you I was going to get rid of thatGrease field! Enter 11 into the Load field. This says we want to load 11 records fromour data file. So the first line will be skipped and the next 11 loaded. The Congealed Fatrecord will not get loaded. Even if it did, it has a Rank of 99, so it would fail theconstraint check.

Select the “Direct” checkbox, since we want to do a Direct Path Load (a very differentstyle of loading which does not perform standard SQL Inserts but rather uses buffers.This will permit the constraint to be turned off).

Finally, under Silent, check the “All” check box. This tells loader to suppress all outputmessages (the log file will still be created). (Incidentally, these are not mutuallyexclusive – you can disable Feedback and Errors, but not Discards, etc.)

Page 15: TOAD SQL Loader Overview

I think we’re ready to give this a whirl. Click Execute Now.

The Messages tab shows only these lines:

SQL*Loader: Release 8.1.6.0.0 - Production on Fri Oct 27 13:57:14 2000

(c) Copyright 1999 Oracle Corporation. All rights reserved.

Since we suppressed all messages.

The Log file tells us that 10 rows were loaded; 1 row was not, due to data errors. Whichwas that? Open up MarksDiet.bad (or whatever you named the data file, plus the .badextension). You will find this line:

"Yogurt^7

What’s wrong with that line? Well, it has no field termination character - #. Notice thatthe lean ground beef line:

Lean ground beef#10

Made it in, even though it doesn’t have delimiters. That’s because we said they wereoptional.

Now, open up Schema Browser and look at MarksFavoriteFoods. It looks like this:

Page 16: TOAD SQL Loader Overview

We see that Broccoli and Bell Peppers got blanked out, as we requested. Grease wasskipped and Congealed Fat was not loaded because it was beyond our “Loaded” limit.Yogurt wasn’t loaded due to bad data. But Egg Whites had a Rank of 11. Why didn’tthe constraint fail? And what’s up with the Rank of 0 for Salmon? It had a rank of 2!

Let’s open up our log file. (Whatever you named the control file but with a .LOGextension, and in the same directory as the control file). This is what we find toward thebottom:

Column Name Position Len Term Encl Datatype------------------------------ ---------- ----- ---- ---- ---------------------NAME FIRST * # O(") CHARACTER O(^) NULL if RANK = 0X33(character '3') DEFAULT if NAME = 0X42656c6c2070657070657273(character 'Bell peppers')RANK NEXT 1 CHARACTER

“Len” means length. We see a length of * for Name, meaning – read to the end of fieldmarker, which is # - the Terminator character. But Rank has a length of 1. I guess that’swhy only 1 character was loaded. But why? Well, we never specified a field terminatorfor Rank. We did for Name, but not Rank.

Let’s go back to the Destination Tables tab, select Rank and go to the Column Parameterstab. In the Field is terminated by field, select WHITESPACE from the dropdown.

Now, open up a SQL edit window and remove the records from MarksFavoriteFoods byentering:

delete from marksfavoritefoods

Run it once more. Notice in Schema Browser that all the numeric data makes it inproperly. In examining the log file, we see that our constraint was disabled, the recordsloaded, and an attempt was made to reenable the constraint. But the particular constraintwe used – a foreign key constraint – could not be reenabled because there were orphanedrecords – the Egg White. Look in the LOADEREXCEPTIONS table and you will findthe RowID of the offending record.

Using the SchedulerIncluded in SQL*Loader is a scheduler which provides the ability to schedule the load asa Windows task. Clicking the Schedule button opens the following window:

Page 17: TOAD SQL Loader Overview

Select when you want SQL*Loader to run. I’ve selected 4:55 pm on the day I’m writingthis. Click “OK” and you will be informed that a job has been added.

Open up Windows Explorer. On the left side, after your hard drive and CD ROM letters,you will see Control Panel, Printers and Scheduled Tasks (and maybe other things,depending on your system). Click on Scheduled Tasks. On the right side you will seethe newly added job. Here is what mine looks like:

You can right-click, select properties and see just what is going to happen at that time bylooking in the “Run” field. Here is what mine contains:

Page 18: TOAD SQL Loader Overview

D:\ORACLE\ORA81\BIN\SQLLDR.EXE userid=MLERCH/MLERCH@ORA8Icontrol=d:\confile.ctl log=d:\confile.log

Now that’s a sneak peak at exactly what the TOAD SQL*Loader runs when you clickExecute.

Just for fun I had a load operation due to start in 1 minute. So I took a stretch and after aminute a command prompt window opened, SQL*Loader launched and ran the controlfile. Cool, huh?

Execution OptionsThe View | Options DBA tab has a new option. As previously mentioned, you can runthe loader in either the background or the foreground. Here is what the new option lookslike:

Its important to note that running loader in the foreground is perhaps the most beneficial,as you can see error messages and results when it is completed. This is the mode ofrunning that I would recommend during testing (except when testing that the backgroundmode actually works!), as you can include the result messages in any problem reports.

Page 19: TOAD SQL Loader Overview

So there you have it - maximum flexibility. You can schedule SQL*Loader as aforeground process, a background task, or a Windows job.

I hope this document helps you as much as it has helped me improve this tool.

Frequently Asked QuestionsQuestions with the GUI

“I cannot select anything on the Table Parameters tab of the Destination Tables tab.”Each table can have its own set of parameters. Make sure you have a table selected under“Destination Tables” tree view.

I select a table that has subpartitions, but the subpartitions field is a simple entry field –it doesn’t list them like the partitions field lists the partitions.This will be developed at a future time. For now you must know the subpartition nameand enter it directly.

Questions after running “Execute Now”

I receive a “Missing DLL” error messageThe most likely cause of this happening is there is an earlier client version ofSQL*Loader trying to access a later version database. Upgrade SQL*Loader on theclient.

I receive an “Entry point mismatch” messageThere is a mixed version of SQL*Loader and its supporting DLL’s on the client. Toresolve try reinstalling the correct version of SQL*Loader. This should ensure a properversion for the exe and supporting DLL’s.

An “SQL*Loader-282: Unable to locate character set handle for character set ID (0)”error appearsI’m currently getting this when trying to run an 8.1.6. SQL*Loader to load a 7.3.4database. Error is related to NLS data being mismatched. Still working on resolution.

I press “Execute Now” and nothing seems to happen.Make sure you are not running it in the background. See View | Options DBA tab.Choosing Foreground will cause it to run while you wait, then display a results windowafterwards.

Why can’t I see a status window after it finishes running in the background like I seewhen it runs in the foreground?TOAD launches a separate Windows shell program to run it in the background. There isno way to know when it finishes. Even if there were, say through starting it in a thread(even if that’s possible, which is questionable), there is no way to capture stdError to

Page 20: TOAD SQL Loader Overview

display in the Messages tab. In the future I’ll investigate launching it within a new threadso the user can at least be notified when it finishes. Then again, they’ll know when theCommand Prompt window closes, so never mind.

I receive the error “bad length for VAR record” when specifying an input file withvariable length format. The data looks fine – what’s up?”Well, when that kept happening to me, it was because there was a return character at theend of the file. It choked on the entire thing!

I receive an error when I have specified a terminating string for my Stream file formatdata file.The Oracle documentation states this is a new addition for version 8.1.

I’ve got more than one destination table. No data is getting into any of them!Make sure

Miscellaneous Questions

Can’t control files themselves contain the data for the load?That is correct. In which case, use the Interface to build the parameters, then insert theappropriate section of the generated control file into the data file. This is currently theonly support for this type of load, and is outside the scope of this tool.

I’d like to run SQL*Loader myself, and provide it a control file I’ve built.Sure. Open up a Command Prompt, and enter:Sqlldr userid=MLERCH/MLERCH@ORA8I control=MyControlFileReplacing the obvious stuff.

Executable LocationIf you accept the default paths, then the executable will be in “OraNT/Bin” for versionsprior to 8.1. For 8.1 and greater, mine is located in “Oracle/Ora81/Bin.” TOAD uses thefollowing algorithm to offer a default path to the executable:Use DOA to find the path to the OCI.DLL. Locate an executable in that directorystarting with “SQLLDR*.EXE”. Offer the full path as the default.

The path to the SQL*Loader executable can be chosen as an option (View|Options DBAtab). There was a bug in prior versions in that the full path was not being presented.Since it was being stored as an option, you need to delete the old value in Options. Thiswill cause TOAD to perform a new find.

Executable Names Per Oracle VersionThese are the names of the SQL*Loader executables

Page 21: TOAD SQL Loader Overview

8.1.6 – “sqlldr.exe”8.0.5 – “sqlldr80.exe”8.0.4. – “sqlldr80.exe”7.3.4 – “sqlldr73.exe”

My EnvironmentI have a version 8.1.6 SQL*Loader. With it, I have successfully loaded tables in 3different environments: 8.1.6, 8.0.5, and 8.0.4. I’m still trying to load into a 7.3.4database with it. I have an NLS data mismatch error or something going on.

Future EnhancementsOne significant enhancement I plan to add includes the ability to save and restore all theparameters and configurations as a “style”. This will be a significant feature in that mostof the time the data files are used in the same format (e.g., the DBA will receive data fileseach week or month). The user will be able to simply select a pre-saved style, tweak atable name or two, and have their new control file.

In SummarySQL*Loader is a very, very big tool. There are enough options to make your head spin.I’ve tried to present the majority of the features in the TOAD Interface to it, knowing thattrying to present all its myriad of options would be bewildering at best and at worst giveme a head of gray hair. It’s important to remember that the TOAD window is intended toserve one primary purpose – to help users get started in building their control files. Thishas been the primary request from users – a tool to help them get started. Its my hopethat with TOAD SQL*Loader Interface we’re off to a good start.