Calling sql loader in sqlplus
Hi all, i am trying to load a file called text1.txt using sql loader. I am using sqlplus but i dont know how to call sql loader in sql plus.
can someone provide syntax assumming data file is text1.txt and control file is txt.clt
thanks
Why on earth? Though you forgot to include version info, assuming you are not using 9i or older, you can and should use the external table facility and you don't need this unstable and resource consuming procedure.
If you would have thought even one second about solving your own problem, you would have realized sqlloader is a separate O/S utility, which requires the host command, and username/password on the commandline.
That alone is a reason not to do it.
Sybrand Bakker
Senior Oracle DBA
Similar Messages
-
Help in calling sql loader and an oracle procedure in a script
Hi Guru's
please help me in writing an unix script which will call sql loader and also an oracle procedure..
i wrote an script which is as follows.
!/bin/sh
clear
#export ORACLE_SID='HOBS2'
sqlldr USERID=load/ps94mfo16 CONTROL=test_nica.ctl LOG=test_nica.log
retcode=`echo $?`
case "$retcode" in
0) echo "SQL*Loader execution successful" ;;
1) echo "SQL*Loader execution exited with EX_FAIL, see logfile" ;;
2) echo "SQL*Loader execution exited with EX_WARN, see logfile" ;;
3) echo "SQL*Loader execution encountered a fatal error" ;;
*) echo "unknown return code";;
esac
sqlplus USERID=load/ps94mfo16 << EOF
EXEC DO_TEST_SHELL_SCRIPT
it is loading the data in to an oracle table
but the procedure is not executed..
any valuable suggestion is highly appriciated..
Cheersmultiple duplicate threads:
to call an oracle procedure and sql loader in an unix script
Re: Can some one help he sql loader issue. -
Calling SQL * LOADER in stored procedure
Hi Experts,
Can we call sql*loader in stored procedures? . If yes , please let me know the syntax.
Any help will be highly appreciated.
Thanks.You can also use dbms_schedular to execute any shell or batch file - i guess ->
BEGIN
-- UNIX
DBMS_SCHEDULER.create_job(
job_name => 'unix_command_job',
job_type => 'EXECUTABLE',
number_of_arguments => 1,
job_action => '/bin/ls',
auto_drop => FALSE,
enabled => FALSE);
DBMS_SCHEDULER.set_job_argument_value('unix_command_job',1,'/tmp');
DBMS_SCHEDULER.set_attribute('unix_command_job', 'credential_name', 'TIM_HALL_CREDENTIAL');
DBMS_SCHEDULER.set_attribute('unix_command_job', 'destination', 'marge.localdomain:65001');
DBMS_SCHEDULER.enable('unix_command_job');
END;For details ->
http://www.oracle-base.com/articles/11g/SchedulerEnhancements_11gR1.php
http://www.oradev.com/dbms_scheduler.jsp
http://www.psoug.org/reference/dbms_scheduler.html
Regards.
Satyaki De. -
Calling SQL*Loader from Forms
Hi,
I was wondering if anyone has called SQL*Loader from Forms?
What I am wanting to do is use Oracle Forms as the interface where you can specify a file that you can import into the database and it will use a set control file. Push the import button and SQL*Loader does the rest.
Is using Java code to call SQL*Loader from Forms a viable option, or is there an easier way to achieve the desired outcome.
Any ideas or guidance will be much appreciated.
Thanks,
Scott.Scott,
In forms, there's a HOST built-in command which is supposed to execute any o/s commands.
What you have to do is :
1. Bult up the string exacltly in the fashion which you will run in o/s
2. Call the HOST Built-in and pass in the string
Here's a example :
Declare
lOsCmd Varchar2(1000) := Null;
Begin
lOsCmd := 'sqlldr user-id=userid/passwd@connectStr '
|| ' control=c:\temp\abc.ctl log=c:\temp\abc.log '
|| ' bad = c:\temp\abc.log';
Host (lOsCmd, No_Screen);
End;
-- Shailender Mehta -- -
Issues in calling Sql Loader through forms developer (10g)
Hi,
I am developing a form(in 10g) ,in which I am calling sql loader for loading data onto a oracle database table from external source (e.g. data file is a .CSV file).
But , somehow the sql loader is not getting executed.
Here , I am giving the environment settings , approach i am taking;
This is a distributed system , both the application server,and database server are mounted on two different servers.
The form is delpoyed on the application server.
The database table , and the sql loader are configured on the databse side.
I am using host(<sql loader command>) command to invoke the Operating System command through forms.
The sql loader is working ok , and the data is getting loaded successfully onto the required database table when I am executing the sql loader command on Unix prompt , but through the forms , it's not working.
Do I need to change some environmental setting to make this work...
Any quick help in this regard is highly appreciated.
Thanks.Hi Craig,
I have already tried out the option of calling sql loader through stored procedure,but this is not working ...
could you please share any examples to do so ...
code snippet i am using in forms:
declare
usid get_application_property(userid);
pwd get_application_property(password);
db get_application_property(host);
msqlldr varchar2(250);
begin
msqlldr:='/u01/oracle/formss/bin/sqlldr' username=<uid/pwd@db> control=<control file name> data=<data file name> log=<log file name>
hosts(msqlldr);
end;
Note that sqlldr command ,for that matter any unix shell command is not working through the hosts() command ...
could you please suggest any way out ...
Thanks. -
Calling SQL Loader with Dynamic file names
HI all
I woul like to know if I can call sql loader as below
$ sqlldr userid=uname/pwd control=new.ctl, data=$1
I have to schedule my loader 3 times a day and each time my file names are different(AAA_BBB_timestamp)
ThanksI have found a solution myself and if any one is interested its like this
for file in `ls -1 /opt/user/from/`
do
sqlldr userid=user/pwd@connect_string control=control_file.ctl data="/opt/user/from//$file"
done
Ramu -
Calling Sql-loader from PL/SQL
What is the command(s) to call Sql-Loader from inside a PL/SQL procedure?
Regards,
Ahmad.I don't think it is possible ...
-
Calling Sql*Loader from oracle Form builder
How do i call sql* loader from my forms to import the external data in different formats into my existing database?
Specify the flexibility of sql* loader to import external data from .txt files or .xls files.
Would be thankful if certain examples are given along with the answer.Hi,
1. First you have to create seperate ctl (Control files) which maps to different file formats
2. Using Oracle Forms,
2a) You can use the 'HOST' command to execute the command line ie. In this case executing
SQL*Loader script
2b) You also have the feature in ORACLE forms to read text files and load the data into
ORACLE db.
This can be achieved by using TEXT_IO package which comes with ORACLE Forms.
Hope this helps
Ta
Shailender -
Calling SQL Loader from Forms 4.5 using HOST command in Win2000
One of my forms calls SQL Loader 7.3 using HOST command to load a csv file onto the database(Oracle 7.3) under Windows 2000 platform.
Only after sql loader finishes its operation the control should come to my form i.e. synchronous execution.
As of now its running asynchronously.
Is there any way to make it synchronous. If Not any other work arounds?
Environment Details
Forms [32 Bit] Version 4.5.10.6.0 (Production)
Windows 2000 Operating System
Oracle7 Release 7.3.2.3.2Forms6i running on W2000, Rdbms 8.1.7
in Forms I added a button TEST,
Trigger when-button-pressed : host('test.bat') ;
in directory .......\frm I added file test.bat :
REM ===============
cd /d C:\........\ldr
pause
sqlldr parfile=test.par
pause
type test.log
pause
exit
REM ================
now, pressing TEST button opens DOS window, telling me what's going on, running sqlldr, finally going back to forms
Are you using NO_PROMPT or NO_SCREEN option of HOST command ?
Had a look at Forms 4.5 manuals, there is no mentioning of (a)synchronously operation in connection with HOST command. -
How to Call SQL Loader from Java ( servlet )?
We need to call SQL Loader command from Java Servlets? Any suggestions how this can be done?
Thanks
RahulProbably not the best way, but you could try using JNI to call a C function which then invokes SQL Loader via system() or exec(). I haven't done this myself though...
-
Error while calling sql loader from shell script.
In the table DBMS_SCHEDULER_JOB_RUN_DETAILS im getting the error as ""SQL*Loader-128: unable to begin a session ORA-01017: invalid username/password; logon denied""....do we need previliges for creating session of the db user????.....or wht other settings we require to do.....if the username and password used is right.
user1122577 wrote:
SQL*Loader-128: unable to begin a session ORA-01017: invalid username/password; logon deniedI don't know, but somehow the error you recived looks like ORA-01017 : )
[oracle@dell ~]$ sqlplus ring/ring
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Jul 22 11:50:58 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Data Mining and Real Application Testing options
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Data Mining and Real Application Testing options
[oracle@dell ~]$
[oracle@dell ~]$
[oracle@dell ~]$ sqlldr ring/ring
control = i don't have it
SQL*Loader: Release 10.2.0.4.0 - Production on Thu Jul 22 11:51:08 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
SQL*Loader-500: Unable to open file (i don't have it.ctl)
SQL*Loader-553: file not found
SQL*Loader-509: System error: No such file or directory
[oracle@dell ~]$
[oracle@dell ~]$
[oracle@dell ~]$ sqlldr ring/wrongpassword
control = i don't have it again
SQL*Loader: Release 10.2.0.4.0 - Production on Thu Jul 22 11:51:38 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
SQL*Loader-128: unable to begin a session
ORA-01017: invalid username/password; logon denied
[oracle@dell ~]$ -
I am writing a Java application running on SUN Solaris to perform data feed from a number of csv files to ORACLE. I am to use SQL Loader to perform the loading. What I need is to kick off the SQL Loader in my code. My question is how to kick off the SQL Loader in Java.
One of option I am thinking is using RunTime.Exec(). Is the following code workable?
runtime.exec( "sqlldr CONTROL=foo.ctl, LOG=bar.log, USERID=scott/tiger" );
Althernatively should I write a Oracle store procedure to call the SQL Loader and Java call the store procedure?
Any thoughts and directions are welcome!
Regards,Hi,
Can't you achieve the same thing using this
Class.forName("Driver");
Connection ocon=DriverManager.getConnection("url");
Once you have ocon then you can execute any query.
If this is not what you want,can you explain what SQLLoader means here?
Regards
Vicky -
Hi All,
Is there any way to call the sql loader in Apex to load the table with csv data.
Thanks in advance
DhanDo you need the application to load data for users as a function or are you just trying to load some data. Application Express has loading/unloading utilities from the main workspace menu that you can use for one time loads.
-
How to call sql loader ctrl file with in the pl/sql procedure
Hi Friends,
I am doing a project related with the transferring data using queues. In the queue , I will get a tab delimited data in the form of CLOB variable/message. I do want to store that dat in the oracle table.
When updating data into the table ,
1. Don't want to write that data into a file.( Want to access directly after dequeueing from the specfic queue).
2. As the data is in tab delimited form, I want to use sql loader concept.
How do I call the sql loader ctrl file with in my pl/sql procedure. When I searched , most of the forums recommending external procedure or Java program.
Please Guide me on this issue. my preferrence is pl sql, But don't know about external procedure . If no other way , I will try Java.
I am using oracle 9.2.0.8.0.
Thanks in advance,
Vimal..Neither SQL*Loader nor external tables are designed to read data from a CLOB stored in the database. They both work on files stored on the file system. If you don't want the data to be written to a file, you're going to have to roll your own parsing code. This is certainly possible. But it is going to be far less efficient than either SQL*Loader or external tables. And it's likely to involve quite a bit more code.
The simplest possible thing that could work would be to use something like Tom Kyte's string tokenization package to read a line from the CLOB, break it into the component pieces, and then store the different tokens in a meaningful collection (i.e. an object type or a record type that corresponds to the table definition). Of course, you'll need to handle things like converting strings to numbers or dates, rejecting rows, writing log files, etc.
Justin -
Calling SQL*Loader from OCCI
Hi All,
I need to access SQL*Loader from C++.
I know there is an interface for OCI to access SQL*Loader.
I also know there is a gnu project of a c++ wrapper to the OCI-SQL*Loader interface (odpd).
According to the OCCI documentation it is just a C++ facade of OCI (with some goodies like thread managing , etc.).
I want to know the following:
1. How can I operate OCI from OCCI?
2. Are there are source samples of operating OCI from OCCI or even better operating OCI SQL*Loader interface from OCCI?
3. Are there are any known (/unknown :-) ) problems with either OCCI access to OCI or OCI interface itself to the SQL*Loader?
Thanks,
ArikHi,
If you have a OCCI application and you want to interoperate with OCI, you can retrieve the underlying OCI handles from OCCI objects and write OCI code.
e.g :-
//with Environment env, Connection conn OCCI objects
OCIEnv *ocienv = env->getOCIEnv();
OCISvcCtx *ocisvc = conn->getOCISvcCtx();
//use OCI calls
OCIError *errhp;
OCIHandleAlloc (ocienv, &errhp, OCI_HTYPE_ERROR,...);
OCIHandleAlloc (ocienv, &dpctx, OCI_HTYPE_DIRPATH_CTX,..);
err = OCIDirPathLoadStream(...);
OCCI does not have a direct path API at present.
Thanks.
Maybe you are looking for
-
Group of messages in file adapter
Hi friends File adapter picks a message at a time , but can a file adapter picks group of messages at a time or is there any setings in sender or receiver file adapter. Can any one provide me the solution?
-
Hi, I am trying to modify the content of a 2D for loop using a double for loop. But the result I am getting is always 0 in the loop i am getting... I am not really too sure of the problem. Can anyone help? Thanks Attachments: example2.vi 32 KB
-
How can I know if I can update my Ipad 2 without it being locked by itunes ?
I want to update my Ipad, Can I normaly update it on Itunes, or it may lock it afterwards ? (Like for some of the Iphones, when you update them, they will lock ) If it may lock, how can i check ? Thanks
-
I'm up to 55 gb on my 60 gb HD--how can I tell what's hogging the space?
I have 10,000 pics on iphoto, which I thought was the culprit, but after backing that up to an external, that only is 12 gb. I need to free up more space to load iphoto6 and do some movies. What's the best way to find out exactly what is using up spa
-
Hi, After Effects CC won't update on both my computers. Every time I try to install the AE CC update, the installer asks me to close AdobeCrashDaemon to continue. After quiting AdobeCrashDaemon and checking Activity Monitor to make sure it's not runn