Home » RDBMS Server » Server Utilities » sqlldr ORA-01841
sqlldr ORA-01841 [message #610594] |
Fri, 21 March 2014 10:40 |
rob nye
Messages: 7 Registered: October 1999
|
Junior Member |
|
|
this is running on windows
I have a script creating a txt file (in csv file format) which I want to import into an oracle table using sqlldr
but it is erroring with a
Record 1: Rejected - Error on table RFGDBA.TS_SESSION_SNAPSHOT, column SNAPSHOT_TIMESTAMP.
ORA-01841: (full) year must be between -4713 and +9999, and not be 0
this happens for every record in the input file
data
2014/03/21 15:12,andrew.huggon,rdp-tcp#1,2,Active,6,21/03/2014 14:53,eu1ptsw001
2014/03/21 15:12,mick.westwood,rdp-tcp#5,3,Active,9,21/03/2014 14:58,eu1ptsw001
ctl file
Load Data
append into table rfgdba.TS_SESSION_SNAPSHOT
fields terminated by ',' trailing nullcols
(
snapshot_timestamp DATE "YYYY/MM/DD HH24:MI",
username,
session_name,
id,
state,
idle_time,
logon_time DATE "DD/MM/YYYY HH24:MI",
ts_name
)
table definition
CREATE TABLE RFGDBA.TS_SESSION_SNAPSHOT
(
SNAPSHOT_TIMESTAMP DATE,
USERNAME VARCHAR2(30 BYTE),
SESSION_NAME VARCHAR2(30 BYTE),
ID NUMBER,
STATE VARCHAR2(10 BYTE),
IDLE_TIME NUMBER,
LOGON_TIME DATE,
TS_NAME VARCHAR2(30 BYTE)
)
command calling sqlldr
sqlldr PHANTOM/m0nit0r@RICSBA1 data=%%i control=c:\ts_users\sqlload_ts_users.ctl log=c:\ts_users\sqlfiles\%%~ni.log bad=c:\ts_users\sqlfiles\%%~ni.bad discard=c:\ts_users\sqlfiles\%%~ni.dis direct=TRUE skip=0 rows=20000 errors=100000
I cannot fathom why this is erroring
|
|
|
|
Re: sqlldr ORA-01841 [message #610598 is a reply to message #610595] |
Fri, 21 March 2014 11:04 |
rob nye
Messages: 7 Registered: October 1999
|
Junior Member |
|
|
thanks I checked the link,
the input record has 2 different date formats in different fields
I tried following the example but got an error
new ctl file
Load Data
append into table rfgdba.TS_SESSION_SNAPSHOT
fields terminated by ","
DATE FORMAT "YYYY/MM/DD HH24:MI"
(
snapshot_timestamp,
username,
session_name,
id,
state,
idle_time,
logon_time DATE "DD/MM/YYYY HH24:MI",
ts_name
)
gives error
SQL*Loader: Release 11.2.0.1.0 - Production on Fri Mar 21 16:01:57 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
SQL*Loader-350: Syntax error at line 7.
Expecting "(", found keyword date.
DATE FORMAT "YYYY/MM/DD HH24:MI"
^
c:\ts_users>
|
|
|
Re: sqlldr ORA-01841 [message #610603 is a reply to message #610594] |
Fri, 21 March 2014 12:40 |
|
Michel Cadot
Messages: 68728 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
It works for me:
E:\>sqlldr michel/michel control=t.ctl
SQL*Loader: Release 10.2.0.4.0 - Production on Ven. Mars 21 18:39:20 2014
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Commit point reached - logical record count 2
E:\>sqlplus michel/michel
SQL*Plus: Release 10.2.0.4.0 - Production on Ven. Mars 21 18:39:28 2014
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, Oracle Label Security, OLAP, Data Mining
and Real Application Testing options
SQL> select * from TS_SESSION_SNAPSHOT;
SNAPSHOT_TIMESTAMP USERNAME SESSION_NAME ID STATE IDLE_TIME
------------------- ------------------------------ ------------------------------ ---------- ---------- ----------
LOGON_TIME TS_NAME
------------------- ------------------------------
21/03/2014 15:12:00 andrew.huggon rdp-tcp#1 2 Active 6
21/03/2014 14:53:00 eu1ptsw001
21/03/2014 15:12:00 mick.westwood rdp-tcp#5 3 Active 9
21/03/2014 14:58:00 eu1ptsw001
2 rows selected.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining
and Real Application Testing options
E:\>type t.ctl
Load Data
INFILE *
append into table TS_SESSION_SNAPSHOT
fields terminated by ',' trailing nullcols
(
snapshot_timestamp DATE "YYYY/MM/DD HH24:MI",
username,
session_name,
id,
state,
idle_time,
logon_time DATE "DD/MM/YYYY HH24:MI",
ts_name
)
BEGINDATA
2014/03/21 15:12,andrew.huggon,rdp-tcp#1,2,Active,6,21/03/2014 14:53,eu1ptsw001
2014/03/21 15:12,mick.westwood,rdp-tcp#5,3,Active,9,21/03/2014 14:58,eu1ptsw001
|
|
|
|
|
|
|
|
|
|
|
Re: sqlldr ORA-01841 [message #610854 is a reply to message #610805] |
Tue, 25 March 2014 04:05 |
rob nye
Messages: 7 Registered: October 1999
|
Junior Member |
|
|
I found the solution (well for new data fileS)
I have added '-Encoding ASCII ' to the Out-File statement in my data file creation script.
so files are now ok - but......
I have a field that is seconds, but the value in the data file can sometimes be larger ie shows as mi:ss, so the records are being rejected, I have changed it to a character field as although I want the data included, I dont need to do anythign with it.
Many thanks all of you for your help
|
|
|
Goto Forum:
Current Time: Mon Dec 23 02:43:38 CST 2024
|