SQL*Loader : ORA-19007 with missing Schema Location Hint
Hi,
These days I'm stuck with a 10.1.0.4 database (OS Linux Red Hat), and I'm trying to find a workaround for the following situation :
XML schema (sfgtest.xsd)
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb">
<xs:element name="Code" xdb:SQLName="Code" xdb:SQLType="VARCHAR2">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="16"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Val" xdb:SQLType="NUMBER" xdb:SQLName="Val">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:totalDigits value="12"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Chq">
<xs:complexType xdb:SQLType="SFG_CHQ_TYPE">
<xs:sequence>
<xs:element ref="Code"/>
<xs:element ref="Val"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="NbRem" xdb:SQLType="NUMBER" xdb:SQLName="NbRem">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:totalDigits value="5"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Rmbt" xdb:defaultTable="TEST_XML_SFG">
<xs:complexType xdb:SQLType="SFG_RMBT_TYPE">
<xs:sequence>
<xs:element ref="NbRem"/>
<xs:element ref="Rem" maxOccurs="unbounded" xdb:SQLCollType="SFG_REM_COLL"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CodeAff" xdb:SQLName="CodeAff" xdb:SQLType="VARCHAR2">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="12"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Rem" xdb:SQLName="Rem">
<xs:complexType xdb:SQLType="SFG_REM_TYPE">
<xs:sequence>
<xs:element ref="CodeAff"/>
<xs:element ref="Chq" maxOccurs="unbounded" xdb:SQLCollType="SFG_CHQ_COLL"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Sample document (sfgtest.xml)
<?xml version="1.0" encoding="iso-8859-1"?>
<Rmbt>
<NbRem>3</NbRem>
<Rem>
<CodeAff>AFF001</CodeAff>
<Chq><Code>X01001</Code><Val>10.00</Val></Chq>
<Chq><Code>X01002</Code><Val>10.00</Val></Chq>
<Chq><Code>X01003</Code><Val>10.00</Val></Chq>
</Rem>
<Rem>
<CodeAff>AFF002</CodeAff>
<Chq><Code>X02001</Code><Val>10.00</Val></Chq>
<Chq><Code>X02002</Code><Val>10.00</Val></Chq>
<Chq><Code>X02003</Code><Val>10.00</Val></Chq>
</Rem>
<Rem>
<CodeAff>AFF003</CodeAff>
<Chq><Code>X03001</Code><Val>10.00</Val></Chq>
<Chq><Code>X03002</Code><Val>10.00</Val></Chq>
<Chq><Code>X03003</Code><Val>10.00</Val></Chq>
<Chq><Code>X03004</Code><Val>10.00</Val></Chq>
<Chq><Code>X03005</Code><Val>10.00</Val></Chq>
</Rem>
</Rmbt>
Schema registration
begin
dbms_xmlschema.registerSchema(
schemaURL => 'sfgtest.xsd',
schemaDoc => xmltype(bfilename('DUMP_DIR','sfgtest.xsd'),nls_charset_id('AL32UTF8')),
local => true,
genTypes => true,
genTables => false
end;
Table creation
create table test_xml_sfg of xmltype
xmltype store as object relational
xmlschema "sfgtest.xsd"
element "Rmbt"
varray xmldata."Rem" store as table test_xml_sfg_rem_tab
( primary key (NESTED_TABLE_ID, ARRAY_INDEX) ) organization index overflow
varray "Chq" store as table test_xml_sfg_chq_tab
( primary key (NESTED_TABLE_ID, ARRAY_INDEX) ) organization index overflow
);I originally wanted to use SQL*Loader to test performance, as I may have to load multiple files in the same time.
It works great on 10gR2 and 11gR2 with XML files up to 100 MB loaded in a matter of minutes.
However, a little issue with 10gR1 :
SQLLDR control file
LOAD DATA
INFILE 'filelist.txt'
APPEND
INTO TABLE test_xml_sfg
XMLTYPE(XMLDATA) (
filename filler char(260),
XMLDATA LOBFILE(filename) TERMINATED BY EOF
)with filelist.txt :
sfgtest.xmlExecution throws "ORA-19007: Schema - does not match expected sfgtest.xsd".
As per the documentation, it's expected behaviour in 10.1 :
http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10790/xdb03usg.htm#BABECCBG
The XML document must include the appropriate attributes from the XMLSchema-instance namespace or the XML document must be explicitly associated with the XML schema using the XMLType constructor or the createSchemaBasedXML() method.Also as expected, the file is loaded OK after adding the following in the root element :
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="sfgtest.xsd"But, as I don't have any latitude on the files received (i.e. I can't add the location hint), is there some workaround, when using SQL*Loader, to treat the XML file as an instance document?
Thanks for any solution/idea.
Not sure if it will work, but out of the top of my head I would make an attempt to create an view (for update) based on the XMLType table and do the insert via the view, matching the incoming XML doc to the schema via
xmltype(xml_messsage).createSchemaBasedXML(xml_schema)
Similar Messages
-
The Schema Registration and Schema Location Hint Thread
The purpose of this thread is to two fold. The first is to address issues related to the process of registering an XML Schema with Oracle XML DB. The second is to explain how Oracle XML DB determines whether or not a particular XML document is associated with a particular XML Schema.
An XML Schema decribes a class of XML. An XML document that is associated with a particular XML Schema is considered to be an instance of that class, and is often referred to as an instance document.The methodolgy used by XML DB to match instance documents to XML schemas is based on a mechansim defined by the W3C XML schema standard. The W3C standard uses the XMLSchema-instance namespace to add schema specific information to instance documents.
The XMLSchema-instance namespace defines two attibutes that can be used to identify which XML Schema a document is associated with. These attributes are the noNamespaceSchemaLocation attribute and the schemaLocation attribute.
The noNamespaceSchemaLocation attribute is used in conjunction with XML Schemas that do not include a targetNamespace declaration. The schemaLocation attribute is used in conjunction with XML Schemas that declare a targetNamespace
The noNamspaceSchemaLocation attribute is used to supply the Schema Location Hint of the XML schema the document is associated with. For XML DB to recognize that the document is a member of the class defined the XML schema the Schema Location Hint must be an exact for the schemaURL that was used tor register the XML schema with XML DB.
The schemaLocation attribute is used to supply a Schema Location Hint for each namespace used by the instance document. The attribute consists of a set of namespace location mappings. A namespace location mapping consists of a namespace and the Schema Location Hint for the XML Schema that declares that namespace.
An XML Document is considered to be instance of the XML schema if the Schema Location Hint matches the URL of a registered XML Schema that declares the namespace associated with the Schema Location Hint as it's targetNamespace.
For example
First, the instance document must declare the XMLSchema-instance namespace
eg
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"The XMLSchema-instance namespace is used to associated the XML document with an XML schema. It does by supplying a "Schema Location Hint" for the target XML schema. The Schema Location Hint is typically the authoritive location for the XML Schema. When using XML DB the Schema Location Hint must match the URL used to register the XML schema with XML DB when working with XML DB.
The manner is which the schema location hint is supplied depends on hether or not the xml schema contains a targetNamespace declaration
If a targetNamespace is defined then it the instance must include the schemaLocation attribute. The schemaLocation attribute must contain a mapping between the targetNamespace and the Schema Location Hint in the form "namespace schemaLocationHint".
If the XML schema declares a target namespace such as targetNamespace="http://www.opengis.net/examples/packet" and the Schema Location Hint is "gmlpacket.xsd" then you use the schemaLocation attribute. It will look like this.
xsi:schemaLocation="http://www.opengis.net/examples/packet gmlpacket.xsd"If the XML schema does not declare a target namespace then you the noNamespaceSchemaLocation attribute. It will look like this..
xsi:noNamespaceSchemaLocation="gmlpacket.xsd" -
How to call sql loader ctrl file with in the pl/sql procedure
Hi Friends,
I am doing a project related with the transferring data using queues. In the queue , I will get a tab delimited data in the form of CLOB variable/message. I do want to store that dat in the oracle table.
When updating data into the table ,
1. Don't want to write that data into a file.( Want to access directly after dequeueing from the specfic queue).
2. As the data is in tab delimited form, I want to use sql loader concept.
How do I call the sql loader ctrl file with in my pl/sql procedure. When I searched , most of the forums recommending external procedure or Java program.
Please Guide me on this issue. my preferrence is pl sql, But don't know about external procedure . If no other way , I will try Java.
I am using oracle 9.2.0.8.0.
Thanks in advance,
Vimal..Neither SQL*Loader nor external tables are designed to read data from a CLOB stored in the database. They both work on files stored on the file system. If you don't want the data to be written to a file, you're going to have to roll your own parsing code. This is certainly possible. But it is going to be far less efficient than either SQL*Loader or external tables. And it's likely to involve quite a bit more code.
The simplest possible thing that could work would be to use something like Tom Kyte's string tokenization package to read a line from the CLOB, break it into the component pieces, and then store the different tokens in a meaningful collection (i.e. an object type or a record type that corresponds to the table definition). Of course, you'll need to handle things like converting strings to numbers or dates, rejecting rows, writing log files, etc.
Justin -
SQL*LOADER 시 발생하는 ORA-1653 ERROR
제품 : SQL*PLUS
작성날짜 : 2002-04-25
SQL*LOADER 실행 시 발생하는 ORA-1653
====================================
PURPOSE
다음은 SQL*LOADER 실행시 ORA-1653 ERROR가 발생시에 조치하는
방법을 설명한다.
Explanation
ORA-1653 error 는 특정 tablespace 에 space 가 부족해서 table의
extent가 일어나지 못해서 발생하는 error 이다 .
먼저 error message 에서 tablespace name 이 무엇인지 먼저
check 한다.
그리고 다음 command 를 이용해 해당 tablespace 를 늘려주면 된다.
ALTER TABLESPACE tablespace_name ADD DATAFILE '.....' size 100m;
그러나 이때의 tablespace 가 SYSTEM 일 경우는 user 의 default
tablespace 가 잡혀있지 않기 때문이어서 근본적인 해결이 필요하다.
이 경우는 무작정 tablespsace 를 늘리지 말고 user 의 default
tablespace 를 create 후 user 에게 할당해주도록 한다.
CREATE TABLESPACE tablespace_name datafile '...' size 100m;
ALTER USER user_name IDENTIFIED BY passwd
DEFAULT TABLESPACE tablespace_name
TEMPORARY TABLESPACE temp ;
위와 같이 user의 default tablespace 를 변환한 후, 이 default
tablespace 안에 create table을 다시 한 후 sql*loader 를 실행한다.
Reference Documents
--------------------Hi,
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 -
Hi
I´m trying to insert numeric data in a field. NUMBER (10,2). But when i run my control file with SQL Loader i have:
Registro 1: Rechazado - Error en tabla "DM08_POLIZA", columna "SUM_ASEGURADA". ORA-01722: número no válido
I've checked the data and all of them are numerics. Then i delete all the values for this field and i have the problem still.
Does Anybody knows why happens this?
My control File has:
LOAD DATA
CHARACTERSET WE8MSWIN1252
INTO TABLE "DM08_POLIZA"
APPEND
REENABLE DISABLED_CONSTRAINTS
FIELDS
TERMINATED BY '|'
"ID_BASE_ORIGEN" POSITION (1) INTEGER EXTERNAL ,
"ID_ORIGEN" CHAR ,
"ID_POLIZA" INTEGER EXTERNAL ,
FILLER_ID_RETENEDOR FILLER INTEGER EXTERNAL ,
FILLER_ID_UNIDAD_PAGO FILLER INTEGER EXTERNAL ,
FILLER_UNIDAD_ADMON FILLER CHAR ,
FILLER_SECTOR FILLER CHAR ,
FILLER_NUM_SUBGPO FILLER INTEGER EXTERNAL ,
FILLER_AREA FILLER CHAR ,
FILLER_TIPO_CONTRATO FILLER CHAR ,
FILLER_PUESTO FILLER CHAR ,
FILLER_NIVEL_LABORAL FILLER CHAR ,
FILLER_FEC_INGRESO FILLER DATE ,
FILLER_FEC_COTIZ FILLER DATE ,
FILLER_SDO_BASE FILLER INTEGER EXTERNAL ,
FILLER_SDO_NETO_ FILLER INTEGER EXTERNAL ,
FILLER_SEG_GMM FILLER INTEGER EXTERNAL ,
"CANAL" CHAR ,
"ID_TIP_PLAN" INTEGER EXTERNAL ,
"RAMO_SUBRAMO" INTEGER EXTERNAL ,
"NUM_CATEGORIA" INTEGER EXTERNAL ,
"PRIMA_ANUAL" INTEGER EXTERNAL ,
"SUM_ASEGURADA" INTEGER EXTERNAL ,
"PRIMA_ANUAL_DESC" INTEGER EXTERNAL ,
"EXTRA_PRIMA" INTEGER EXTERNAL ,
"PRIMA_BASE" INTEGER EXTERNAL ,
"PRIMA_BASE_CT" INTEGER EXTERNAL ,
"PRIMA_POTENCIADA" INTEGER EXTERNAL ,
"PRIMA_POTENCIADA_CT" INTEGER EXTERNAL ,
"PRIMA_BENEF_ADICIONAL" INTEGER EXTERNAL
INTO TABLE "DM08_DATOS_TRABAJO"
APPEND
REENABLE DISABLED_CONSTRAINTS
FIELDS
TERMINATED BY '|'
"ID_BASE_ORIGEN" POSITION (1) INTEGER EXTERNAL ,
"ID_ORIGEN" CHAR ,
"ID_POLIZA" INTEGER EXTERNAL ,
"ID_RETENEDOR" INTEGER EXTERNAL ,
"ID_UNIDAD_PAGO" INTEGER EXTERNAL ,
"UNIDAD_ADMON_O_EMPRESA" CHAR ,
"SECTOR" CHAR ,
"NUM_SUBGRUPO" INTEGER EXTERNAL ,
"AREA" CHAR ,
"TIPO_CONTRATO" CHAR ,
"PUESTO" CHAR ,
"NIVEL_LABORAL" CHAR ,
"FECHA_INGRESO" DATE ,
"FECHA_PRIMER_COT" DATE ,
"SUELDO_BASE" INTEGER EXTERNAL ,
"SUELDO_NETO" INTEGER EXTERNAL ,
"SEGURO_GMM" INTEGER EXTERNAL ,
FILLER_CANAL FILLER CHAR ,
FILLER_ID_TIP_PLAN FILLER INTEGER EXTERNAL ,
FILLER_RAMO_SUBR FILLER INTEGER EXTERNAL ,
FILLER_NUM_CATEG FILLER INTEGER EXTERNAL ,
FILLER_PRIMA_ANUAL FILLER INTEGER EXTERNAL ,
FILLER_SUM_ASEGURADA FILLER INTEGER EXTERNAL ,
FILLER_PRIM_DESC FILLER INTEGER EXTERNAL ,
FILLER_EXTRA_PRIMA FILLER INTEGER EXTERNAL ,
FILLER_PRIMA_BASE FILLER INTEGER EXTERNAL ,
FILLER_PRIMA_BASE_CT FILLER INTEGER EXTERNAL ,
FILLER_PRIMA_POTANCIADA FILLER INTEGER EXTERNAL ,
FILLER_PRIMA_POT_CT FILLER INTEGER EXTERNAL ,
FILLER_PRIMA_BENEF_ADICIONAL FILLER INTEGER EXTERNAL
My table:
SQL> desc dm08_poliza;
Nombre ¿Nulo? Tipo
ID_BASE_ORIGEN NOT NULL NUMBER(2)
ID_ORIGEN NOT NULL VARCHAR2(15)
ID_POLIZA NOT NULL NUMBER(10)
CANAL VARCHAR2(20)
ID_TIP_PLAN NUMBER(5)
NUM_CATEGORIA NUMBER(3)
PRIMA_ANUAL NUMBER(10,2)
SUM_ASEGURADA NUMBER(10,2)
PRIMA_ANUAL_DESC NUMBER(10,2)
EXTRA_PRIMA NUMBER(10,2)
PRIMA_BASE NUMBER(10,2)
PRIMA_BASE_CT NUMBER(10,2)
PRIMA_POTENCIADA NUMBER(10,2)
PRIMA_POTENCIADA_CT NUMBER(10,2)
PRIMA_BENEF_ADICIONAL NUMBER(10,2)
RAMO_SUBRAMO NUMBER(5)
And a registry is:
1|clave1|1232|2|2|IMSS|SECTOR A|145|REC. HUMANOS|INDEFINIDO|DIR. GENERAL||01/01/2000|01/01/2000||||canal 1|2|8422|558|78239|1173588.61||3911.96|3129.57|3129.57|11735.89|11735.89|11735.89
Thanks for your time.
AlexIf i try changing
INTEGER EXTERNAL by DECIMAL EXTERNAL i get the same result
but if i replace for DECIMAL i got:
SQL*Loader-402: No se ha podido determinar la longitud de la columna FILLER_SDO_BASE a partir de la especificaci¾n
and means that SQL*Loader can't determine the column width.
Can anybody tell me the syntax for my control file to insert a field decimal (10,2)
I tried with
S_B FILLER CHAR "TO_NUMBER(:S_B,'99,999,999.99')",
and i get the follow message error:
SQL*Loader-350: Error de sintaxis en la lÝnea 39.
Se espera "," o ")", se ha encontrado "TO_NUMBER".
S_B FILLER CHAR "TO_NUMBER(:S_B,'99,999,999.99')",
Any ideas or suggestions.
Thanks a lot. -
SQL*Loader and unzipping with uploaded file
hi, everybody
i was trying to integrate some functionalities, today separated. i made a simple Apex page that uploads a file, and now i need to process that file.
is there any way to process that uploaded file and load it onto a table, just like i'd do with Sql*Loader?
in the same way, can i unzip an uploaded zip file, just like Oracle Portal 3.0.9 used to do in its contect areas with zip itens?
thanksHi, Ivo
about ult_compress, ok. i'll check it out.
talking about uploaded files, the only thing i've found were:
a) download an uploaded file
b) use an uploaded image to integrate in a web application.
unfortunately, i didn't find anything that could help me process an uploaded text file the way i do with SQL*Loader.
i'll keep on trying
thanx -
Sql loader performance problem with xml
Hi,
i have to load a 400 mb big xml file into mz local machine's free oracle db
i have tested a one record xml and was able to load succesfully, but 400 mb freeying for half an hour and does not even started?
it is normal? is there any chance i will be able to load it, just need to wait?
are there any faster solution?
i ahve created a table below
CREATE TABLE test_xml
COL_ID VARCHAR2(1000),
IN_FILE XMLTYPE
XMLTYPE IN_FILE STORE AS CLOB
and control file below
LOAD DATA
CHARACTERSET UTF8
INFILE 'test.xml'
APPEND
INTO TABLE product_xml
col_id filler CHAR (1000),
in_file LOBFILE(CONSTANT "test.xml") TERMINATED BY EOF
anything i am doing wrong? thanks for advicesSQL*Loader: Release 11.2.0.2.0 - Production on H. Febr. 11 18:57:09 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Control File: prodxml.ctl
Character Set UTF8 specified for all input.
Data File: test.xml
Bad File: test.bad
Discard File: none specified
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 5000
Bind array: 64 rows, maximum of 256000 bytes
Continuation: none specified
Path used: Conventional
Table PRODUCT_XML, loaded from every logical record.
Insert option in effect for this table: APPEND
Column Name Position Len Term Encl Datatype
COL_ID FIRST 1000 CHARACTER
(FILLER FIELD)
IN_FILE DERIVED * EOF CHARACTER
Static LOBFILE. Filename is bv_test.xml
Character Set UTF8 specified for all input.
SQL*Loader-605: Non-data dependent ORACLE error occurred -- load discontinued.
ORA-01652: unable to extend temp segment by 128 in tablespace TEMP
Table PRODUCT_XML:
0 Rows successfully loaded.
0 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: 256 bytes(64 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records rejected: 0
Total logical records discarded: 0
Run began on H. Febr. 11 18:57:09 2013
Run ended on H. Febr. 11 19:20:54 2013
Elapsed time was: 00:23:45.76
CPU time was: 00:05:05.50
this is the log
i have truncated everything i am not able to load 400 mega into 4 giga i cannot understand
windows is not licensed 32 bit -
Errors when using sql loader direct path with a nvl functin on a date field
I thought I read in 10g that all sql functions now work in direct path mode.
the following function works without direct path mode. When we turn direct path mode on the load fails. When we take the function out in direct path mode it works.
mydate DATE "YYYY-MM-DD" "nvl(:mydatedate,to_date('9999-01-01','YYYY-MM-DD'))"
with direct path mode I get:
EVERY record gets rejected with this error.
Record 10: Rejected - Error on table MYTABLE
ORA-00604: error occurred at recursive SQL level 1
ORA-01861: literal does not match format string
again works fine without direct=true, works fine with direct=true if i get rid of the function.
any ideas?
Message was edited by:
Guess2
Message was edited by:
Guess2like usual your posts are completely useless daniel.
I could have swarn that oracle advertised that you can use functions with 9i or 10g release in the new features guys or the first releases. -
Loading XML file with missing elements dynamically through ODI
Hi Guys ,
I have the below xml file with two nodes Employee and Address. On a daily basis , sometimes the address element might not come in from the source xml file , but my interface has columns mapped to address elements, and hence it can fail due to the source element not being found in the file or data might not get loaded due to the 'and' condition in the sql query generated between the employee and address elements. Is there a way where i can load the data dynamically where i can search in the file only for the elements (Employee) present and load data only for those elements dynamically?
XML File:
<?xml version="1.0" encoding="UTF-8" ?>
<EMP>
<Empsch>
<Employee>
<EmployeeID>12345</EmployeeID>
<Initials>t</Initials>
<LastName>john</LastName>
<FirstName>doe</FirstName>
</Employee>
<Address>
<WorkPhone>12345</WorkPhone>
<WorkAddress>Test 234</WorkAddress>
</Address>
</Empsch>
</EMP>
Thanks ,
Revanth TambisettyI was able to resolve it by using left outer joins and referring the table structure from the XSD
-
How to specify Sql Loader input file with dynamic name
The input file name likes pochange_YYYYMMDD.dat which is generated by other program each day.
I want to load this file to a table.
Any help? Thanks a lotI thought in an excellent strategy to do this:
Conditions:
- you have to have only one file in the folder with the data.
- Independently of the name of that file. A process is always going to change its name to a fix name.
- the controlfile must at another fixed path
the scripts is this one:
joel_sqlloader.bat
ren *.dat always.txt
sqlldr <user>/password data=always.txt control=<another_path>/my_ctl.ctl
- In a folder you will have these files:
* joel_sqlloader.bat
* pochange_YYYYMMDD.dat
- In another folder you will have:
* my_ctl.ctl
Did you get it ?
Joel Pérez
http://otn.oracle.com/experts -
SQL*Loader importing problem, with file with eastern european files
Hello,
on Oracle 11g with UTF-8 encoding, I tried to import a csv file into a table via sqlload, the separator is the semicolon ";" all work fine except for some lines witch are not well integrated (the concerned files come from Eastern European countries like Bulgary, Hungary and Czech Republic).
For example:
For:
text_1; text_2; text_with_char_at_end_like_š; new_text
during the integration instead of have:
| text_1 | text_2 | text_with_char_at_end_like_š| new_text |
I got:
| text_1 | text_2 | text_with_char_at_end_like_š; new_text | null |
does anyone has this problem, I tried to change the delimiter by code X'59', specified in sqlldr ENCODING UTF8 ... but it does not work
do you have an idea about this problem
Thank you in advanceThanks,
the problem was solved since, the file was not in UTF8 format (for example GREEK FORMAT) and the NLS_LANG was AMERICAN_AMERICA ASCII
then i translate all files to UTF 8 and changed the NLS_LANG to UtF8.
Regards -
SQL*LOADER ERROR 비교 (ORA-2359, ORA-1401)
제품 : ORACLE SERVER
작성날짜 : 2002-04-09
SQL*LOADER ERROR 비교 (ORA-2359, ORA-1401)
==========================================
PURPOSE
SQL*LOADER 를 사용하는 경우 ORA-2359 ERROR가 나는 경우와
ORA-1401 ERROR가 나는 경우를 비교한다.
Examples
table 의 desc가 다음과 같다고 가정하자.
SQL> create table test5(a varchar2(1000));
이 경우 delimiter 가 comma 인지 position 으로 구분되는지에 따라 error
message가 달리 나타난다.
1) ORA-2359 : field in datafile exceeded maximum specified length
load data
infile test.dat
replace
into table test5
fields terminated by ','
(a char) 로 실행 시 발생.
---> a char(1000) 으로 하면 error 해결이 가능하다.
2) ORA-1401: inserted value too large for column
load data
infile test.dat
replace
into table test5
fields terminated by ','
(a position(1:2000) char)
---> 이 경우 a position (1:1000) char 로 하면 해결 가능하다 .
* 참고로 + , - 기호와 comma 를 load 하기 위해서는 decimal external을
사용한다. (a position decimal external (10))
Reference Documents
---------------------You hit Bug 3531336
Run the script catcio.sql from $ORACLE_HOME/rdbms/admin directory.
Run this in sys schema.
And then load the data with sqlloader. -
SQL*Loader and multiple files
Hello, am tasked with loading tables with 21+ million rows. Will SQL*Loader perform better with one large file or many smaller files? Is there any ideal file size for optimal performance? Thank you
DavidDon, when I tried to loada 21M row table using direct, I get the following messages:
Record 2373: Rejected - Error on table STAGE_CUSTOMER.
ORA-03113: end-of-file on communication channel
SQL*Loader-926: OCI error while uldlfca:OCIDirPathColArrayLoadStream for table STAGE_CUSTOMER
SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
SQL*Loader-925: Error while uldlgs: OCIStmtExecute (ptc_hp)
ORA-03114: not connected to ORACLE
SQL*Loader-925: Error while uldlgs: OCIStmtFetch (ptc_hp)
ORA-24338: statement handle not executed
Here is the SQL*Loader log:
SQL*Loader: Release 9.2.0.1.0 - Production on Thu Apr 26 15:38:29 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Control File: stage_customer.ctl
Character Set UTF8 specified for all input.
First primary datafile stage_Customer_20070301.csv has a
utf8 byte order mark in it.
Data File: stage_Customer_20070301.csv
Bad File: stage_Customer_20070301.bad
Discard File: none specified
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 1000
Continuation: none specified
Path used: Direct
Silent options: FEEDBACK
Table STAGE_CUSTOMER, 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
ROW_ID SEQUENCE (MAX, 1)
CUSTOMER_ACCT_NUM FIRST * , O(") CHARACTER
IS_DELETED NEXT * , O(") CHARACTER
SQL string for column : "CASE WHEN UPPER(:Is_Deleted) IN ('FALSE','0') THEN 0 ELSE 1 END"
NAME_PREFIX NEXT * , O(") CHARACTER
FIRST_NAME NEXT * , O(") CHARACTER
MIDDLE_NAME NEXT * , O(") CHARACTER
LAST_NAME NEXT * , O(") CHARACTER
NAME_SUFFIX NEXT * , O(") CHARACTER
NICK_NAME NEXT * , O(") CHARACTER
ALT_FIRST_NAME NEXT * , O(") CHARACTER
ALT_LAST_NAME NEXT * , O(") CHARACTER
MARKETING_SOURCE_ID NEXT * , O(") CHARACTER
HOME_PHONE NEXT * , O(") CHARACTER
WORK_PHONE NEXT * , O(") CHARACTER
MOBILE_PHONE NEXT * , O(") CHARACTER
ALTERNATE_PHONE NEXT * , O(") CHARACTER
EMAIL_ADDR NEXT * , O(") CHARACTER
ALT_EMAIL_ADDR NEXT * , O(") CHARACTER
BIRTH_DATE NEXT * , O(") CHARACTER
SQL string for column : "TRUNC(TO_DATE(:Birth_Date, 'MM/DD/YYYY HH24:MI:SS'))"
SALES_CHANNEL_ID NEXT * , O(") CHARACTER
SQL string for column : "decode(:Sales_Channel_id,NULL,NULL,NULL)"
ASSOCIATE_NUMBER NEXT * , O(") CHARACTER
ALT_ASSOCIATE_NUMBER NEXT * , O(") CHARACTER
UPDATE_LOCATION_CD NEXT * , O(") CHARACTER
UPDATE_DATE NEXT * , O(") CHARACTER
SQL string for column : "TRUNC(TO_DATE(:Update_Date, 'MM/DD/YYYY HH24:MI:SS'))"
CUSTOMER_LOGIN_NAME NEXT * , O(") CHARACTER
DISCOUNT_CD NEXT * , O(") CHARACTER
DISCOUNT_PERCENT NEXT * , O(") CHARACTER
BUSINESS_NAME NEXT * , O(") CHARACTER
POS_TAX_FLAG NEXT * , O(") CHARACTER
POS_TAX_PROMPT NEXT * , O(") CHARACTER
SQL string for column : "CASE WHEN UPPER(:POS_TAX_PROMPT) IN ('FALSE','0') THEN 0 ELSE 1 END"
POS_DEFAULT_TAX_ID NEXT * , O(") CHARACTER
POS_TAX_ID_EXPIRATION_DATE NEXT * , O(") CHARACTER
POS_AUTHORIZED_USER_FLAG NEXT * , O(") CHARACTER
SQL string for column : "CASE WHEN UPPER(:POS_AUTHORIZED_USER_FLAG) IN ('FALSE','0') THEN 0 ELSE 1 END"
POS_ALLOW_PURCHASE_ORDER_FLAG NEXT * , O(") CHARACTER
SQL string for column : "CASE WHEN UPPER(:POS_ALLOW_PURCHASE_ORDER_FLAG) IN ('FALSE','0') THEN 0 ELSE 1 END"
ADDRESS1 NEXT * , O(") CHARACTER
ADDRESS2 NEXT * , O(") CHARACTER
ADDRESS3 NEXT * , O(") CHARACTER
CITY NEXT * , O(") CHARACTER
STATE_CD NEXT * , O(") CHARACTER
POSTAL_CD NEXT * , O(") CHARACTER
COUNTRY_CD NEXT * , O(") CHARACTER
ALLOW_UPDATE NEXT * , O(") CHARACTER
SQL string for column : "CASE WHEN UPPER(:ALLOW_UPDATE) IN ('FALSE','0') THEN 0 ELSE 1 END"
ACTION_CODE NEXT * , O(") CHARACTER
SQL string for column : "CASE WHEN UPPER(:action_code) IN ('FALSE','0') THEN 0 ELSE 1 END"
ACCOUNT_TYPE_ID NEXT * , O(") CHARACTER
LOCALE_CD NEXT * , O(") CHARACTER
SQL string for column : "CASE WHEN :Locale_CD IS NOT NULL AND :Locale_CD LIKE '__-__' THEN :Locale_CD ELSE 'en-US' END"
IS_READY_FOR_PROCESSING CONSTANT
Value is '1'
IS_BUSINESS CONSTANT
Value is '0'
HAD_ERRORS CONSTANT
Value is '0'
Record 2373: Rejected - Error on table STAGE_CUSTOMER.
ORA-03113: end-of-file on communication channel
SQL*Loader-926: OCI error while uldlfca:OCIDirPathColArrayLoadStream for table STAGE_CUSTOMER
SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
SQL*Loader-925: Error while uldlgs: OCIStmtExecute (ptc_hp)
ORA-03114: not connected to ORACLE
SQL*Loader-925: Error while uldlgs: OCIStmtFetch (ptc_hp)
ORA-24338: statement handle not executed
Table STAGE_CUSTOMER:
0 Rows successfully loaded.
1 Row 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.
Bind array size not used in direct path.
Column array rows : 5000
Stream buffer bytes: 256000
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 3469
Total logical records rejected: 1
Total logical records discarded: 0
Direct path multithreading optimization is disabled
Run began on Thu Apr 26 15:38:29 2007
Run ended on Thu Apr 26 15:38:30 2007
Elapsed time was: 00:00:01.18
CPU time was: 00:00:00.32 -
Hi All,
I was running a java program which uses java runtime to call Oracle SQL Loader to load a data file inthe Data base , After loading one file sucessfully , the process stopped after giving the error -:
SQL*Loader execution exited with EX_FAIL, see logfile:SQL*Loader-704: Internal error: ulconnect: OCIServerAttach [0]
ORA-12154: TNS:could not resolve service name
Can anyone please let me know What can be the problem . ???? Please let me know where the problem lies ?
Regards
AsifCan some one help to solve this problem????
Edited by: NanthaKumarAR on Apr 13, 2012 5:55 AM -
SQL Loader - read 1st line to one table, rest of data to another
Hi
I looked around the FAQs and forums and find similar cases but not mine...
I am running Oracle 9i and have a text file which has the 1st line as a control header and everything beneath it as data, something like this:
14/07/2010|8
12345678|0
12345679|0
12345680|10.87
12345681|7655.8
12345682|100
12345683|0
12345684|-90.44
12345685|0
The first (header) line has a date field and a counter (the number of records expected beneath it)
The rest of the data is an account number and balance.
Since SQL Loader is invoked outside of Oracle (Unix in my case) I assume I should create two tables, such as:
Create table
TIF_CURRENT_BALANCE_DTL
ACCOUNT_REF_NO VARCHAR2(30),
BALANCE_AMT NUMBER(12,2)
Create table
TIF_CURRENT_BALANCE_HDR
HDR_DATE DATE,
HDR_COUNT NUMBER(10)
);And use a control file which will load line 1 to TIF_CURRENT_BALANCE_HDR and other lines (SKIP=1) to TIF_CURRENT_BALANCE_DTL.
Since the header/detail lines are not (necessarily) distinguishable, is there a way to achieve this, without modifying the input file in anyway?
Thanks
MartinThanks for your reply - the solution should not be OS dependant as it will run on a Linux and UNIX installation.
The DB will be (for now) Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
I looked at that web page you provided and had some hope with the ROWS option, but this is the number of rows to load before each commit.
Any other solutions?
I know I could load it to a common table (text and number) and then convert the values accordingly in the PL/SQL procedure which will run afterwards, but I feel loading the data in the final format is going to be faster.
I am considering using SQL Load to load records (SKIPping row 1) into the DTL table and within the PL.SQL loading the 1st record and performing validation. Since the file has approx 2million rows and is processed daily, 1.99999 million records read with SQL Loader and 1 with conventional methods will still be a vast improvement!
Thanks
Maybe you are looking for
-
Epson Perfection 1200 scanner continues to function as a flatbed scanner but when I try to scan transparencies/film negs the control panels change in Image Capture but the scanner bar will not complete the overview scan & cannot travel beyond the f
-
N80 vista x64 portable device driver
Hi, When connecting the N80 to USB and selecting "Media Player" mode, vista doesnt find an appropriate driver. I installed nokia suite 6.83. I remember that this worked at somepoint, but I somehow managed to delete the nokia n80 entry via uninstall f
-
I just bought Adobe photoshop and premier elements and although photoshop and organizer run premiere will not. I have installed it twice with no errors and it still will not run. OS Name Microsoft Windows 8.1 Version 6.3.9600 Build 9600 Other OS Des
-
I have exported a database schema containing spatial data using exp and Imported it into a new database using imp. It seems to be dropping rows from the user_sdo_geom_metadata table in the new database. Has anyone else seen this problem and is there
-
Check if mobile phone got turned off using j2me application
hello Is there any way to know if the mobile phone got turned off from my j2me application. this is really urgent please help me out.