Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Load Multiple Files in a single session

Status
Not open for further replies.

yerra

IS-IT--Management
Jan 6, 2005
11
FR
I have a folder in Unix /SQL which contains some SQL files that are to be loaded into the database. Some of these files contains procedures,functions, others are simple update, inserts statements.
In Unix I read a file, load into oracle, exit and then read another file, load into oracle and exit, So there are multiple logins to Oracle depending on no of files.

I want to load all these files in a single SQL session, and then exit out of it. Is there a procedure for it.?

 
Yerra,

Can you not invoke a script that contains:
Code:
@file1
@file2
@file3
et cetera?

Perhaps I do not understand the question properly. Please set me straight.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
@ 17:17 (07Feb05) UTC (aka "GMT" and "Zulu"),
@ 10:17 (07Feb05) Mountain Time

Click here to Donate to Tsunami Relief. 100% of your contributions here go to the victims...0% to administration.
They were "The First-Responder" to the disaster, with relief deliveries arriving before Red Cross and U.S. aid.
 
How Do I do @file1, @file2 ... like this programmatically.
It can be one file or many files.To explain better here is the logic of the script that I plan to use.
for FILE in <Location_Of_All_SQLFILES_In_Unix>
do
sqlplus << !
@FILE
exit;
!
done

In this case between Do and done, it will login and exit for each SQL files present in the folder. The number of files will only be known in runtime.


 
There is no such procedure in Oracle;
But why not concatenate all those files in Unix,
then call sqlplus once?
regards
 
I think that's what Dave was driving at. If the number of files isn't consistent, do an ls to cat the filenames into a list at run time and use that as the basis for your procedure as descibed above.
 
Yerra,

Yes, I agree with both Hoinz and Ken: There are fine methods in *nix to "slew" the variable numbers of scripts together and run from a single "@<file>". With a *nix shell script, you can either concatenate together the code contents of the various scripts or you can itemise the names of the scripts (as I did in my first post).

Let us know your findings or next set of questions.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
@ 16:21 (08Feb05) UTC (aka "GMT" and "Zulu"),
@ 09:21 (08Feb05) Mountain Time

Click here to Donate to Tsunami Relief. 100% of your contributions here go to the victims...0% to administration.
They were "The First-Responder" to the disaster, with relief deliveries arriving before Red Cross and U.S. aid.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top