Error SQL Loader loading a field date
HelloI get the error while I'm trying to load a table with a field of date using SQL Loader below
Sheet 1: Rejected - error on the table RPT_HOST_USAGE, column USAGE_TIMESTAMP.
ORA-01861: literal does not match the format string
My input file is as below
< code >
Host_Usage_ID, Host_ID, Technology_ID, Environment_ID, Usage_Timestamp, Avg_CPU_Pct, Avg_Memory_MB, CPU_Spike
1,12,1,8,'2009-08-01 00:00:00 ', 0.000000000, 23875.000000000, 0.000000000
< code >
My Loader.ctl is
< code >
OPTIONS (SKIP = 1)
load data
INFILE 'C:\rpt_Host_Usage.txt '.
in the RPT_HOST_USAGE table
fields completed by «,»
(
HOST_USAGE_ID,
HOST_ID,
TECHNOLOGY_ID,
ENVIRONMENT_ID,
USAGE_TIMESTAMP,
AVG_CPU_PCT,
AVG_MEMORY_MB,
CPU_SPIKE
)
< code >
I tried options like USAGE_TIMESTAMP TO_DATE(USAGE_TIMESTAMP,'YYYY-MM-DD HH24:MI:SS') but did not...
Can you please tell me how to fix this?
Pointers on it will be useful
Thank you
Mahesh
I went back and looked at some of my old files of *.ctl and I did something simlilar to what you mentioned and it worked for me, but I was surrounded by the quotes option and included a colon in front of the element. Example:
...
TECHNOLOGY_ID,
ENVIRONMENT_ID,
USAGE_TIMESTAMP ' to_date (: USAGE_TIMESTAMP, "YYYY-MM-DD HH24:MI:SS)."
AVG_CPU_PCT,
AVG_MEMORY_MB,
....
Tags: Database
Similar Questions
-
What is the cause of the error SQL * Loader-925: the ulprep error: extraction?
Hello
I use SQL Loader to load a file into a partitioned table. However, the performance charger throws the following error message:
SQL * Loader-925: the ulprep error: extraction
ORA-01031: insufficient privileges
Please can someone explain what the possible cause of this error?
Thanks in advance
Annietry to view the logfile too. the log file can be useful.
ORA-01031: insufficient privileges-> indicates the user account does not have access to the table.
-
Forcing errors when loading essbase nonleaf data loading
Hi all
I was wondering if anyone had experience forcing data load errors when loadrules is trying to push the nonleaf members data in an essbase cube.
I obviously ETL level to prevent members to achieve State of charge which are no sheet of error handling, but I would however like the management of the additional errors (so not only fix the errors).
ID much prefer errors to be rejected and shown in the log, rather than being crushed by aggregation in the background
Have you tried to create a security filter for the user used by the load that allows only write at level 0 and not greater access?
-
Error in cfqueryparam, when obtaining field date the cfpop
Hi all
I take the data of the cfpop to store them in the database. There are problems with date data:
INSERT...
POST_DATE = < cfqueryparam value = "" #date # "cfsqltype ="cf_sql_timestamp">"
But it will fail in some situations, for example:
The cause of this output exception was that: coldfusion.runtime.locale.CFLocaleBase$ InvalidDateTimeException: '19 Sep 2006 00:51:33 ' + 0200 is an invalid date or time string
OK, I'm using the English locale and tried to use ParseDateTime (date, "pop"). But that doesn't work either (!):
'19 sep 2006 00:51:33 ' + 0200 isn't a valid date format. But guess 'pop', it comes with zone offset format!
PS The problem was that some of the emails had incorrect date format: it had no a week day, another - same day of the month!
To make life simpler, I just added a control of regexp:
< cfif ReFindNoCase ("[A - z] {3} \,\s [0-9] {2} \s [A - z] {3} \s [0-9] {2,4} \s [0-9] {2}: [0-9] {2}: [0-9] {2} \s (?:------+ |)") \-) ? [0-9] {4} "(, ce jour, 0) >"
< cfset dateField = date >
< cfelse >
< cfset dateField = now() >
< / cfif >
I'm not going to analyze each possible date format error.Hi all
I take the data of the cfpop to store them in the database. There are problems with date data:INSERT...
POST_DATE =But it will fail in some situations, for example:
The cause of this output exception was that: coldfusion.runtime.locale.CFLocaleBase$ InvalidDateTimeException: '19 Sep 2006 00:51:33 ' + 0200 is an invalid date or time string
OK, I'm using the English locale and tried to use ParseDateTime (date, "pop"). But that doesn't work either (!):
'19 sep 2006 00:51:33 ' + 0200 isn't a valid date format. But guess 'pop', it comes with zone offset format!
PS The problem was that some of the emails had incorrect date format: it had no a week day, another - same day of the month!
To make life simpler, I just added a control of regexp:
I'm not going to analyze each possible date format error.
-
How to handle multiple formats of date to the same date field in SQL * Loader
Dear all,
I have a requirement where I need to get data from a text file and even insert into the oracle table.
I'm using SQL * Loader to fill data from the text file in my table.
The file has an area where I expect to date data date in different formats, such as MON/dd/yyyy mon/dd/yyyy mon/dd/yyyy, dd/mm/yyyy, DD/month/yyyy.
When you use SQL * Loader, I can see loading fails for records where we have formats such as LUN/jj/aaaa, Mon/dd/yyyy, DD/month/yyyy.
Is it possible in SQL * Loader where we can mention all these date formats so that data from that date should go smoothly in the underlying date column in the table.
Receive your answer on that.
Thank you
Madhu K.I think following could be the solution to your problem:
Suppose if you have data from four different date formats, you need to load the data into four different tables by running SQL * Loader four times and each time specify other date format in the control file whose data to load, and then at the end, merge data from these four different tables using the UNION clause.
Elya
-
Error in loading data with SQLLDR in Oracle 10 G
Hello
Can one suggest what the problem is in the slot mentioned control file used for loading data via SQL * LOADER
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DOWNLOAD THE DATA
INFILE 'D:\test\temt.txt '.
BADFILE "test.bad."
DISCARDFILE 'test.dsc '.
IN THE TABLE 'TEST '.
INSERT
(INTEGER SRNO (7))
PROD_ID INTEGER (10),
PROMO_ID INTEGER (10),
CHANNEL_ID INTEGER (10),
UNIT_COST INTEGER (10),
UNIT_PRICE INTEGER (10)
)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I'm trying to load data in the schema SCOTT scott user.
Why make such a mistake, please see the attached 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 leadership: test.bad
Delete the file: test.dsc
(Allow all releases)
Number of loading: ALL
Number of jump: 0
Authorized errors: 50
Link table: 64 lines, maximum of 256000 bytes
Continuation of the debate: none is specified
Path used: classics
Table 'TEST', loaded from every logical record.
Insert the option in effect for this table: INSERT
Column Position Len term Encl. Datatype name
------------------------------ ---------- ----- ---- ---- ---------------------
SRNO FIRST 7 INTEGER
PROD_ID INTEGER 10 NEXT
PROMO_ID INTEGER 10 NEXT
CHANNEL_ID INTEGER 10 NEXT
UNIT_COST INTEGER 10 NEXT
UNIT_PRICE INTEGER 10 NEXT
Sheet 1: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Sheet 2: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Sheet 3: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Folder 4: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Sheet 5: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Sheet 6: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Sheet 7: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Sheet 8: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
File 9: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Case 10: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Factsheet 11: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Sheet 12: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
File 13: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Fact sheet 14: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Fact sheet 15: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Sheet 16: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
File 17: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Sheet 18: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
File 19: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Sheet 20: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Sheet 21: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Account 22: rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Sheet 23: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Record number of 24: rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Sheet 25: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Fact sheet 26: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Fact sheet 27: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Record 28: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Record 29: rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Record 30: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Record of 31: rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
• Statement 32: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Record 33: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Page 34: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Record 35: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Record 36: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Record 37: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Record 38: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Sheet 39: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Record 40: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Sheet 41: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Page 42: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Record 43: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Sheet 44: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Record 45: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
• Statement 46: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Record 47: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Record 48: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Record 49: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Page 50: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
Record 51: Rejected - error on the table 'TEST '.
ORA-01460: dead letter or unreasonable conversion requested
NUMBER of MAXIMUM ERRORS EXCEEDED - above the statistics reflect partial performance.
Table 'TEST'
0 rows successfully loaded.
51 lines not filled due to data errors.
0 rows not loading because all WHEN clauses were failed.
0 rows not populated because all fields are null.
The space allocated to bind table: 3648 bytes (64 lines)
Bytes of read buffer: 1048576
Total logical records ignored: 0
Total logical records read: 64
Total rejected logical records: 51
Total logical records ignored: 0
Run started on Fri Mar 20 14:43:35 2009
Run finished Fri Mar 20 14:43:43 2009
Time was: 00:00:07.98
Time processor was: 00:00:00.28
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Here is the method to use 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)
Use sqlldr process 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 the point reached - the number of logical records 64
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I even tried a few examples,
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Which of the below control record make sense,
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-1
DOWNLOAD THE DATA
INFILE 'D:\test\temt.txt '.
BADFILE "test.bad."
DISCARDFILE 'test.dsc '.
IN THE TABLE 'TEST '.
INSERT
COMPLETED FIELD BY (EN)
(INTEGER SRNO (7))
PROD_ID INTEGER (10),
PROMO_ID INTEGER (10),
CHANNEL_ID INTEGER (10),
UNIT_COST INTEGER (10),
UNIT_PRICE INTEGER (10)
)
-2
DOWNLOAD THE DATA
INFILE 'D:\test\temt.txt '.
BADFILE "test.bad."
DISCARDFILE 'test.dsc '.
IN THE TABLE 'TEST '.
INSERT
DOMAIN TERMINATED BY, eventually surrounded "" "
(INTEGER SRNO (7))
PROD_ID INTEGER (10),
PROMO_ID INTEGER (10),
CHANNEL_ID INTEGER (10),
UNIT_COST INTEGER (10),
UNIT_PRICE INTEGER (10)
)
For the 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 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL * Loader-350: error of syntax on line 8.
Expecting "(", found "FIELD".
COMPLETED FIELD BY (EN)
^
* And for the code - 2 I get the error below *.
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: error of syntax on line 8.
Expecting "(", found "FIELD".
DOMAIN TERMINATED BY, eventually surrounded "" "
^
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Hello
This will help for you
LOAD DATA INFILE 'D:\test\temt.txt' BADFILE 'test.bad' DISCARDFILE 'test.dsc' INSERT INTO TABLE "TEST" FIELDS TERMINATED BY ',' (SRNO INTEGER EXTERNAL , PROD_ID INTEGER EXTERNAL, PROMO_ID INTEGER EXTERNAL, CHANNEL_ID INTEGER EXTERNAL, UNIT_COST INTEGER EXTERNAL, UNIT_PRICE INTEGER EXTERNAL )
Thank you
-
DOWNLOAD THE DATA
INFILE 'c:\folder\sample.txt '.
DISCARDFILE 'c:\folder\sample.dis '.
ADD IN THE TABLE user.tmp_tbl
FIELDS TERMINATED BY ' ~'
WHEN (1) = "1"
(record_type,
Key_ID,
Key3,
Key4
)
Add THE tmp_tbl2 TABLE
FIELDS TERMINATED BY ' ~'
WHEN (1) = "2"
(rec_type,
Key_ID,
Key3,
Key4,
region_cd
)
Get the following error
SQL * LOADER - 350:SYNTAX IN LINE 6.
WAITING FOR "(" FIND KEYWORD WHEN
WHEN (1) = "1"
^It looks good to me, but it might be the location of your clause 'fields terminated by '.
See examples here:
http://www.orafaq.com/Forum/t/63674/0/
DOWNLOAD THE DATA
ADD
IN THE LOGO OF THE TABLE
WHEN (01) = '1'
FIELDS TERMINATED BY ' |'
EVENTUALLY FRAMED BY ' '
TRAILING NULLCOLS
(
INDICATOR FILLING position (1).
LOGO_CD,
LOGO_NM,
LOGO_DESC_TX "decode(:LOGO_DESC_TX,,:LOGO_NM,:LOGO_NM)"
LOGO_EFF_DT 'trunc (sysdate). "
LOGO_TRMNT_DT FILLING,
CRE_USR_ID "USER."
CRE_TS SYSDATE,
UPDT_USR_ID "USER."
UPDT_TS SYSDATE
)
IN THE LTR_LOGO TABLE
WHEN (01) = '2'
FIELDS TERMINATED BY ' |'
EVENTUALLY FRAMED BY ' '
TRAILING NULLCOLS
(
FILLING of INDICATOR1 position (1).
ACCT_ORG_CD "TO_NUMBER(:ACCT_ORG_CD)"
LOGO_CD,
LTR_LOGO_EFF_DT 'trunc (sysdate). "
LTR_LOGO_TRMNT_DT FILLING,
CRE_USR_ID "USER."
CRE_TS SYSDATE,
UPDT_USR_ID "USER."
UPDT_TS SYSDATE
) -
Dear friends,
Please guide me with this.
What is bad here in this?LOAD DATA INFILE 'D:\load\dat\Enquiry_reply.dat' BADFILE 'D:\load\bad\Enquiry_reply.bad' DISCARDFILE 'D:\load\dat\discard\Enquiry_reply.dsc' replace INTO TABLE OES_Enquiry FIELDS TERMINATED BY '[' (Reply CLOBFILE("D:\load\dat\oes_enquiry_reply.dat") TERMINATED BY '[')
Please me tips on how to on this subject.I am getting error: *SQL*Loader-350: Syntax error at line 6.* Expecting "," or ")", found "CLOBFILE". (Reply CLOBFILE("D:\load\dat\enquiry_reply.dat") TERMINATED BY '['
Thanks in advance.
Nith
Published by: user645399 on November 30, 2010 18:58Hello
Use single quotes inside of double quotes for the path and file name.
+ ("' D:\load\dat\oes_enquiry_reply.dat'") +.
Thank you.
-
SQL Loader with the line terminator
Dear friends,
I use Oracle 10 g R2.
Need to load some records to a text file to Oracle.
It's my control file:
and received the error:LOAD DATA INFILE 'D:\load\dat\FinNote.dat' BADFILE 'D:\load\bad\FinNote.bad' DISCARDFILE 'D:\load\dat\discard\FinNote.dsc' INSERT INTO TABLE FinNote FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS ( IDNo, RegDate date 'YYYY-MM-DD HH24:MI:SS', Col1, Remark, UserID, Status) {code} My text file has semicolon as a row delimiter and | as column delimiter. Now, how can I add the semicolon as row delimiter. Please guide me. I followed the method given in this site: http://www.exforsys.com/tutorials/oracle-10g/oracle-10g-sql-loader-input-data-and-datafiles.html *INFILE datafile_name ["str terminator_string"]* {code} LOAD DATA INFILE 'D:\load\dat\CRS_FinNote.dat' ";" BADFILE 'D:\load\bad\CRS_FinNote.bad' DISCARDFILE 'D:\load\dat\discard\CRS_FinNote.dsc' INSERT INTO TABLE CRS_FinNote FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS ( StudentNo, IDate date 'YYYY-MM-DD HH24:MI:SS', Topic, Remark, UserID, Status)
SQL * Loader-500: could not open the file (D:\load\dat\CRS_FinNote.dat)
SQL * Loader-555: unrecognized property treatment option
SQL * Loader-509: System error: the operation completed successfully.
SQL * Loader-2026: the charge was dropped because SQL Loader cannot continue.
SQL * Loader-513: cannot close the file (D:\load\dat\CRS_FinNote.dat)
SQL * Loader-559: Error closing file
SQL * Loader-509: System error: the storage control block address is invalid.
Thanks in advance.
Nith
Published by: user645399 on June 16, 2010 10:35And, if your CRS_FinNote.dat look like below (line/record delimited; then)
1245|2000-05-16|Oracle|The Best|AAA|Online; 294|2000-04-03|Dotnet|Best|BBB|Pending; 300|2010-03-28|C++|The Best|CCC|Offline;
Scott@ORCL > select utl_raw.cast_to_raw (';') under "hexadecimal;" double;
in hexadecimal
--------------------------------------------------------------------------------
3BThen I change user645399.ctl with below:
LOAD DATA INFILE 'd:\csv\CRS_FinNote.dat' "str X'3B'" BADFILE 'd:\csv\FinNote.bad' DISCARDFILE 'd:\csv\FinNote.dsc' INSERT INTO TABLE FinNote FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS ( IDNo, RegDate date 'YYYY-MM-DD HH24:MI:SS', Col1, Remark, UserID, Status)
The idea received a link from http://www.orafaq.com/forum/t/140062/0/.
C:\Documents and Settings\Girish Sharma>sqlldr scott/tiger@orcl control=d:\csv\user645399.ctl log=user645399.log Enter user-name: scott/tiger Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options SCOTT@orcl> select * from finnote; IDNO REGDATE COL1 REMARK USERID STATUS ---------- -------------------- ---------- ---------- ---------- ---------- 1245 16-may-2000 00:00:00 Oracle The Best AAA Online 294 03-apr-2000 00:00:00 Dotnet Best BBB Pending 300 28-mar-2010 00:00:00 C++ The Best CCC Offline SCOTT@orcl>
HTH
Girish Sharma -
SQL Loader control file (.ctl) given in table
Hello
I have a table 'region' in my schema called dss.
SQL > desc region
I want to LOAD the data into this table of the region in a file called "region.tbl" located at d:\tpch\region.tbl, using a CONTROL file that is also on the the same place is to say d:\tpch\region.ctl.
R_REGIONKEY
R_NAME
R_COMMENT
Region.tbl file contains few records. Recording of a SAMPLE of region.tbl is as follows:
* 1 | AMERICA | HS ironic use, same request. s | *
Region.CTL file contains the following lines to load data using sql loader:
DOWNLOAD THE DATA
INFILE'd:\tpch\region.tbl'
IN THE REGION OF THE TABLE
FIELDS TERMINATED BY ' |'
* (R_REGIONKEY, R_NAME, R_COMMENT) *.
so I go to the command prompt, navigate to the location of the above files and run the command:
D:\TPCH > sqlldr control = region.ctl dss/dss = userid
and get the following error:
SQL * Loader-128: unable to start session
ORA-01017: name of user and password invalid. connection refused
I have the same table under the "system" user creation, but I get a different error with this that is:
SQL * Loader-941: error when the table REGION describe statement
ORA-04043: object REGION does not exist
Using Oracle 11 g on my Windows XP.
I'll appreciate the valuable suggestion.
Thank you very much.
Best regards
KamYou can connect with dss/dss? For example, what
sqlplus dss/dss
If no, and you are sure that the name of username/password combination is correct, have you checked things like $ORACLE_SID - i.e. it points to the right database?
-
Hi s/n,.
I am facing problems when loading the dates in the database by using sql loader. My data file can have several date formats, so I have a function that interprets date and removes the time settings and the date of return.
Something like that.
For example:
I have a table-
CREATE TABLE TEMP1234
(
IDENTIFICATION NUMBER,
DATE OF ASOF_DATE
);
Data file
10001172 | 09/12/1945
Control file:
OPTIONS (DIRECT = TRUE, SILENT (FEEDBACK) =, skip = 0)
DATA RELATING TO SUNK COSTS
REPLACE
in the temp1234 table
' fields completed by "|" possibly provided by ' "'
TRAILING NULLCOLS
(ID,
ASOF_DATE "decode (: ASOF_DATE, null,:ASOF_DATE,conv_date1(:ASOF_DATE))).
)
Function CONV_DATE1:
FUNCTION to CREATE or REPLACE conv_date1 (p_str IN VARCHAR2)
DATE OF RETURN
IS
RETURN_VALUE DATE;p_str1 VARCHAR2 (15): = NULL;
FmtArray TYPE IS a TABLE OF VARCHAR2 (30);
g_fmts fmtArray
: = fmtArray ("yyyy-mm-dd",
"yyyy/mm/dd"
mm/dd/yyyy"."
"dd-mm-yyyy",
"dd/mm/yyyy",
"mm-dd-yyyy");
BEGIN
p_str1: = SUBSTR (p_str, 1, 10);BECAUSE me in 1... g_fmts. COUNTY
LOOP
BEGIN
return_value: = TO_DATE (p_str1, g_fmts (i));
EXIT;
EXCEPTION
WHILE OTHERS
THEN
NULL;
END;
END LOOP;IF (return_value IS NULL)
THEN
RAISE PROGRAM_ERROR;
END IF;RETURN Return_value;
END;
/In this case, if the year in the data file shown in 1945, date which is load in the poster 2045 database.
But when I run this function by putting a sql editor - it returns the correct value.
Select double conv_date1('12/09/1945');
Please help me understand what is causing the problem.
I think there may be an implicit conversion going on with the combination of decode and checking nvl and function within SQL * Loader. I put the nvl checking in function and simply use the function in the control file, as shown below.
OPTIONS (DIRECT = TRUE, SILENT (FEEDBACK) =, skip = 0)
DATA RELATING TO SUNK COSTS
REPLACE
in the temp1234 table
' fields completed by "|" possibly provided by ' "'
TRAILING NULLCOLS
(ID,
asof_date ' conv_date1 (: asof_date).
)
FUNCTION to CREATE or REPLACE conv_date1 (p_str IN VARCHAR2)
DATE OF RETURN
IS
RETURN_VALUE DATE;
p_str1 VARCHAR2 (15): = NULL;
FmtArray TYPE IS a TABLE OF VARCHAR2 (30);
g_fmts fmtArray
: = fmtArray ("yyyy-mm-dd",
"yyyy/mm/dd"
mm/dd/yyyy"."
"dd-mm-yyyy",
"dd/mm/yyyy",
"mm-dd-yyyy");
BEGIN
IF p_str IS NULL
THEN RETURN NULL;
ON THE OTHER
p_str1: = SUBSTR (p_str, 1, 10);
BECAUSE me in 1... g_fmts. COUNTY
LOOP
BEGIN
return_value: = TO_DATE (p_str1, g_fmts (i));
EXIT;
EXCEPTION
WHILE OTHERS
THEN
NULL;
END;
END LOOP;
IF (return_value IS NULL)
THEN
RAISE PROGRAM_ERROR;
END IF;
RETURN Return_value;
END IF;
END;
/
-
On the use of SQL * loader program pl/sql command
Is it possible to develop a PL/SQL program that calls SQL * Loader (sqlldr userid =...) command?
We want to package a process that loads data from a text file into a table, and we research it is possible to use SQL * Loader to the data loading process.
You can launch sqlldr like all other orders of operation. There are several methods of cooking OS command, as
1. external procedure PL/SQL: CHMOD FROM A PLSQL?
Johan's blog: how to call PL/SQL kernel32.dll.
2 Java Stored Procedure: Blog of Johan: using JAVA in PL/SQL - PART - I list files with timestamp , Blog of Johan: using JAVA in PL/SQL - PART - II operating system information obtaining
3. external PREPROCESSOR Table function: no response on java not call windows in oracle command
4. using DBMS_SCHEDULER,
job_type => 'executable' and
job_action => '/bin/sh' (may be)
-
Hi all
I created a sql * simultaneous program of charger with a parameter to pass the path of the data file with file name. Now my question is how does the program know that the control file is in a specific path.
For example, I kept the control file in the $XXX_TOP/bin and the data file in the $XXX_TOP.
I have now in the program parameter, pass the path of the data file, but how the program takes the path of the default control file $XXX_TOP/bin.
Thanks and greetings
El MI created a sql * simultaneous program of charger with a parameter to pass the path of the data file with file name. Now my question is how does the program know that the control file is in a specific path.
For example, I kept the control file in the $XXX_TOP/bin and the data file in the $XXX_TOP.
I have now in the program parameter, pass the path of the data file, but how the program takes the path of the default control file $XXX_TOP/bin.
You can provide information on the data file in the control file, or switch the full directory path and the name of your file as an argument. Concurrent Manager passes the "data = (full path of the data file)" token at query execution time. Without a data file name, the concurrent manager ignores this token and SQL * Loader uses the data file name specified in the control file.
http://docs.Oracle.com/CD/E18727_01/doc.121/e12897/T302934T458254.htm#4163833
The control file must be placed in the directory XX_TOP/bin $.
http://oracleapplications99.blogspot.ca/2011/12/sqlloader-examples.html
http://imdjkoch.WordPress.com/2010/08/12/registering-SQL-Loader-as-a-concurrent-program/
http://erpschools.com/articles/SQL-LoaderThank you
Hussein -
Error loading data using SQL loader
I get an error message like "SQL * Loader - 350 combination illegal syntax of non-alphanumeriques characters error during loading of a file using SQL loader in RHEL." The command used to run SQL * Loader is:
Sqlldr userid = < user name > / < password > control = data.ctl
The control file is data.ctl:
DOWNLOAD the data
INFILE ' / home/oraprod/data.txt'
Add in the table test
{
EmpID completed by «,»,
fname completed by «,»,
lname completed by «,»,
treatment is completed with a white space
}
The data.txt file is:
1, Kaushal, Hamad, 5000
2, Chetan, Hamad, 1000
Hopefully, my question is clear.
Please get back with the answer to my query.
Concerning
Replace "{" by "("dans votre fichier de contrôle) "
DOWNLOAD the data
INFILE 'c:\data.txt.
Add the emp_t table
(
EmpID completed by «,»,
fname completed by «,»,
lname completed by «,»,
treatment is completed with a white space
)
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 the point reached - the number of logical records 1
Commit the point reached - the number of logical records 2
SQL > select * from emp_t;
EMPID, FNAME LNAME SALARY
---------- -------------------- -------------------- ----------
1 kone hamadi 5000
2 Chetan Hamad 1000
Best regards
Mohamed Houri
-
Question to load data using sql loader in staging table, and then in the main tables!
Hello
I'm trying to load data into our main database table using SQL LOADER. data will be provided in separate pipes csv files.
I have develop a shell script to load the data and it works fine except one thing.
Here are the details of a data to re-create the problem.
Staging of the structure of the table in which data will be filled using sql loader
create table stg_cmts_data (cmts_token varchar2 (30), CMTS_IP varchar2 (20));
create table stg_link_data (dhcp_token varchar2 (30), cmts_to_add varchar2 (200));
create table stg_dhcp_data (dhcp_token varchar2 (30), DHCP_IP varchar2 (20));
DATA in the csv file-
for stg_cmts_data-
cmts_map_03092015_1.csv
WNLB-CMTS-01-1. 10.15.0.1
WNLB-CMTS-02-2 | 10.15.16.1
WNLB-CMTS-03-3. 10.15.48.1
WNLB-CMTS-04-4. 10.15.80.1
WNLB-CMTS-05-5. 10.15.96.1
for stg_dhcp_data-
dhcp_map_03092015_1.csv
DHCP-1-1-1. 10.25.23.10, 25.26.14.01
DHCP-1-1-2. 56.25.111.25, 100.25.2.01
DHCP-1-1-3. 25.255.3.01, 89.20.147.258
DHCP-1-1-4. 10.25.26.36, 200.32.58.69
DHCP-1-1-5 | 80.25.47.369, 60.258.14.10
for stg_link_data
cmts_dhcp_link_map_0309151623_1.csv
DHCP-1-1-1. WNLB-CMTS-01-1,WNLB-CMTS-02-2
DHCP-1-1-2. WNLB-CMTS-03-3,WNLB-CMTS-04-4,WNLB-CMTS-05-5
DHCP-1-1-3. WNLB-CMTS-01-1
DHCP-1-1-4. WNLB-CMTS-05-8,WNLB-CMTS-05-6,WNLB-CMTS-05-0,WNLB-CMTS-03-3
DHCP-1-1-5 | WNLB-CMTS-02-2,WNLB-CMTS-04-4,WNLB-CMTS-05-7
WNLB-DHCP-1-13 | WNLB-CMTS-02-2
Now, after loading these data in the staging of table I have to fill the main database table
create table subntwk (subntwk_nm varchar2 (20), subntwk_ip varchar2 (30));
create table link (link_nm varchar2 (50));
SQL scripts that I created to load data is like.
coil load_cmts.log
Set serveroutput on
DECLARE
CURSOR c_stg_cmts IS SELECT *.
OF stg_cmts_data;
TYPE t_stg_cmts IS TABLE OF stg_cmts_data % ROWTYPE INDEX BY pls_integer;
l_stg_cmts t_stg_cmts;
l_cmts_cnt NUMBER;
l_cnt NUMBER;
NUMBER of l_cnt_1;
BEGIN
OPEN c_stg_cmts.
Get the c_stg_cmts COLLECT in BULK IN l_stg_cmts;
BECAUSE me IN l_stg_cmts. FIRST... l_stg_cmts. LAST
LOOP
SELECT COUNT (1)
IN l_cmts_cnt
OF subntwk
WHERE subntwk_nm = l_stg_cmts (i) .cmts_token;
IF l_cmts_cnt < 1 THEN
INSERT
IN SUBNTWK
(
subntwk_nm
)
VALUES
(
l_stg_cmts (i) .cmts_token
);
DBMS_OUTPUT. Put_line ("token has been added: ' |") l_stg_cmts (i) .cmts_token);
ON THE OTHER
DBMS_OUTPUT. Put_line ("token is already present'");
END IF;
WHEN l_stg_cmts EXIT. COUNT = 0;
END LOOP;
commit;
EXCEPTION
WHILE OTHERS THEN
Dbms_output.put_line ('ERROR' |) SQLERRM);
END;
/
output
for dhcp
coil load_dhcp.log
Set serveroutput on
DECLARE
CURSOR c_stg_dhcp IS SELECT *.
OF stg_dhcp_data;
TYPE t_stg_dhcp IS TABLE OF stg_dhcp_data % ROWTYPE INDEX BY pls_integer;
l_stg_dhcp t_stg_dhcp;
l_dhcp_cnt NUMBER;
l_cnt NUMBER;
NUMBER of l_cnt_1;
BEGIN
OPEN c_stg_dhcp.
Get the c_stg_dhcp COLLECT in BULK IN l_stg_dhcp;
BECAUSE me IN l_stg_dhcp. FIRST... l_stg_dhcp. LAST
LOOP
SELECT COUNT (1)
IN l_dhcp_cnt
OF subntwk
WHERE subntwk_nm = l_stg_dhcp (i) .dhcp_token;
IF l_dhcp_cnt < 1 THEN
INSERT
IN SUBNTWK
(
subntwk_nm
)
VALUES
(
l_stg_dhcp (i) .dhcp_token
);
DBMS_OUTPUT. Put_line ("token has been added: ' |") l_stg_dhcp (i) .dhcp_token);
ON THE OTHER
DBMS_OUTPUT. Put_line ("token is already present'");
END IF;
WHEN l_stg_dhcp EXIT. COUNT = 0;
END LOOP;
commit;
EXCEPTION
WHILE OTHERS THEN
Dbms_output.put_line ('ERROR' |) SQLERRM);
END;
/
output
for link -.
coil load_link.log
Set serveroutput on
DECLARE
l_cmts_1 VARCHAR2 (4000 CHAR);
l_cmts_add VARCHAR2 (200 CHAR);
l_dhcp_cnt NUMBER;
l_cmts_cnt NUMBER;
l_link_cnt NUMBER;
l_add_link_nm VARCHAR2 (200 CHAR);
BEGIN
FOR (IN) r
SELECT dhcp_token, cmts_to_add | ',' cmts_add
OF stg_link_data
)
LOOP
l_cmts_1: = r.cmts_add;
l_cmts_add: = TRIM (SUBSTR (l_cmts_1, 1, INSTR (l_cmts_1, ',') - 1));
SELECT COUNT (1)
IN l_dhcp_cnt
OF subntwk
WHERE subntwk_nm = r.dhcp_token;
IF l_dhcp_cnt = 0 THEN
DBMS_OUTPUT. Put_line ("device not found: ' |") r.dhcp_token);
ON THE OTHER
While l_cmts_add IS NOT NULL
LOOP
l_add_link_nm: = r.dhcp_token |' _TO_' | l_cmts_add;
SELECT COUNT (1)
IN l_cmts_cnt
OF subntwk
WHERE subntwk_nm = TRIM (l_cmts_add);
SELECT COUNT (1)
IN l_link_cnt
LINK
WHERE link_nm = l_add_link_nm;
IF l_cmts_cnt > 0 AND l_link_cnt = 0 THEN
INSERT INTO link (link_nm)
VALUES (l_add_link_nm);
DBMS_OUTPUT. Put_line (l_add_link_nm |) » '||' Has been added. ") ;
ELSIF l_link_cnt > 0 THEN
DBMS_OUTPUT. Put_line (' link is already present: ' | l_add_link_nm);
ELSIF l_cmts_cnt = 0 then
DBMS_OUTPUT. Put_line (' no. CMTS FOUND for device to create the link: ' | l_cmts_add);
END IF;
l_cmts_1: = TRIM (SUBSTR (l_cmts_1, INSTR (l_cmts_1, ',') + 1));
l_cmts_add: = TRIM (SUBSTR (l_cmts_1, 1, INSTR (l_cmts_1, ',') - 1));
END LOOP;
END IF;
END LOOP;
COMMIT;
EXCEPTION
WHILE OTHERS THEN
Dbms_output.put_line ('ERROR' |) SQLERRM);
END;
/
output
control files -
DOWNLOAD THE DATA
INFILE 'cmts_data.csv '.
ADD
IN THE STG_CMTS_DATA TABLE
When (cmts_token! = ") AND (cmts_token! = 'NULL') AND (cmts_token! = 'null')
and (cmts_ip! = ") AND (cmts_ip! = 'NULL') AND (cmts_ip! = 'null')
FIELDS TERMINATED BY ' |' SURROUNDED OF POSSIBLY "" "
TRAILING NULLCOLS
('RTRIM (LTRIM (:cmts_token))' cmts_token,
cmts_ip ' RTRIM (LTRIM(:cmts_ip)) ")". "
for dhcp.
DOWNLOAD THE DATA
INFILE 'dhcp_data.csv '.
ADD
IN THE STG_DHCP_DATA TABLE
When (dhcp_token! = ") AND (dhcp_token! = 'NULL') AND (dhcp_token! = 'null')
and (dhcp_ip! = ") AND (dhcp_ip! = 'NULL') AND (dhcp_ip! = 'null')
FIELDS TERMINATED BY ' |' SURROUNDED OF POSSIBLY "" "
TRAILING NULLCOLS
('RTRIM (LTRIM (:dhcp_token))' dhcp_token,
dhcp_ip ' RTRIM (LTRIM(:dhcp_ip)) ")". "
for link -.
DOWNLOAD THE DATA
INFILE 'link_data.csv '.
ADD
IN THE STG_LINK_DATA TABLE
When (dhcp_token! = ") AND (dhcp_token! = 'NULL') AND (dhcp_token! = 'null')
and (cmts_to_add! = ") AND (cmts_to_add! = 'NULL') AND (cmts_to_add! = 'null')
FIELDS TERMINATED BY ' |' SURROUNDED OF POSSIBLY "" "
TRAILING NULLCOLS
('RTRIM (LTRIM (:dhcp_token))' dhcp_token,
cmts_to_add TANK (4000) RTRIM (LTRIM(:cmts_to_add)) ")" ""
SHELL SCRIPT-
If [!-d / log]
then
Mkdir log
FI
If [!-d / finished]
then
mkdir makes
FI
If [!-d / bad]
then
bad mkdir
FI
nohup time sqlldr username/password@SID CONTROL = load_cmts_data.ctl LOG = log/ldr_cmts_data.log = log/ldr_cmts_data.bad DISCARD log/ldr_cmts_data.reject ERRORS = BAD = 100000 LIVE = TRUE PARALLEL = TRUE &
nohup time username/password@SID @load_cmts.sql
nohup time sqlldr username/password@SID CONTROL = load_dhcp_data.ctl LOG = log/ldr_dhcp_data.log = log/ldr_dhcp_data.bad DISCARD log/ldr_dhcp_data.reject ERRORS = BAD = 100000 LIVE = TRUE PARALLEL = TRUE &
time nohup sqlplus username/password@SID @load_dhcp.sql
nohup time sqlldr username/password@SID CONTROL = load_link_data.ctl LOG = log/ldr_link_data.log = log/ldr_link_data.bad DISCARD log/ldr_link_data.reject ERRORS = BAD = 100000 LIVE = TRUE PARALLEL = TRUE &
time nohup sqlplus username/password@SID @load_link.sql
MV *.log. / log
If the problem I encounter is here for loading data in the link table that I check if DHCP is present in the subntwk table, then continue to another mistake of the newspaper. If CMTS then left create link to another error in the newspaper.
Now that we can here multiple CMTS are associated with unique DHCP.
So here in the table links to create the link, but for the last iteration of the loop, where I get separated by commas separate CMTS table stg_link_data it gives me log as not found CMTS.
for example
DHCP-1-1-1. WNLB-CMTS-01-1,WNLB-CMTS-02-2
Here, I guess to link the dhcp-1-1-1 with balancing-CMTS-01-1 and wnlb-CMTS-02-2
Theses all the data present in the subntwk table, but still it gives me journal wnlb-CMTS-02-2 could not be FOUND, but we have already loaded into the subntwk table.
same thing is happening with all the CMTS table stg_link_data who are in the last (I think here you got what I'm trying to explain).
But when I run the SQL scripts in the SQL Developer separately then it inserts all valid links in the table of links.
Here, she should create 9 lines in the table of links, whereas now he creates only 5 rows.
I use COMMIT in my script also but it only does not help me.
Run these scripts in your machine let me know if you also get the same behavior I get.
and please give me a solution I tried many thing from yesterday, but it's always the same.
It is the table of link log
link is already present: dhcp-1-1-1_TO_wnlb-cmts-01-1 NOT FOUND CMTS for device to create the link: wnlb-CMTS-02-2
link is already present: dhcp-1-1-2_TO_wnlb-cmts-03-3 link is already present: dhcp-1-1-2_TO_wnlb-cmts-04-4 NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-5
NOT FOUND CMTS for device to create the link: wnlb-CMTS-01-1
NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-8 NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-6 NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-0 NOT FOUND CMTS for device to create the link: wnlb-CMTS-03-3
link is already present: dhcp-1-1-5_TO_wnlb-cmts-02-2 link is already present: dhcp-1-1-5_TO_wnlb-cmts-04-4 NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-7
Device not found: wnlb-dhcp-1-13 IF NEED MORE INFORMATION PLEASE LET ME KNOW
Thank you
I felt later in the night that during the loading in the staging table using UNIX machine he created the new line for each line. That is why the last CMTS is not found, for this I use the UNIX 2 BACK conversion and it starts to work perfectly.
It was the dos2unix error!
Thank you all for your interest and I may learn new things, as I have almost 10 months of experience in (PLSQL, SQL)
Maybe you are looking for
-
Original mail disappeared as an independent but shows in a thread
I received an email (I was part of the 5 addresses). Later, two other people the original was sent, did what I guess was a reply with comments. now the original e-mail no longer exists as a standalone email for me, but I don't see the original in the
-
Pavilion 23-P118: missing drivers - HP Pavilion 23-P118
I reinstalled Windows 7 on a HP Pavilion 23-P118. I was able to install most drivers, mainly because of these forums. I still cannot locate the drivers for the side USB 3.0 Ports. As far as I know, the motherboard is an Amber T 2 / I, but I still can
-
My Windows Vista gives me a message that I am more authentic.
Messed up my laptop my pc has been in a store of the local computer because XP wasn't working. They put vista on, he worked for 6 months now, error message says vista not genuine. Shop is closed what can I do to get my pc off sta vista. I tried a res
-
Connection via the Subscriber request to leave a Msg
Unity 4.0.4 SR1. Here's the scenario: a user connects a VM subscribers. During the reception, the user presses on * and newspapers in the unit. At this point, the unit calls "to allow a virtual machine to press 1, to enter your mailbox, press 2. Note
-
Notifications to blackBerry Smartphones BBM
It seems that when I download an app anyone who is in my BBM contacts list is a message that I downloaded this application. Where can I find the setting so that no one gets this message? Thank you.