ORACLE 8I SQL*LOADER DATAFILE의 특정 FIELD DATA를 SKIP하고 LOADING하는 방법

제품 : ORACLE SERVER
작성날짜 : 2002-04-09
ORACLE 8I SQL*LOADER DATAFILE의 특정 FIELD DATA를 SKIP하고 LOADING하는 방법
===========================================================================
아래의 예제와 같이 가변 길이의 filed들이 ',', '|' 와 같은 구분자로
구분이 되고 있는 경우 oracle 8i부터 제공되는 'FILLER'라고 하는 필드
구분자를 사용하여 상태인식자로 표시하여 insert시 skip할 수 있다.
<Example>
TABLE : skiptab
===========================
     col1 varchar2(20)
     col2 varchar2(20)
     col3 varchar2(20)
CONTROLFIEL : skip.ctl
load data
infile skip.dat
into table skiptab
fields terminated by ","
(col1 char,
col2 filler char,
col3 char)
DATAFILE : skip.dat
SMITH, DALLAS, RESEARCH
ALLEN, CHICAGO, SALES
WARD, CHICAGO, SALES
data loading :
$sqlldr scott/tiger control=skip.ctl
결과 :
COL1 COL3
SMITH RESEARCH
ALLEN SALES
WARD SALES

Similar Messages

  • [Oracle][ODBC SQL Server Driver]String data, right truncation {01004}

    While importing data from SQL Server 2005 to Oracle gateway 11g Release2, i am getting following error:
    insert into CSDescr select * from CSDescr@sqlserver
    ERROR at line 1:
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    +[Oracle][ODBC SQL Server Driver]String data, right truncation {01004}+
    ORA-02063: preceding 2 lines from SQLSERVER
    Oracle database characterset is AL32UTF8
    SQLServer database characterset is SQL_Latin1_General_CP1_CI_AS
    Following is the configuration in the parameter file for gateway:
    HS_KEEP_REMOTE_COLUMN_SIZE=LOCAL
    HS_NLS_LENGTH_SEMANTICS=CHAR
    I think setting the HS_LANGUAGE parameter shall fix the error but I  want to know what should be the value of this parameter?

    HS_LANGUAGE needs to be set to a character set that is used by the foreign database
    So try: HS_LANGUAGE=american_america.WE8MSWIN1252
    Also specify HS_NLS_NCHAR=UCS2 as the nvarchars of a SQl Server are stored in UCS2 character set

  • Is there any difference in Oracle 9i SQL Loader and Oracle 10g SQL Loader

    Hi
    Can anyone tell me whether is there any difference in Oracle 9i SQL Loader and Oracle 10g SQL Loader?
    I am upgrading the 9i db to 10g and wanted to run the 9i SQL Loader control files on upgraded 10g db. So please let me know is there any difference which I need to consider any modifications in the control files..
    Thank you in advance
    Adi

    answered

  • Loading XML files in Oracle via SQL*Loader

    Hello,
    I need to load the data in an XML file provided by a thrird party into my Oracle DB. This file is not formatted as per the requirements of XSU, so I need to find an alternative. In the online documentation for Oracle8i it is stated that one way to load XML files into Oacle is via SQL*Loader. On the SQL*Loader documentation this is not mentioned. Also as far as I know, SQL*Loader can be used with delimited fields or fixed length fields and thus I do not see how this can be done (but it would be very cool).
    Can you give me any advice on this?
    Thanks
    Ciao
    Ferruccio

    No, SQL*Loader cannot process DBF files directly
    Tom Kyte provides a package to read in DBF files thorugh utl_file
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:711825134415

  • How to load an Excel sheet into Oracle via SQL* Loader

    Hallo!I am trying to load an Excel spreadsheet into an Oracle 10g database via SQL*Loader.
    How do I achieve this via Oracle Enterprise Manager?
    Please give a detailed explanation especially covering the locations of the control file,infile,bad file etc for Oracle 10g running in both Windows and Linux platforms.
    Thanks.

    This has nothing to do with Oracle Enterprise Manager
    SQL Loader is command line and it needs to be installed with SQL PLUS (The wrong install type will not have it)
    Consider reviewing this:
    http://www.orafaq.com/wiki/SQL*Loader_FAQ

  • What are the difference between Oracle IMP, SQL*Loader and Data Pump

    It's hard to decide which should be used for a flat file import. any body give some suggestions or if there is any guidelines for choosing among these?
    Thanks

    <p>You might want to take a look at <b>this</b>. It should answer all of your questions.</p>
    Tom

  • Load flat file into oracle with SQL Loader

    Hi All,
    Oracle 9i
    I want to load flat file into oracle with the help of sqlloader but I want to skip some columns from flat file.
    Can anyone tell me how can we skip column from flat file , I can’t open flat file into excel as CSV due to large volume
    Does anyone has any solution for the same.
    Umesh Goel

    Filler can be use when we want to skip database table column or we want to put null in database table column
    but if we have 10 column in flat file and we want to load 1,2,5,7 number column from flat file
    then I think filler will not work
    If yes then plz let me know.
    thx
    UG

  • SQL Loader - Loading Text File into Oracle Table that has carriage returns

    Hi All,
    I have a text file that I need to load into a table in Oracle using SQL Loader. I'm used to loading csv or comma delimited files into Oracle so I'm not sure what the syntax is when it comes to loading a text file that essentially has one value per row and each row is separated by a carriage return. So when you open the text file, the records look like this:
    999999999 <CRLF>
    888888889 <CRLF>
    456777777 <CRLF>
    456555535 <CRLF>
    345688888 <CRLF>
    So each row is separated by a hard return and I need to tell sql loader that the hard return or next row is the next value to insert into the table. Below is an example of a control file I tend to use as a template for loading csv files but I need to modify it to accomodate this new structure.
    OPTIONS (DIRECT=TRUE,ROWS=100000)
    UNRECOVERABLE
    LOAD DATA
    INFILE 'C:\input.txt'
    BADFILE 'C:\input.bad'
    APPEND
    INTO TABLE TEST_TABLE
    FIELDS TERMINATED BY ","
    TRAILING NULLCOLS
    COLUMN_1
    How to I modify the control file above to use hard returns as the field/row delimiter for my text file?
    Thanks

    Hi there,
    Obviously my intention wasn't to post the same message 4 times....I pressed the "Submit Message" button but the submission hung and I pressed it a few times and finally it worked but it created several versions of my post. You need to allow users the ability to delete there own postings...I was looking for this option but didn't have it.
    Sorry

  • ORACLE JDBC : java.sql.SQLException: No more data to read from socket

    I have a problem with JDBC, SUN JavaWebServer2.0, and ORACLE: java.sql.SQLException: No more data to read from socket
    On JWS2.0 + JDBC 1.22 ORACLE Thin Driver (classes111),
    SunOS 5.7 Ultra-1 (JDBC-client), connecting to ORACLE 7.3.4.5.0:
    after some successful selects, after about 1 minute, the following exception is thrown:
    java.sql.SQLException: No more data to read from socket
    at java.lang.Throwable.<init>(Compiled Code)
    at java.lang.Exception.<init>(Compiled Code)
    at java.sql.SQLException.<init>(Compiled Code)
    at oracle.jdbc.dbaccess.DBError.check_error(Compiled Code)
    at oracle.jdbc.ttc7.TTCInBuffer.getByte(Compiled Code)
    at oracle.jdbc.ttc7.TTIMsg.unmarshalSB1(Compiled Code)
    at oracle.jdbc.ttc7.Oall7.receive(Compiled Code)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(Compiled Code)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(Compiled Code)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(Compiled Code)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithBatch(Compiled Code)
    at oracle.jdbc.driver.OracleStatement.doExecute(Compiled Code)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(Compiled Code)
    at oracle.jdbc.driver.OracleStatement.executeUpdate(Compiled Code)
    The same application works fine on Win NT4 (JDBC) with ORACLE 7.3.3.0.0
    Can anybody solve this problem? Any ideas?
    null

    Reason: the ORACLE server process crashes (sometimes), and the result is the "empty"
    socket.

  • SQL Loader and whitespace issues

    Hello users,
    I've got an issue that I know is breaking based on a comments field, which allows nearly every type of character in it.
    Long story short, I'm trying to upload an Access table, turned to .csv file into Oracle via SQL Loader.
    I'm able to do it if I delete or set the COMMENTS column to null before doing so.
    If I try the option with the contents of this field populated, it blows up. I've got it terminated by a tilde in the control file, which the COMMENTS field does not contain at all, even with some 5.000+ records.
    However, people upon entering comments have put many carriage returns in there. I noticed once I export the data to text or csv, then open in Excel, it shows the column breaking and spilling over into fields it shouldn't, thereby causing the big problem.
    I've been searching but haven't found a way I can wrap these whitespaces or have SQL Loader ignore them.
    I can't use TERMINATED BY WHITESPACE in the SQL Loader control file because that will cause the field to break without all the comments and I can't use optionally enclosed by " because these people have also used " in the COMMENTS field.
    Do I have any option here, other than to brute force make an update query of some kind to manually populate the data? I can do that if I have to but i'd sure rather have all the data dump in via SQL Loader if I can.
    Thanks!

    Actually, it wasn't related to the size of the column. I made it like 3000, to hold 3000 characters, which was plenty.
    But I used
    PRESERVE BLANKS and then it worked fine!

  • Load multiple records in 1 table from 1 line in text file w/sql loader

    hi guys,
    quick question, perhaps someone can help. searched around and didn't see this question asked before, and can't find any answer in SQL Loader faqs or docs.
    i know i can extract multiple logical records from a single physical record in the input file as two logical records, and then use two into tables clauses to load the data into the table. see oracle 9i sql loader control file reference chapter 5 to see what i am talking about.
    but my question follows:
    cust_id amount1_val amount1_qual amount2_val amount2_qual amount3_val amount3_qual
    123 1500.35 TA 230.34 VZ 3045.50 TW
    basically i want to use one sql loader statement to load these 3 records into 1 table. the issue for me is that i need to re-use the cust_id for all 3 records as the key, along with the qualifier code. the example in the Oracle docs only works for data where the logical records are completely separate -- no shared column values.
    i'm sure this is possible, perhaps using some :cust_id type parameter for the 2nd and 3rd records, or something, but i just don't have enough knowledge/experience with sql loader to know what to do. appreciate any help.
    wayne

    Hi wayne,
    I found an example on what exactly you were looking for from an SQL*Loader documentation. Please see if it of some help to you
    EXAMPLE
    The control file is ULCASE5.CTL.
    1234 BAKER 10 9999 101
    1234 JOKER 10 9999 777
    2664 YOUNG 20 2893 425
    5321 OTOOLE 10 9999 321
    2134 FARMER 20 4555 236
    2414 LITTLE 20 5634 236
    6542 LEE 10 4532 102
    2849 EDDS xx 4555
    4532 PERKINS 10 9999 40
    1244 HUNT 11 3452 665
    123 DOOLITTLE 12 9940
    1453 MACDONALD 25 5532
    In the above datafile
    Column1 - Empno
    Column2 - ENAME
    Column3 - Depno.
    Column4 - MGR
    Column5 - Proj no.
    -- Loads EMP records from first 23 characters
    -- Creates and loads PROJ records for each PROJNO listed
    -- for each employee
    LOAD DATA
    INFILE 'ulcase5.dat'
    BADFILE 'ulcase5.bad'
    DISCARDFILE 'ulcase5.dsc'
    1) REPLACE
    2) INTO TABLE emp
    (empno POSITION(1:4) INTEGER EXTERNAL,
    ename POSITION(6:15) CHAR,
    deptno POSITION(17:18) CHAR,
    mgr POSITION(20:23) INTEGER EXTERNAL)
    2) INTO TABLE proj
    (empno POSITION(1:4) INTEGER EXTERNAL,
    3) projno POSITION(25:27) INTEGER EXTERNAL) -- 1st proj
    Notes:
    REPLACE specifies that if there is data in the tables to be loaded (EMP and PROJ), SQL*loader should delete the data before loading new rows.
    Multiple INTO clauses load two tables, EMP and PROJ. The same set of records is processed three times, using different combinations of columns each time to load table PROJ.
    Regards,
    Murali Mohan

  • Sql loader problem - thread appears to be hung

    Sorry to ask such a strang question but I am not sure which direction to go with this one. Hoping someone might have an idea.
    I am running oracle 10g on windows. I have 3 servers all patched at the same levels. All 3 servers run a purchased utility called dbutility which copies data from a dms database to an oracle database using oracle's sql*loader. On one server the dbutility hangs when the dbutility program tries to start sql*loader. I must close the dos window to end the job - ctl c does not work.
    If I let the job sit long enought, it eventually gets the message:"BULK LOADER thread appears to be hung: main thread waiting".
    I called the company which supports the dbutility program and they think it is a windows or oracle problem.
    I can get the dbutility to work if I start the dbutility in verbose (trace) mode. For some reason slowing the dbutility down before starting the sql*load program fixes the problem.
    Has anyone ever had issues starting sql*loader?
    Does anyone have any ideas what might be causing this problem?
    Do you think reinstalling the sql*loader might help?
    Thank you!
    Confused:)

    Try to built a test case on your own.
    Make a little test creating an sql*loader ctl and try to load the file on a test table.
    If that work you should ask againg with your tool support.
    load data
    infile 'YOUR_FILE_HERE'
    badfile 'BAD_FILE'
    append
    into table test_ldr
    fields terminated by "," optionally enclosed by '"'          
    (caracter1,caracter2,caracter3,caracter4,caracter5)
    caraterN = your table column name.
    sqlldr.exe userid=username/password@db rows=1000 control=conrtol.ctl log=log.log errors=200 direct=y

  • SQL*Loader and timestamp values

    I'm loading timestamp values (among other data) from a text file into Oracle using SQL*Loader.
    The data I load is formatted like the following:
    2008/11/13 23:55:21.366
    2008/11/13 23:55:22.782
    2008/11/13 23:55:25.879
    Hence my control file look like this:
    TSTAMP TIMESTAMP "YYYY/MM/DD HH24:MI:SS.FF",
    The timestamp data in the input file are in UTC, however I load into a column that is of type "TIMESTAMP(3)", i.e. in server time. This is on purpose. I do not want the data to be in UTC when I look at them.
    Therefore after the load I have to manually do
    UPDATE mytable
    SET tstamp = tstamp + (tstamp - sys_extract_utc(tstamp));
    This update-after-loading actually takes quite some time due to the amount of records. I would like to avoid it and instead do it as part of the load. Is this possible somehow?
    I'm on Oracle 10.2.
    Thanks.

    Hi
    What about setting a special Time Zone in your database?
    You have two options when setting which time zone the database belongs to. You can either qualify it as a displacement from GMT/UTC in the format of 'hh:mm' or you can specify it as a name that has an entry in the V$TIMEZONE table.
    select tzname,tzabbrev from V$TIMEZONE_NAMES;
    select DBTIMEZONE from dual;
    ALTER database SET TIME_ZONE = 'Denmark/Copenhagen';
    select SESSIONTIMEZONE from dual;
    select CURRENT_TIMESTAMP from dual;
    See that link
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/create.htm#sthref319
    Edited by: Hub on Dec 7, 2008 3:58 PM

  • External Table vs SQL Loader.

    Hi,
    Pls anybody can tell me what is the significant differences between external table and SQL Loader.

    Both fall into category of Oracle utilities
    [SQL*Loader|http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/utility.htm#i10606] is the one that loads data into Oracle tables from operating system files and [external table|http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/utility.htm#i10611] is the one that
    is providing functionality similiar as SQL*Loader in the means of accessing external data but with with a different logic and rules,it lets you access data in external sources as if they were in a table in the database.

  • Need suggestions on loading 5000+ files using sql loader

    Hi Guys,
    I'm writing a shell script to load more than 5000 files using sql loader.
    My intention is to load the files in parallel. When I checked the maximum number of sessions in v$parameter, it is around 700.
    Before starting the data load, programmatically I am getting the number of current sessions and maximum number of sessions and keeping free 200 sessions without using them (max. no. of sessions minus 200 ) and utilizing the remaining ~300 sessions to load the files in parallel.
    Also I am using a "wait" option to make the shell to wait until the 300 concurrent sql loader process to complete and moving further.
    Is there any way to make it more efficient? Also is it possible to reduce the wait time without hard coding the seconds (For Example: If any of those 300 sessions becomes free, assign the next file to the job queue and so on..)
    Please share your thoughts on this.
    Thanks.

    Manohar wrote:
    I'm writing a shell script to load more than 5000 files using sql loader.
    My intention is to load the files in parallel. When I checked the maximum number of sessions in v$parameter, it is around 700. Concurrent load you mean? Parallel processing implies take a workload, breaking that up into smaller workloads, and doing that in parallel. This is what the Parallel Query feature does in Oracle.
    SQL*Loader does not do that for you. It uses a single session to load a single file. To make it run in parallel, requires manually starting multiple loader sessions and perform concurrent loads.
    Have a look at Parallel Data Loading Models in the Oracle® Database Utilities guide. It goes into detail on how to perform concurrent loads. But you need to parallelise that workload yourself (as explained in the manual).
    Before starting the data load, programmatically I am getting the number of current sessions and maximum number of sessions and keeping free 200 sessions without using them (max. no. of sessions minus 200 ) and utilizing the remaining ~300 sessions to load the files in parallel.
    Also I am using a "wait" option to make the shell to wait until the 300 concurrent sql loader process to complete and moving further.
    Is there any way to make it more efficient? Also is it possible to reduce the wait time without hard coding the seconds (For Example: If any of those 300 sessions becomes free, assign the next file to the job queue and so on..)Consider doing it the way that Parallel Query does (as I've mentioned above). Take the workload (all files). Break the workload up into smaller sub-workloads (e.g. 50 files to be loaded by a process). Start a 100 processes in parallel and provide each one with a sub-workload to do (100 processes each loading 50 odd files).
    This is a lot easier to manage than starting for example a 5000 load processes and then trying some kind of delay method to ensure that not all hit the database at the same time.
    I'm loading about 100+ files (3+ million rows) every 60 seconds 24x7 using SQL*Loader. Oracle is quite scalable and SQL*Loader quite capable.

Maybe you are looking for