Sqlldr: run ctl file in unix
Hi,
I'm new to Unix.
How can I execute a control file in unix.
my control file is in /home/r226124/split/ctl folder
when trying to execute the command
sqlldr USERID=username/password@host CONTROL=Split.ctl LOG=Split.log
this is the error i'm getting
ksh: sqlldr: not found
Any help?
Thanks.
sqlldr is in /opt/oracle/product/client/102/bin/sqlldr
but when i run, i'm getting this error
r226124@host:/opt/oracle/product/client/102/bin> ls -ltr sql*
-rw-rw-r-- 1 admgwldv securedv 2865 2008-08-18 15:06 sqlnet.log
-rwxr-xr-x 1 oracle dba 10166 2009-01-06 17:46 sqlj
-rwxr-xr-x 1 oracle dba 0 2009-01-06 17:53 sqlldrO
-rwxr-xr-x 1 oracle dba 0 2009-01-06 17:53 sqlplusO
-rwxr-xr-x 1 oracle dba 744359 2009-01-06 17:57 sqlldr
-rwxr-xr-x 1 oracle dba 12767 2009-01-06 18:01 sqlplus
r226124@host:/opt/oracle/product/client/102/bin> sqlldr
ksh: sqlldr: not found
r226124@host:/opt/oracle/product/client/102/bin>
Similar Messages
-
Problems with sqlldr, creating .ctl file
Hi I am trying to load data from a .csv file into an oracle table. I have been successful with loading some .csv files but at this point I am stuck in loading one .csv file that creates incorrect rows.
The .csv file has rows commencing on a newline, with columns seperated by the delimiter ','. Unfortunately some values in the .csv file contain newline characters leaving blank lines in the .csv file then continuing on with a row on the next line. e.g.
"foo", "foofoo", "foofoo", "lalalala
lallalallala", "foo", "foo"
Does anyone know what is missing from my .ctl file below so that it accurately reads in the correct values. Also delimiters ',' are present inside values e.g. "foo, foo". Does the optionally enclosed by statement below ingore those cases which I want it to?
OPTIONS (SKIP=1)
LOAD DATA
BADFILE 'import.bad'
APPEND
INTO TABLE tablename
FIELDS TERMINATED BY "," optionally enclosed by '"'
--columns
ThanksCan you get the data supplied to you without the newline characters in the strings? It would make it a lot easier.Unfortunately not as this is an assignment. I also tried the method of converting to a tab csv and adjusting the .ctl file respectively with the same result. Some records are perfect but others are not and I can not for the life of me pinpoint why. I am new to this and I can just tell like you guys have assured me of that newlines contained in values are ugly. But regardless im open to suggets if anyone has any.
Thank you greatly for your help too, its always appreciated. -
Hi,
I have following files
1. SQL file which is created from shell script with same functionality.
2. SQL file which is a Procedure.
Both these SQLs are running successfully on Windows server. Will these SQLs run on UNIX server also?
Do I have to make any change in code so that they will run in UNIX?
Please let me know.
Thanks in advance.
AdityaTroll35 wrote:
Hello,
The SQL language is exactly the same between UNIX and windows. You only have to check none of your SQL files are refering to OS filenames with path included, because of course, OS path will not be the same between Unix and windows.
You might want to check character encoding and newlines before trying to run the script on a unix-box (especially in production... :-) )
If you can open and read the contents of the file, with say vi or less, you ought to be fine.
Brgds
Johan -
How to run .ksh file in unix from .jsp files
Hi frnd,
How to connect unix servers from .jsp file & I want to run unix scripts .ksh files from .jsp files
Thanku
bhupathipawanIt is usually a bad idea to do any major processing directly within a JSP. It is better to create a helper class and invoke methods on that. This helper class can then be tested outside of the inhospitable JSP environment.
To run the '.ksh' file you will need to use either Runtime.exec() or the more modern ProcessBuilder. You will save yourself a lot of grief if you read thoroughly the 4 sections of http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html and then implement the recommendations.
Note - although the 'traps' article is written around the use of Runtime.exec(), it's content is equally applicable to ProcessBuilder. -
How to Run a text files using UNIX
Hi,
I have 10 text files in my project my task is to load all the text files data into Relational Database so i can use sql*loader to load all the text files data into a Database.
but the thing is another project i have 200 text files so i need to run these text files using UNIX script could anyone tell me how to load all the text files using UNIX
Thank's
Edited by: Lavanya on Sep 5, 2012 3:09 PMLavanya,
This question relates to shell scripting and in IMO it is not an oracle question.
I have made some initial assumptions before my proposed solution.
PLEASE note that this is untested, but can just guide you as a template for solving your problem.
Assuming that you have properly set up the control file and mapped each and every table in it as per the file information which you have..
Assuming the text file to be in the format of : ------ (as suggested by other posters earlier, this file holds instructions about the file and table mapping which shall be used by your sqlldr process.)
tmp.txt:
text_file_1-------------should goes to----customer_info_table
text_file_2------------should goes to------customer_address_table
text_file_3-----------should goes to-------customer_order_table
while read line
do
SQLLDR CONTROL=`echo $line | sed 's/should goes to/ /g' | sed 's/-//g' | awk -F " " '{print $1}'`.ctl,
LOG=`echo $line | sed 's/should goes to/ /g' | sed 's/-//g' | awk -F " " '{print $1}'`.log,
BAD=`echo $line | sed 's/should goes to/ /g' | sed 's/-//g' | awk -F " " '{print $1}'`.bad,
DATA=`echo $line | sed 's/should goes to/ /g' | sed 's/-//g' | awk -F " " '{print $1}'`.txt
USERID=scott/tiger
done <tmp.txtAll I am trying to run from the above shell script is : -- PLEASE TEST it if it matches your requirement.
SQLLDR CONTROL=text_file_1.ctl, LOG=text_file_1.log, BAD=text_file_1.bad, DATA=text_file_1.txt USERID=scott/tiger
SQLLDR CONTROL=text_file_2.ctl, LOG=text_file_2.log, BAD=text_file_2.bad, DATA=text_file_2.txt USERID=scott/tiger
SQLLDR CONTROL=text_file_3.ctl, LOG=text_file_3.log, BAD=text_file_3.bad, DATA=text_file_3.txt USERID=scott/tigerRepeating my assumptions, I assume you have all those files required for SQLLDR process to run (ctl file, data file...)
Cheers,
Manik -
[sqlldr] upload number datatype from varchar2 datatype in ctl file
dear friends.
this is two files from my DAT file.
In the last field the data is: |3180.8| or |605.|
00000000|0|0601|2000082|6|20131023414|3378|1|MATUTE|40|C|MATUTE|CUADRA 17 DE ISABEL LA CATOLICA|11|03|150115|3180.8|
00000000|0|0601|2000082|1|20131023414|3378|1|MATUTE|40|C|MATUTE|CUADRA 17 DE ISABEL LA CATOLICA|11|03|150115|605.|
in the table destination the field have NUMBER(12,2) and i want to upload in this datatype in my control file.
I had read about portable and non-portable datatypes but i dont understand. This topic is refer about my problem?
In other ways, what will be the instruction in order to upload this datatype ???
Thanks a lot.
cesar
P.D. please apologize my englishA lot of thanks my friend...
i saw in your example that is function... but... please, would you describe me what is my specific error in my files ?
Example of my datfile is:
00000000|0|0601|2000082|6|20131023414|3378|1|MATUTE|40|C|MATUTE|CUADRA 17 DE ISABEL LA CATOLICA|11|03|150115|3180.8|
00000000|0|0601|2000082|1|20131023414|3378|1|MATUTE|40|C|MATUTE|CUADRA 17 DE ISABEL LA CATOLICA|11|03|150115|605.|
My CTL file is:
Load DATA
APPEND
INTO TABLE PLANELEC.PEMVX_DATOSCOMPDOM
fields terminated by "|" TRAILING NULLCOLS
V_NUMPAQTE,
V_NUMLOTE,
V_NUMFORM,
N_NUMORDEN,
V_CODDOCIDE,
V_NUMDOCIDE,
N_NUMCORAPO,
N_ESTASGHAB,
V_NOMBREVIA,
V_NUMEROVIA,
V_INTERIOR,
V_NOMZONA,
V_REFERNCIA,
V_CODTVIA,
V_CODZONA,
V_CODUBIGEO,
TEST_INTEGER CONSTANT 0,
TEST_NUMBER (this is ths field where i put the last field of datfile)
This is my sh. file:
# /bin/bash
export ORACLE_SID=plelpp
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin
sqlldr USERID=system, CONTROL=T818COMP.ctl, LOG=T818COMP.log, data=10pemvx_datoscompdom_20080304165740.dat, bad=T818COMP.bad, discard=T818COMP.dsc
And finally, this is my *.log file that show errors when i execute my sh file:
SQL*Loader: Release 10.2.0.1.0 - Production on Thu Mar 6 07:50:46 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Control File: T818COMP.ctl
Data File: 10pemvx_datoscompdom_20080304165740.dat
Bad File: T818COMP.bad
Discard File: T818COMP.dsc
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 50
Bind array: 64 rows, maximum of 256000 bytes
Continuation: none specified
Path used: Conventional
Table PLANELEC.PEMVX_DATOSCOMPDOM, loaded from every logical record.
Insert option in effect for this table: APPEND
TRAILING NULLCOLS option in effect
Column Name Position Len Term Encl Datatype
V_NUMPAQTE FIRST * | CHARACTER
V_NUMLOTE NEXT * | CHARACTER
V_NUMFORM NEXT * | CHARACTER
N_NUMORDEN NEXT * | CHARACTER
V_CODDOCIDE NEXT * | CHARACTER
V_NUMDOCIDE NEXT * | CHARACTER
N_NUMCORAPO NEXT * | CHARACTER
N_ESTASGHAB NEXT * | CHARACTER
V_NOMBREVIA NEXT * | CHARACTER
V_NUMEROVIA NEXT * | CHARACTER
V_INTERIOR NEXT * | CHARACTER
V_NOMZONA NEXT * | CHARACTER
V_REFERNCIA NEXT * | CHARACTER
V_CODTVIA NEXT * | CHARACTER
V_CODZONA NEXT * | CHARACTER
V_CODUBIGEO NEXT * | CHARACTER
TEST_INTEGER CONSTANT
Value is '0'
TEST_NUMBER NEXT * | CHARACTER
value used for ROWS parameter changed from 64 to 58
Record 1: Rejected - Error on table PLANELEC.PEMVX_DATOSCOMPDOM, column TEST_NUMBER.
ORA-01722: numero no valido
Record 2: Rejected - Error on table PLANELEC.PEMVX_DATOSCOMPDOM, column TEST_NUMBER.
ORA-01722: numero no valido
Record 3: Rejected - Error on table PLANELEC.PEMVX_DATOSCOMPDOM, column TEST_NUMBER.
ORA-01722: numero no valido
Record 4: Rejected - Error on table PLANELEC.PEMVX_DATOSCOMPDOM, column TEST_NUMBER.
ORA-01722: numero no valido
Record 5: Rejected - Error on table PLANELEC.PEMVX_DATOSCOMPDOM, column TEST_NUMBER.
ORA-01722: numero no valido
Table PLANELEC.PEMVX_DATOSCOMPDOM:
0 Rows successfully loaded.
5 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: 254504 bytes(58 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 5
Total logical records rejected: 5
Total logical records discarded: 0
Run began on Thu Mar 06 07:50:46 2008
Run ended on Thu Mar 06 07:50:49 2008
Elapsed time was: 00:00:02.95
CPU time was: 00:00:00.02
Please,
would you help me ? is very important.
a lot of thanks...
cesar -
How to run a JAR file in Unix system?
hi there
ca anyone tell me how to run a JAR file in unix system or X window, thank youYou want to create an executable JAR file? You do it in the following way.
Create a manifest file such as manif.txt and the contents should contain
Main-Class: foo
assuming foo is the name of your main class. Then create the jar as follows
jar cvfm foo.jar manif.txt foo.class
I hope that helps you!
you can find more info here http://java.sun.com/docs/books/tutorial/jar/ -
Running Oracle Reports in unix, output in pdf file
Hi all,
Anybody currently running Oracle Reports in unix platform and the output is generated in pdf format & display in browser?
Can you please advise on what are all the environment variables that I have to set in order to get the report runs?
Besides, what are the specific printer setting that I have to set? as well as priviledge on directory if necessary.
My reports are created in PC with RDF format. When run in unix, can the RDF still be used or it has been to recompile? If recompile, how is this done?
I always get the following error but do not what is the cause:
REP-0110: Unable to open file 'myreport.rdf'. REP-1070: Error while opening or saving a document. REP-0110: Unable to open file 'myreport.rdf'.
Please advise.
Hope to receive your reply asap.
Great thanks in advance.What command did you type in to run your report in Unix? Did you give the full path of your rdf file. I guess that the system may not be find your rdf file correctly.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by guest2000:
Hi all,
Anybody currently running Oracle Reports in unix platform and the output is generated in pdf format & display in browser?
Can you please advise on what are all the environment variables that I have to set in order to get the report runs?
Besides, what are the specific printer setting that I have to set? as well as priviledge on directory if necessary.
My reports are created in PC with RDF format. When run in unix, can the RDF still be used or it has been to recompile? If recompile, how is this done?
I always get the following error but do not what is the cause:
REP-0110: Unable to open file 'myreport.rdf'. REP-1070: Error while opening or saving a document. REP-0110: Unable to open file 'myreport.rdf'.
Please advise.
Hope to receive your reply asap.
Great thanks in advance.<HR></BLOCKQUOTE>
null -
How to run script file ( unix script file like ksh or sh file) using Java
How to run script file ( unix script file like ksh or sh file) using Java Program?.
I am using the following code snippet to run the simple commands like top or ls ,etc....
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec("top");
Thanks In Adavance
-SivaString [] { "ksh" , "-c" , "script", "arg 1", "arg 2", "arg 3"}
-
is there an option in sqldeveloper to have this (nonlogged) option set in the generated sqlldr .ctl files? thx
Hi,
I confirm there is no OPTION to use the DIRECT mode.
For the simple reason you have restriction in DIRECT mode:
-Cannot load clustered tables.
-There can be no active transactions in the loaded tables.
-There can be no SQL functions used in the control file.
-If the target table is indexed, then no SELECT statements may be issued
against the table during the load.
So if you have a look to the .CTL files, the most part of the time, functions are used to translate datatypes correctly (ex: DECODE,HEXTORAW......)
regards,
Mireille -
SQLLDR: (CTL file) How to ONLY load 1 record of the CSV file
Hello,
We are in 11g, and we get CSV data.
I'd like to know if there is a way in the CTL file to specify that I only want to load first row ?
I know how to do it if there is a common unique value in the first row (WHEN myColumn = 'value1' )
BUT, in that case, first row doesn't hold any specific value, and I think that I have to tell the loader to take only first row.
I hope it is clear.
Here is the CTL, in the case we can get a specific value for first row:
LOAD DATA
CHARACTERSET WE8ISO8859P1
APPEND
CONTINUEIF LAST != ";"
INTO TABLE IMPORT_FIRST_LINES
WHEN COL_3 = 'firstRowValue'
FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
( COL_1 CHAR
, COL_2 CHAR
, COL_3 CHAR)
{code}
So, I think I need to change the *WHEN clause*.
I hope it is clear enough for you to understand.
Thanks in advance,
Olivierjust change the control file like this,
LOAD DATA
CHARACTERSET WE8ISO8859P1
APPEND
CONTINUEIF LAST != ";"
INTO TABLE IMPORT_FIRST_LINES
WHEN COL_3 = 'firstRowValue'
FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
( COL_1 CHAR
----------- if you only want to load 1st column of csv file to first column in table. -
Passing file name dynamically to sql loader ctl file
Hi,
I am new to scripting and I have a complex requirement involving writing a script.
Requierment:
I need to upload a CSV file from a FTP server into oracle table using SQL Loader. The file name resembles like APF0912312359.csv represents 31-DEC-2009 23:59 and there will be multiple files in same day indicated by differnt timestamp as its filename. Once I load a file using SQL loader, I need to move the file to another directory for archival.
Since the sql loader ctl file has a fixed file name, I would like to know how I can pass the file name dynamically to ctl file to load a new file every time it runs.
Any help is greatly appreciated..
Bye
Sudheer
Edited by: user2138419 on Oct 28, 2009 4:08 PMI agree with Pradeep in regards to declaring the file names on the command line. However, I do have a concern regarding presenting the password on the command line as any user that can issue a ps (assuming Unix ~= Linux here) would be able to read it while the sqlldr command is running.
Unfortunately, you may not always have the option of declaring the files on the command line. I was recently challenged with this in a Windows 2003 Server environment running SQL*Loader: Release 10.2.0.1.0. In this environment I found that I am able to set a variable file name in a calling batch file and use that value in the control file successfully. Just to demonstrate the approach:
Batch file:
set IN_FILE=’c:\inbound\load_me.txt’
sqlldr user/pswd@db PARFILE=’c:\parameters.txt’
Parameter file:
errors=500000
rows=50000
control=%CTL_FILE%
bad=%BAD_FILE%
discard=%DSC_FILE%
log=%LOG_FILE%
Control file:
LOAD DATA
INFILE ‘%IN_FILE%’
INSERT
INTO TABLE table_to_be_loaded
I’m really interested to see if this would work on Unix.
-Luke -
I have a mapping with file as source. I want to generate a CTL file that contains actual physical directory of my location and not the location name. I have specified my own path where the control file for this mapping should get generated.
(1) When I generate this mapping <map.ctl> file has location_name of the file module and not the physical path in the ctl script.
(2) When I deploy this mapping - ctl file is not generated in the specified directory.
(3) Only when I execute this mapping thru OWB that a CTL file containing the physical location of the data file is generated in the OS directory.
My questions are :
(1) How do I generate a CTL file containing physical location - without executing the mapping thru OWB. I want to do that so that I can run from sqlldr directly.
(2) What is the function of Deploy in case of file to table mappings.
(3) What is the OWB recommended way of deploying and executing such mappings involving sqlldr in prod environment.Vibha,
Sorry for the late response.
(1) How do I generate a CTL file containing physical location - without executing the mapping thru OWB. I want to do that so that I can run from sqlldr directly.
There should be no need to run from sqlldr directly. Warehouse Builder manages the execution in which case you get all the error handling and logging included in the runtime audit browser.
(2) What is the function of Deploy in case of file to table mappings.
Deploy stores the control file in the runtime repository, so that it can be picked up at execution time, temporarily be stored on the file system and OWB will then execute SQL loader natively.
(3) What is the OWB recommended way of deploying and executing such mappings involving sqlldr in prod environment.
Deploy to the production environment and execute it through OEM or a command line scheduling.
Mark. -
Sqlldr when cluase issue in unix
hi.. this is my ctl file
INTO TABLE "APB_DBA"."BN_STG"
APPEND
WHEN(03:07) <> 'TRAIL'
FIELDS TERMINATED BY '~'
OPTIONALLY ENCLOSED BY '"' AND '"'
TRAILING NULLCOLS
(Column1skip filler,
COMPANY_CODE,
CUST_BL_FRMT_NO)
This is working fine and data loaded via toad.
The same ctl file when I try to run from unix by removing optionally enclosed by option and its giving below error
with out OPTIONALLY ENCLOSED
OPTIONS (SKIP=1,DIRECT=TRUE)
LOAD DATA
INSERT INTO TABLE APB_DBA.BN_STG
FIELDS TERMINATED BY '~'
TRAILING NULLCOLS
WHEN (03:07) <> 'TRAIL'(
Column1skip filler,
COMPANY_CODE,
CUST_BL_FRMT_NO)
Error
SQL*Loader-350: Syntax error at line 6.
Expecting "(", found keyword when.
WHEN (03:07) <> 'TRAIL'(
^
with OPTIONALLY ENCLOSED and when clause
SQL*Loader-350: Syntax error at line 7.
Expecting "(", found keyword optionally.
OPTIONALLY ENCLOSED BY '"' AND '"'(
^
Need some help.You put the WHEN clause in the wrong place. It needs to be as below:
OPTIONS (SKIP=1,DIRECT=TRUE)
LOAD DATA
INSERT INTO TABLE BN_STG
WHEN(03:07) <> 'TRAIL'
FIELDS TERMINATED BY '~'
TRAILING NULLCOLS
(Column1skip filler,
COMPANY_CODE,
CUST_BL_FRMT_NO) -
Hello
I am trying to run multiple files with my java app on a Unix server. I compiled with javac, and run it thus:
java SNL *.mef
meaning I want to run all of the files with .mef suffix. Unfortunately it does nothing. If I just run one file at time this way:
java SNL bach.mef
it will work just fine. My main method looks like this:
public static void main(String[] args) throws IOException {
if (args.length != 1) {
System.exit(-1);
} else {
File file = new File(args[0]);
SNL parseSNL = new SNL(file);
Any help would be greatly appreciated.
JMpublic static void main(String[] args) throws IOException {
if (args.length != 1) {
System.err.println( "Usage: java SNL x.mef y.mef ..." );
System.exit(-1);
} else {
for( int i=0; i<args.length; i++ ) {
File file = new File( args[i] );
System.out.println( "Parsing " + file.getAbsolutePath() + " ..." );
SNL parseSNL = new SNL(file);
Maybe you are looking for
-
User-exit or BADI for Configurable line item change in VA01/VA02
Hi, During sale order creation or change the configurable item characterstics depend on plant. If a plant is changed the characterstics to be entered again. In my scenario the materila characterstics are same for all the plants hence in place of ente
-
How to use ranges in the program
hi all, my requirement is i need to create a range for srat date so iam creating a structure say name of the range table is zstartdate. how to use this table in my program. selct * from zuser_Secobjects where start_date in zstartdate. is it ok ? than
-
My ipad says can not allocate memory when trying to log on the net
After loading music on my ipad2 I can not log on to the web. It says cannot open the page. The error was: "The operation couldn't be completed. Cannot allocate memory". Does anyone know how to fix this issue?
-
Photo subpages disappearing from album page in iWeb 2009
One of the pages of my website is an album page. Theoretically, an album page should allow multiple photo subpages. Initially my album had two photo subpages. Now, however, I want to add additional subpages. The problem I'm encountering is that these
-
Mail downloading gmail sent mail?
This could be a gmail thing and not a .mac but I can't find a setting in gmail that seems to account for this action. I check my gmail with Mail and only occasionally use it to send stuff but when I do, at the end of the day, Mail seems to download a