Sqlldr load data
HI
I have a data file like this
=================================================================
Data File: /opt/oracle/dc/data/diff/tsn/rk.txt
664632 Rows successfully loaded.
0 Rows not loaded due to data errors.
417 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Data File: /opt/oracle/dc/data/diff/jkt/rk.txt
2531666 Rows successfully loaded.
0 Rows not loaded due to data errors.
141925 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Data File: /opt/oracle/dc/data/diff/del/rk.txt
ORA-01401: inserted value too large for column
ORA-01400: cannot insert NULL into (HBL)
6931772 Rows successfully loaded.
2 Rows not loaded due to data errors.
1905 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
===================================================================
in this sample file i have three records , ineed to load in to table as a three
records how i can do this.
EACH RECORD CONTAINS MORE THAN 10 ROWS SOME TIMES
always the new record start with -- Data File
You can even use SQLLoader to load the output. It can be someting like
I am assuming that you have table like indy_test (id number,loadOutput(4000))
So try with something like. Please check the syntax
CONTINUEIF this preserve (1:4) != 'Data'
INTO TABLE indy_test (id SEQUENCE(MAX,1),loadOutput char(400))
Hope this will help
Indy
http://www.datasoftech.com/library.html - Free Oracle 11g Training
Similar Messages
-
How to use sqlldr for loading data in Oracle 10g xe.
I want to load data using SQL*LOADER in Oracle DB from a .csv file but it doesn't seems to be working can anyony please help me.I am not get getting how to use sqlldr.
in CMD in giving this command
sqlldr hr/hr control='c:/data/record.ctr'
record.ctr>>load data
infile 'c:\data\record.csv'
into table record
fields terminated by "," optionally enclosed by '"'
( Name,uday, hemant )
sql table in data base>>CREATE TABLE "RECORD"
( "NAME" VARCHAR2(50),
"UDAY" VARCHAR2(50),
"HEMANT" VARCHAR2(50)
record.csv>>name,uday,hemant
c1,45454,84894
c2,489654,21322
can you please tell me how can i get this simple example run.C:\>sqlldr scott/tiger
control = data.ctl
SQL*Loader: Release 10.1.0.2.0 - Production on Thu Sep 14 17:06:46 2006
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Commit point reached - logical record count 3
SQL> conn scott/tiger
Connected.
SQL> create table data (col1 varchar2(40),col2 varchar2(40),col3 varchar2(40));
Table created.
SQL> select * from data;
COL1 COL2 COL3
name uday hemant
c1 45454 84894
c2 489654 21322
SQL>
data.csv
name,uday,hemant
c1,45454,84894
c2,489654,21322data.ctl
load data
infile 'c:\data.csv'
append
into table data
fields terminated by ','
optionally enclosed by '"'
(col1,col2,col3)i hope it will solve ur problem -
Data error while loading data using SQLLDR
Hi Gurus,
Kindly let em know the possible reasons for getting the below error returned by SQLLDR after loading data:
x no of rows not loaded due to data errors in SQLLDR
Could it be due to issues in control file?you'll find it well explained here :
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14215/part_ldr.htm#i436326
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_concepts.htm#i1004846 -
Loading data from flatfile to relational table,i am getting SQLLDR error
Hi,
While loading data from flatfile to relational table,i am getting SQLLDR error and i am unable to proceed further.
Source is a flatfile and target is a Oracle database,i used "LKM file to oracle(SQLLDR)" and "IKM sql control append"
and ran the interface.When i checked the seesion in operator window" after generating "CTL file" successfully
the session got failed at "Call sqlldr" and was not able to proceed further.
Environment details:
ODI 11g
database:Oracle 11g
Operating system:Windows server 2008
The error message it displayed in call sqlldr session file was
org.apache.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "<string>", line 31, in ?
File "C:\oracle\product\11.1.1\Oracle_ODI_1\oracledi\client\odi\bin\..\..\jdev\extensions\oracle.odi.navigator\scripting\Lib\javaos.py", line 198, in system
File "C:\oracle\product\11.1.1\Oracle_ODI_1\oracledi\client\odi\bin\..\..\jdev\extensions\oracle.odi.navigator\scripting\Lib\javaos.py", line 224, in execute
OSError: (0, 'Failed to execute command ([\'sh\', \'-c\', \'sqlldr DEVELOPER/pass_123@CPRDEV control="F:\\\\flatfile/CROSS_CURR.ctl" log="F:\\\\flatfile/CROSS_CURR.log" > "F:\\\\flatfile/CROSS_CURR.out" \']): java.io.IOException: Cannot run program "sh": CreateProcess error=2, The system cannot find the file specified')
at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:345)
at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:169)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2374)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java:1615)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java:1580)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java:2755)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2515)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:534)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:449)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1954)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:322)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:224)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:246)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:237)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:794)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:114)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
at java.lang.Thread.run(Thread.java:619)
could u give me a solution to sort out this error ASAP.
thanks,
keshav.This was the following code generated .
import java.lang.String
import java.lang.Runtime as Runtime
from jarray import array
import java.io.File
import os
import re
import javaos
def reportnbrows():
f = open(r"F:\flatfile/TEST.log", 'r')
try:
for line in f.readlines():
if line.find("MAXIMUM ERROR COUNT EXCEEDED")>=0 :
raise line
finally:
f.close()
ctlfile = r"""F:\flatfile/TEST.ctl"""
logfile = r"""F:\flatfile/TEST.log"""
outfile = r"""F:\flatfile/TEST.out"""
oracle_sid=''
if len('CPRDEV')>0: oracle_sid = '@'+'CPRDEV'
loadcmd = r"""sqlldr DEVELOPER/<@=snpRef.getInfo("DEST_PASS") @>%s control="%s" log="%s" > "%s" """ % (oracle_sid,ctlfile, logfile, outfile)
rc = os.system(loadcmd)
if rc <> 0 and rc <> 2:
raise "Load Error", "See %s for details" % logfile
if rc==2:
reportnbrows() -
Error in Loading Data with SQLLDR in Oracle 10G
Hello,
Can any one suggest whats the problem in the below mentioned Control file used for loading data through SQL*LOADER
LOAD DATA
INFILE 'D:\test\temt.txt'
BADFILE 'test.bad'
DISCARDFILE 'test.dsc'
INTO TABLE "TEST"
INSERT
(SRNO INTEGER(7),
PROD_ID INTEGER(10),
PROMO_ID INTEGER(10),
CHANNEL_ID INTEGER(10),
UNIT_COST INTEGER(10),
UNIT_PRICE INTEGER(10)
I am trying to load data in SCOTT schema as user scott.
Why do i get such an error, please refer the attach Log file.
SQL*Loader: Release 10.2.0.1.0 - Production on Fri Mar 20 14:43:35 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Control File: D:\test\temt.ctl
Data File: D:\test\temt.txt
Bad File: test.bad
Discard File: test.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 "TEST", loaded from every logical record.
Insert option in effect for this table: INSERT
Column Name Position Len Term Encl Datatype
SRNO FIRST 7 INTEGER
PROD_ID NEXT 10 INTEGER
PROMO_ID NEXT 10 INTEGER
CHANNEL_ID NEXT 10 INTEGER
UNIT_COST NEXT 10 INTEGER
UNIT_PRICE NEXT 10 INTEGER
Record 1: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 2: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 3: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 4: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 5: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 6: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 7: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 8: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 9: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 10: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 11: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 12: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 13: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 14: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 15: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 16: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 17: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 18: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 19: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 20: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 21: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 22: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 23: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 24: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 25: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 26: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 27: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 28: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 29: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 30: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 31: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 32: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 33: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 34: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 35: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 36: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 37: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 38: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 39: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 40: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 41: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 42: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 43: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 44: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 45: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 46: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 47: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 48: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 49: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 50: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 51: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
MAXIMUM ERROR COUNT EXCEEDED - Above statistics reflect partial run.
Table "TEST":
0 Rows successfully loaded.
51 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: 3648 bytes(64 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 64
Total logical records rejected: 51
Total logical records discarded: 0
Run began on Fri Mar 20 14:43:35 2009
Run ended on Fri Mar 20 14:43:43 2009
Elapsed time was: 00:00:07.98
CPU time was: 00:00:00.28
Below is the method of using SQLLDR and table details,
SQL> desc test
Name Null? Type
SRNO NUMBER(7)
PROD_ID NUMBER(10)
PROMO_ID NUMBER(10)
CHANNEL_ID NUMBER(10)
UNIT_COST NUMBER(10)
UNIT_PRICE NUMBER(10)
Method for using sqlldr is :
cmd promt,
d:\> sqlldr scott/tiger
control = D:\test\temt.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Fri Mar 20 15:55:50 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 64
I even tried few examples,
Which of the below mentioned Control file make sense,
--1
LOAD DATA
INFILE 'D:\test\temt.txt'
BADFILE 'test.bad'
DISCARDFILE 'test.dsc'
INTO TABLE "TEST"
INSERT
FIELD TERMINATED BY (,)
(SRNO INTEGER(7),
PROD_ID INTEGER(10),
PROMO_ID INTEGER(10),
CHANNEL_ID INTEGER(10),
UNIT_COST INTEGER(10),
UNIT_PRICE INTEGER(10)
--2
LOAD DATA
INFILE 'D:\test\temt.txt'
BADFILE 'test.bad'
DISCARDFILE 'test.dsc'
INTO TABLE "TEST"
INSERT
FIELD TERMINATED BY (,) optionally enclosed by '"'
(SRNO INTEGER(7),
PROD_ID INTEGER(10),
PROMO_ID INTEGER(10),
CHANNEL_ID INTEGER(10),
UNIT_COST INTEGER(10),
UNIT_PRICE INTEGER(10)
*For code--1 i get below mentioned error..*
D:\>sqlldr scott/tiger
control = D:\test\temt.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Fri Mar 20 16:36:00 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL*Loader-350: Syntax error at line 8.
Expecting "(", found "FIELD".
FIELD TERMINATED BY (,)
^
*And for code--2 i get the below error,*
D:\>sqlldr scott/tiger
control = D:\test\temt.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Fri Mar 20 16:39:22 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL*Loader-350: Syntax error at line 8.
Expecting "(", found "FIELD".
FIELD TERMINATED BY (,) optionally enclosed by '"'
^
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------below is the data i am trying to load through sqlldr
1,14,999,3,89098,111287
2,14,999,2,88645,110899
3,14,999,2,90418,117623
4,14,999,3,89272,115999
5,14,999,4,86364,117623
6,15,999,3,87522,101399
7,15,999,4,84671,99999
8,15,999,4,84671,99999
9,15,999,4,86364,101399
10,15,999,4,88735,100399
11,15,999,2,90418,101399
12,15,999,3,89272,101399
13,15,999,2,90418,101399
14,17,999,2,9694,155099
15,17,999,3,97618,155099
16,17,999,3,97618,155099
17,18,999,3,11333,169783
18,18,999,2,11479,163279
19,18,999,3,11333,163279
20,18,999,3,115141,173504
21,18,999,2,117086,165565
22,18,999,2,116856,17532
23,18,999,2,117086,169783
24,19,999,4,489,6237
25,19,999,3,4968,6302
26,20,999,2,52876,60839
27,20,999,3,52202,59999
28,20,999,3,53246,59999
29,20,999,3,54205,60209
30,20,999,3,54205,60209
31,21,999,4,76204,106773
32,21,999,4,76204,106773
33,21,999,3,7877,105299
34,21,999,4,76204,106773
35,21,999,4,77576,105668
36,21,999,3,7877,105299
37,21,999,4,76204,105299
38,21,999,2,81377,107595
39,21,999,2,81377,107595
40,21,999,4,77728,107595
41,22,999,3,2187,2656
42,22,999,2,2216,2661
43,22,999,3,2187,2656
44,22,999,2,2251,2632
45,22,999,3,2187,2656
46,22,999,4,2154,2628
47,22,999,3,2187,2656
48,22,999,3,2231,2661
49,22,999,3,2231,2624
50,22,999,2,2296,2632
51,22,999,3,2231,2661
52,22,999,4,2158,2661
53,23,999,3,1913,2408
54,23,999,3,1951,2375
55,23,999,3,1987,2383
56,23,999,3,1951,2408
57,24,999,4,3946,4943
58,24,999,3,4073,4883
59,24,999,2,4053,4934
60,24,999,2,4053,4866
61,24,999,4,3946,4943
62,24,999,3,4001,4943
63,24,999,3,4154,4892
64,24,999,4,4025,4875
65,24,999,4,4025,4875
66,24,999,2,4134,4875
67,24,999,3,4081,4943
68,24,999,2,4134,4934
69,24,999,4,4025,4943
70,24,999,4,4025,4875
71,24,999,3,4081,4943
72,25,999,3,983,12655
73,25,999,3,983,12655
74,25,999,2,9958,12655
75,25,999,3,983,12655
76,25,999,2,9958,12832
77,25,999,3,10027,12832
78,25,999,2,10157,12774
79,25,999,4,9888,12655
80,25,999,2,10157,12832
81,25,999,4,9888,12832
82,25,999,4,9888,12832
83,26,999,3,1305,17034
84,26,999,3,1305,16799
85,26,999,3,13551,16858
86,27,999,3,3992,4927
87,27,999,3,4064,4876
88,29,999,3,43761,56175
89,29,999,2,44942,55621
90,29,999,4,42335,55399
91,29,999,2,44322,55399
92,29,999,2,45208,56175
93,29,999,2,45208,56175
94,29,999,4,43182,56175
95,29,999,3,44636,56175
96,29,999,4,43182,56175
97,29,999,4,43182,56175
98,30,999,3,869,1094
99,30,999,4,857,1079
100,30,999,2,898,1079
---------------------------------------------------------------------------------------------------------------------------------------------------------------------- -
Server Hang While trying to load Data using SQLLDR
Hi guru's
OS Version: Centos 6 64 bit
DB Version : 11gR2 64 bit
When i am trying to load data using SQL ldr the loading in between hangs. As well as when i am trying to transfer text files which are approx 14Gb using winscp then it show me error as mentioned below:
Host is not communicating for more than 15 seconds.Still waiting..............
Not:if problem repeats , by turning off 'Optimize connection buffer size'
Warning : Abort this operation will close the connection
I talked to our n/w admin regarding the same problem
He blaim that its due to oracle not by any n/w
can anyone help me in this respect.Check MOS note :
SQL*Loader Hangs After Start [ID 1186863.1] -
How to load date and time from text file to oracle table through sqlloader
hi friends
i need you to show me what i miss to load date and time from text file to oracle table through sqlloader
this is my data in this path (c:\external\my_data.txt)
7369,SMITH,17-NOV-81,09:14:04,CLERK,20
7499,ALLEN,01-MAY-81,17:06:08,SALESMAN,30
7521,WARD,09-JUN-81,17:06:30,SALESMAN,30
7566,JONES,02-APR-81,09:24:10,MANAGER,20
7654,MARTIN,28-SEP-81,17:24:10,SALESMAN,30my table in database emp2
create table emp2 (empno number,
ename varchar2(20),
hiredate date,
etime date,
ejob varchar2(20),
deptno number);the control file code in this path (c:\external\ctrl.ctl)
load data
infile 'C:\external\my_data.txt'
into table emp2
fields terminated by ','
(empno, ename, hiredate, etime, ejob, deptno)this is the error :
C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 5
C:\>any help i greatly appreciated
thanks
Edited by: user10947262 on May 31, 2010 9:47 AMload data
infile 'C:\external\my_data.txt'
into table emp2
fields terminated by ','
(empno, ename, hiredate, etime, ejob, deptno)Try
load data
infile 'C:\external\my_data.txt'
into table emp2
fields terminated by ','
(empno, ename, hiredate, etime "to_date(:etime,'hh24:mi:ss')", ejob, deptno)
this is the error :
C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 5
C:\>
That's not an error, you can see errors within log and bad files. -
How can I load data into table with SQL*LOADER
how can I load data into table with SQL*LOADER
when column data length more than 255 bytes?
when column exceed 255 ,data can not be insert into table by SQL*LOADER
CREATE TABLE A (
A VARCHAR2 ( 10 ) ,
B VARCHAR2 ( 10 ) ,
C VARCHAR2 ( 10 ) ,
E VARCHAR2 ( 2000 ) );
control file:
load data
append into table A
fields terminated by X'09'
(A , B , C , E )
SQL*LOADER command:
sqlldr test/test control=A_ctl.txt data=A.xls log=b.log
datafile:
column E is more than 255bytes
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)Check this out.
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/ch06.htm#1006961 -
Sql@loader-704 and ORA-12154: error messages when trying to load data with SQL Loader
I have a data base with two tables that is used by Apex 4.2. One table has 800,000 records . The other has 7 million records
The client recently upgraded from Apex 3.2 to Apex 4.2 . We exported/imported the data to the new location with no problems
The source of the data is an old mainframe system; I needed to make changes to the source data and then load the tables.
The first time I loaded the data i did it from a command line with SQL loader
Now when I try to load the data I get this message:
sql@loader-704 Internal error: ulconnect OCISERVERATTACH
ORA-12154: tns:could not resolve the connect identifier specified
I've searched for postings on these error message and they all seem to say that SQL Ldr can't find my TNSNAMES file.
I am able to connect and load data with SQL Developer; so SQL developer is able to find the TNSNAMES file
However SQL Developer will not let me load a file this big
I have also tried to load the file within Apex (SQL Workshop/ Utilities) but again, the file is too big.
So it seems like SQL Loader is the only option
I did find one post online that said to set an environment variable with the path to the TNSNAMES file, but that didn't work..
Not sure what else to try or where to look
thanksHi,
You must have more than one tnsnames file or multiple installations of oracle. What i suggest you do (as I'm sure will be mentioned in ed's link that you were already pointed at) is the following (* i assume you are on windows?)
open a command prompt
set TNS_ADMIN=PATH_TO_DIRECTOT_THAT_CONTAINS_CORRECT_TNSNAMES_FILE (i.e. something like set TNS_ADMIN=c:\oracle\network\admin)
This will tell oracle use the config files you find here and no others
then try sqlldr user/pass@db (in the same dos window)
see if that connects and let us know.
Cheers,
Harry
http://dbaharrison.blogspot.com -
Error in loading data using SQL loader
I am getting a error like ‘SQL*Loader -350 syntax error of illegal combination of non-alphanumeric characters’ while loading a file using SQL loader in RHEL. The command used to run SQL*Loader is:
Sqlldr userid=<username>/<password> control =data.ctl
The control file, data.ctl is :
LOAD data
infile '/home/oraprod/data.txt'
append into table test
empid terminated by ',',
fname terminated by ',',
lname terminated by ',',
salary terminated by whitespace
The data.txt file is:
1,Kaushal,halani,5000
2,Chetan,halani,1000
I hope, my question is clear.
Please revert with the reply to my query.
RegardsReplace ''{" by "(" in your control file
LOAD data
infile 'c:\data.txt'
append into table emp_t
empid terminated by ',',
fname terminated by ',',
lname terminated by ',',
salary terminated by whitespace
C:\>sqlldr user/pwd@database control=c.ctl
SQL*Loader: Release 10.2.0.3.0 - Production on Wed Nov 13 10:10:24 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 1
Commit point reached - logical record count 2
SQL> select * from emp_t;
EMPID FNAME LNAME SALARY
1 Kaushal halani 5000
2 Chetan halani 1000
Best regards
Mohamed Houri -
Loading Data Error while using SQL Loader
Hi All,
I am facing another issue while loading the data from text file to oracle db.
I have a table in which data is loaded from multiple files. What i want the when i load the data i want to load the filename as well in the table in front of the record. the script which works fine when i load data in windows OS but i am getting error in Unix OS. My sql loader script is as follows.
source $HOME/. .bash_profile
export LOGFILE=/NSN/rawfiles/scripts/PAYMOBILE_LOAD/load.log
ORACLE_ACCESS=cdr/cdr123_awcc@$ORACLE_SID
FILES=`ls /NSN/rawfiles/bkp/PAYMOBILE/JAN2013/*.txt`;
for file in ${FILES[@]}
do
filename=`expr substr "$file" 43 50`
echo $filename
sqlldr $ORACLE_ACCESS control=/NSN/rawfiles/scripts/PAYMOBILE/CAT.ctl log=$LOGFILE data=/NSN/rawfiles/bkp/PAYMOBILE/JAN2013/$filename skip=0 direct=true
cd
mv /NSN/rawfiles/bkp/PAYMOBILE/JAN2013/$filename /NSN/backup/PAYMOBILE/JAN2013/
done
Control File for the same which i run on unix is :
Load data
INFILE "AR_101_1011_01-01-2013-01-32.txt"
Append
into table CDR.PAY_MOBILE_012013
fields terminated by "|" optionally enclosed by " "
trailing nullcols
VERSION, TICKETTYPE, GMT_TIME Date 'YYYY-MM-DD HH24:MI:SS' , LOCAL_TIME Date 'YYYY-MM-DD HH24:MI:SS', TRANSACID, EXTERNAL_TRANSACTION_ID, MEDIUM, ALIASCATEGORY, SERVICE, OPERATION, ACTORID,
ALIASNAME, SENDERACTORID, SENDERALIASNAME, RECIPIENTACTORID, RECIPIENTALIASNAME, THIRDACTORID, THIRDALIASNAME, ERRORHRN, CLASS, SNE,
MASTERSNE, VOUCHERCATEGORYID, VOUCHERSCENARIOID, EXPIRYDATE Date 'YYYY-MM-DD HH24:MI:SS', UNITVALUEID, CREDIT, VAT, IERROR, OPERSTATE, OPERERROR, CREATION_DATE Date 'YYYY-MM-DD HH24:MI:SS',
LAST_UPDATE Date 'YYYY-MM-DD HH24:MI:SS', BRANDID, CREDIT_PERIOD, CREDIT_EXPIRY_DATE Date 'YYYY-MM-DD HH24:MI:SS', SENDER_ACCOUNT, SENDER_TRANSAC, SENDER_ACCOUNT_TYPE, RECIPIENT_ACCOUNT,
RECIPIENT_TRANSAC, RECIPIENT_ACCOUNT_TYPE, RECIPIENT_MEDIUM, TIMESTAMP Date 'YYYY-MM-DD HH24:MI:SS', SENDERBILLINGTYPE, RECIPIENTBILLINGTYPE
Control file which works fine in windows is as follows:
Load data
Append
into table CDR.PAY_MOBILE_012013
fields terminated by "|" optionally enclosed by " "
trailing nullcols
VERSION, TICKETTYPE, GMT_TIME Date 'YYYY-MM-DD HH24:MI:SS' , LOCAL_TIME Date 'YYYY-MM-DD HH24:MI:SS', TRANSACID, EXTERNAL_TRANSACTION_ID, MEDIUM, ALIASCATEGORY, SERVICE, OPERATION, ACTORID,
ALIASNAME, SENDERACTORID, SENDERALIASNAME, RECIPIENTACTORID, RECIPIENTALIASNAME, THIRDACTORID, THIRDALIASNAME, ERRORHRN, CLASS, SNE,
MASTERSNE, VOUCHERCATEGORYID, VOUCHERSCENARIOID, EXPIRYDATE Date 'YYYY-MM-DD HH24:MI:SS', UNITVALUEID, CREDIT, VAT, IERROR, OPERSTATE, OPERERROR, CREATION_DATE Date 'YYYY-MM-DD HH24:MI:SS',
LAST_UPDATE Date 'YYYY-MM-DD HH24:MI:SS', BRANDID, CREDIT_PERIOD, CREDIT_EXPIRY_DATE Date 'YYYY-MM-DD HH24:MI:SS', SENDER_ACCOUNT, SENDER_TRANSAC, SENDER_ACCOUNT_TYPE, RECIPIENT_ACCOUNT,
RECIPIENT_TRANSAC, RECIPIENT_ACCOUNT_TYPE, RECIPIENT_MEDIUM, TIMESTAMP Date 'YYYY-MM-DD HH24:MI:SS', SENDERBILLINGTYPE, RECIPIENTBILLINGTYPE, FILENAME CONSTANT "AR_101_1011_01-12-2012-23-32.txt"
and the sql loader script which works fine in windows is as follows:
cd K:\paymobilefiles\DEC2012\1
for %%f in (*.txt) do (K:\paymobilefiles\DEC2012\1\LOAD\REPTEXT K:\paymobilefiles\DEC2012\1\LOAD\TEST.ctl "%%f">K:\paymobilefiles\DEC2012\1\LOAD\MYMOBILE.ctl
sqlldr userid=cdr/cdr123_awcc@tsiindia control=K:\paymobilefiles\DEC2012\1\LOAD\MYMOBILE.ctl rows=50000 bindsize=20000000 readsize=20000000 data=%%f log=K:\paymobilefiles\DEC2012\1\LOAD\MYMOBILE.log
move %%f K:\paymobilefiles\DEC2012\backup\1
when using windows based scripts i am getting filename in the filename column but when running the above mentioned scripts i am not able to get the filenames in the filename column.
Can anyone help over the same pleaseHI,
There is Difference in Control files , no INFILE & FILENAME CONSTANT values
Load data
Append
into table CDR.PAY_MOBILE_012013
fields terminated by "|" optionally enclosed by " "
trailing nullcols
VERSION, TICKETTYPE, GMT_TIME Date 'YYYY-MM-DD HH24:MI:SS' , LOCAL_TIME Date 'YYYY-MM-DD HH24:MI:SS', TRANSACID, EXTERNAL_TRANSACTION_ID, MEDIUM, ALIASCATEGORY, SERVICE, OPERATION, ACTORID,
ALIASNAME, SENDERACTORID, SENDERALIASNAME, RECIPIENTACTORID, RECIPIENTALIASNAME, THIRDACTORID, THIRDALIASNAME, ERRORHRN, CLASS, SNE,
MASTERSNE, VOUCHERCATEGORYID, VOUCHERSCENARIOID, EXPIRYDATE Date 'YYYY-MM-DD HH24:MI:SS', UNITVALUEID, CREDIT, VAT, IERROR, OPERSTATE, OPERERROR, CREATION_DATE Date 'YYYY-MM-DD HH24:MI:SS',
LAST_UPDATE Date 'YYYY-MM-DD HH24:MI:SS', BRANDID, CREDIT_PERIOD, CREDIT_EXPIRY_DATE Date 'YYYY-MM-DD HH24:MI:SS', SENDER_ACCOUNT, SENDER_TRANSAC, SENDER_ACCOUNT_TYPE, RECIPIENT_ACCOUNT,
RECIPIENT_TRANSAC, RECIPIENT_ACCOUNT_TYPE, RECIPIENT_MEDIUM, TIMESTAMP Date 'YYYY-MM-DD HH24:MI:SS', SENDERBILLINGTYPE, RECIPIENTBILLINGTYPE, FILENAME CONSTANT "AR_101_1011_01-12-2012-23-32.txt"
)Thanks,
Ajay More
http://moreajays.blogspot.com -
Problem in Loading data for clob column using sql ldr
Hi,
I am having problem in loading data for tables having clob column.
Could anyone help me in correcting the below script for ctrl file inorder to load the data which is in mentioned format.
Any help really appreciated.
Table Script
Create table samp
no number,
col1 clob,
col2 clob
Ctrl File
options (skip =1)
load data
infile 'c:\1.csv'
Replace into table samp
fields terminated by ","
trailing nullcols
no,
col1 Char(100000000) ,
col2 Char(100000000) enclosed by '"' and '"'
Data File(1.csv)
1,asdf,"assasadsdsdsd""sfasdfadf""sdsdsa,ssfsf"
2,sfjass,"dksadk,kd,ss""dfdfjkdjfdk""sasfjaslaljs"
Error Encountered
ORA-01461: can bind a LONG value only for insert into a LONG column
Table sampThanks in advanceI can't reproduce it on my 10.2.0.4.0. CTL file:
load data
INFILE *
Replace into table samp
fields terminated by ","
trailing nullcols
no,
col1 Char(100000000) ,
col2 Char(100000000) enclosed by '"' and '"'
BEGINDATA
1,asdf,"assasadsdsdsd""sfasdfadf""sdsdsa,ssfsf"
2,sfjass,"dksadk,kd,ss""dfdfjkdjfdk""sasfjaslaljs"Loading:
SQL> Create table samp
2 (
3 no number,
4 col1 clob,
5 col2 clob
6 );
Table created.
SQL> host sqlldr scott/tiger control=c:\temp\samp.ctl log=c:\temp\samp.log
SQL> select * from samp
2 /
NO
COL1
COL2
1
asdf
assasadsdsdsd"sfasdfadf"sdsdsa,ssfsf
2
sfjass
dksadk,kd,ss"dfdfjkdjfdk"sasfjaslaljs
NO
COL1
COL2
SQL> SY. -
Need help - How to load data which contains \r\n
Hi All,
We have a requirement wherein we need to load the data from a .dat file, with fields separated by | symbol and the line separator specified as '\r\n'
INFILE '/scratch/xyz/abcd.dat' "STR '\r\n'"
FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
Can you please help us load data which contains multiple lines in a single field to a database table field , keeping the line separator in ctl file as '\r\n' itself.
When we try bringing the '\r\n' within a text field enclosed in "" , the '\r\n' , sqlldr considers it as the end of that record and not as a data which needs to go into a column.
One option we have is to have the extraction process create the data in such a way that the fields with multiple lines , be brought in the .dat file enclosed in "" as
"Test
"|8989|abcd
where the new line in the first field is just '\n' .
Is there any other way in which the requirement can be addressed.
Version: SQL*Loader: Release 11.1.0.7.0
Thanks,
RohinIn addition, you would need to know the character set encoding of the csv files (e.g. the code page used).
Basically you need to have the facts about both client (csv file) and database character set.
As suggested, use the available documentation - it's there to help you!
http://www.oracle.com/technology/tech/globalization/htdocs/nls_lang%20faq.htm
http://download.oracle.com/docs/cd/B19306_01/server.102/b14225/ch2charset.htm -
Hi all
The current requirement we have is to Load data from Excel File to oracle Databases.
The Excel file has around 30 Sheets , each corresponds to a table, ( means 30 tables in the database) .
Currently we are using sqlldr commands to load data from CSV files to the Oracle Database. The only problem is that sometime the DBA has to go out or is busy workign on somthing else, so May i kindy get some expert suggestions on how to automate this DataLoading Task.
Somebody has suggested to My Manager ( who is not aware of oracle and IT at all) that data can be loaded via ODBC. It is suggested to him that all we need to do is to place the CSV files on the Server at a particular folder and Oracle will do the rest.
I am not that proficient in Data loading methods.. so may i know any technique which will simplify/automate the Task.
I mean how can we automate so that every time , the the sql loader scripts run at command promt. I think data base ( Oracle ) as nothing to do with command promt i feel. isnt it ..
Kindly have ur expert./experienced suggestions.
I would be highly grateful to all
RegardsTo automate sqlldr scripts, you would usually write a OS script file that will periodically looks for files in a given directory and run the sqlldr commands:
- on Windows: .bat or .wsh files to be scheduled with "at" command or windows scheduled tasks tool
- on Unix: a script shell in the crontab.
Much more complicate but without any OS script:
- write a PL/SQL code to read, parse the file to be loaded using UTL_FILE
package
- this PL/SQL code must also generate INSERT statements and process errors ...
- this PL/SQL code can be scheduled with DBMS_JOB package to run a periodic intervals.
Message was edited by:
Pierre Forstmann -
Problem with loading data using SQL LOADER
I am having following files with me when i run following command at command prompt
sqlldr scott/tiger@genuat control =c:\emp.ctl
then giving error as
SQL Loader 500: unable to open file
SQL Loader 553: file not found
emp.dat file data
1111,sneha,CLERK 7902,17-Dec-80,800,20
2222,manoj,SALESMAN,7698,20-Feb-72 ,1600,6500,30
3333,sheela,MANAGER,7839,8-Apr-81,2975,20
emp.ctl file
LOAD DATA
INFILE 'c:\emp.dat'
APPEND
INTO TABLE emp
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(EMPNO,
ENAME ,
JOB,
MGR,
HIREDATE,
SAL ,
COMM,
DEPTNO)
can anyone tell me what is problem in above file why data is not loaded in table??I don't find any problem if you invoke the SQLLDR using the below command(and if you are certain that the control file resides in the C: drive).
sqlldr scott/tiger@genuat control =c:\emp.ctl
If this doesn't work then invoke the SQLLDR from the C: prompt itself.
sqlldr scott/tiger@genuat control=emp.ctl
It would locate the control file and check whether the sqlldr completes successfully?
Maybe you are looking for
-
When they un-upgrade iPhoto email templates? Along with Apple Maps, another software I won't use anymore.
-
Iphone 5 crash after update ios7
before ios 7 I had no problem with using my iphone 5... however, ever since I have updated it it has started crashing .... the screen turns black and it gets broken ... When I attempt to bring it back to its working condition by using itunes...it ope
-
Lightroom 4 resizing on export feature - using the "long edge" resize option - doesn't seem to work
In previous versions of Lightroom (prior to 4), when I used the resize feature while exporting, I often used the "long edge" value to resize. Previously, when I selected 2500 as the "long edge" value, I would receive exported JPGs in a size of someth
-
Playback menu blacked out on web pages when viewed with a PC
I created my web page on my Mac, then published it. It looks fine on my Mac, but when I view my site on a PC, the video page doesn't have the playback buttons visible under the movies. Anyone know how I can fix this so that my friends and family can
-
Verizon Community Book of Records.
How about a sticky thread somewhere like in the FAQ that gets updated. Or a top stats page. I just found the top kudoed post of all time and thought it was interesting. 70 Kudos. http://forums.verizon.com/t5/kudos/kudosleaderboardpage/timerange/all/t