SQL Loader + SQLPlus*
I realize I should probably know this, but I don't.
I need to run a sequence of PL/SQL scripts in order to disable constraints, followed by SQL Loader scripts, followed again by PL/SQL scripts to enable the same constraints.
I have all the scripts todo this. When I run them seperately, they all run successfully.
How can I create some type of batch scripts to run from either the Command Prompt or from within SQLPlus* that would allow me to run everything?
If a create a command prompt batch script I don't know how to get out of SQLPLus* so that I can run SQL Loader, and if I run the PL/SQL scripts from within SQLPlus* I don't know how to get to the command prompt to run the SQL Loader scripts.
Any adivce or recommended web page with this specific info. would be greatly appreciated.
Thank You.
Best Regards,
Irene
Write a SQL*PLUS script:
execute my_procedure_to_disable();
host sqlldr / control=blah.ctl etc
execute my_procedure_to_disable();
Or wrap it all up in a shell script and do it that way.
Similar Messages
-
Hi all, i am trying to load a file called text1.txt using sql loader. I am using sqlplus but i dont know how to call sql loader in sql plus.
can someone provide syntax assumming data file is text1.txt and control file is txt.clt
thanksWhy on earth? Though you forgot to include version info, assuming you are not using 9i or older, you can and should use the external table facility and you don't need this unstable and resource consuming procedure.
If you would have thought even one second about solving your own problem, you would have realized sqlloader is a separate O/S utility, which requires the host command, and username/password on the commandline.
That alone is a reason not to do it.
Sybrand Bakker
Senior Oracle DBA -
Error while calling sql loader from shell script.
In the table DBMS_SCHEDULER_JOB_RUN_DETAILS im getting the error as ""SQL*Loader-128: unable to begin a session ORA-01017: invalid username/password; logon denied""....do we need previliges for creating session of the db user????.....or wht other settings we require to do.....if the username and password used is right.
user1122577 wrote:
SQL*Loader-128: unable to begin a session ORA-01017: invalid username/password; logon deniedI don't know, but somehow the error you recived looks like ORA-01017 : )
[oracle@dell ~]$ sqlplus ring/ring
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Jul 22 11:50:58 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Data Mining and Real Application Testing options
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Data Mining and Real Application Testing options
[oracle@dell ~]$
[oracle@dell ~]$
[oracle@dell ~]$ sqlldr ring/ring
control = i don't have it
SQL*Loader: Release 10.2.0.4.0 - Production on Thu Jul 22 11:51:08 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
SQL*Loader-500: Unable to open file (i don't have it.ctl)
SQL*Loader-553: file not found
SQL*Loader-509: System error: No such file or directory
[oracle@dell ~]$
[oracle@dell ~]$
[oracle@dell ~]$ sqlldr ring/wrongpassword
control = i don't have it again
SQL*Loader: Release 10.2.0.4.0 - Production on Thu Jul 22 11:51:38 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
SQL*Loader-128: unable to begin a session
ORA-01017: invalid username/password; logon denied
[oracle@dell ~]$ -
SQL*Loader-925: Error while parsing a cursor (via ocisq)
Receiving the following error message when trying to use SQLLoader (on NT) >>>
SQL*Loader-925: Error while parsing a cursor
(via ocisq)
ORA-00942: table or view does not exist
Trying to use the application for the first time, logon using userid for which sqlplus operates, and the table does exist under the user schema, as owner.
ctl and dat file are correct. Log file gives me no further detail of the errors.
Are there any configuration settings or something required for this app?
ThanksThanks Warren. I was concentrating more on the first line of the error.
You are right. The issue was of insufficient privileges. The table did not have all the necessary grants provided. -
SQL*Loader and integrity constraints
I am running into trouble with integrity constraints in my SQL*Loader script runs. Should I be going up to unix and removing the constraints from sqlplus, then asking the wizard to reinstall them after the data load? Is this documented somewhere? I can't find it. Sorry for asking such a basic question.
Thanks,
Ann CantelowHi,
Your approach is correct.
Create tables first
Move data via the scripts
Create contraints, indexes, primary keys
See the User Guide for the ORacle Migration Workbench http://otn.oracle.com/tech/migration/workbench
Regards
John -
SQL LOADER and SHELL SCRIPT ISSUE
Hello Guys,
I know this not the right forum but i am not sure where i should post this.
Pelase help
I am running a shell script which is giving me error
Username:SQL*Loader-128: unable to begin a session
ORA-01017: invalid username/password; logon denied
SQL*Loader: Release 10.2.0.4.0 - Production on Thu Nov 19 13:02:04 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Nov 19 13:02:06 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Enter user-name:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
0 rows updated.
Commit complete.
SQL> SQL> Disconnected from Oracle Database 10g Enterprise Edition
SQL> SQL> Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options Thu Nov 19 13:02:06 EST 2009In shell script i have used the same username and passwd which i am using from command line
the shell script is calling sql loader to load file
and for that also the username and passwd is same.
i am able to run sqlldr command from command line dont knw why here its giving error
here is my shell script
set -a
. $HOME/.edw.env
. $admlib/checklib.sh
LOGDIR=$admsrc/sigma6/ppadala/copg
LOGFILE=${LOGDIR}/log/test`date '+%m%d'`.xtr
DB_USER=copg
DB_PWD=copg
set +a
cd $LOGDIR
if test ! -f $admsrc/sigma6/ppadala/copg/DM_Daily_EFolderCloseCancel_Report_11192009.txt
then
echo "Error: DM_Daily_EFolderCloseCancel_Report_11192009.txt does not exist and/or is not a regular file." >> ${LOGFILE}
exit 1
fi
echo 'End of Checking for the existence of the file - Successful'>> ${LOGFILE}
sqlldr control=$admsrc/sigma6/ppadala/copg/Close_Cancle.ctl log=$admsrc/sigma6/ppadala/copg/Close_cancle.log
userid=${DB_USER}/${DB_PWD} silent=\(HEADER,FEEDBACK,DISCARDS\)>> ${LOGFILE} 2>&1
case $? in 0) :;;1|3) echo "Error: SQL Loader" >> ${LOGFILE}
exit 1;;
esac
sqlplus << EOD
${DB_USER}/${DB_PWD}
@Close_Cancle.sql
EOD
if [ $? -ne 0 ]
then
echo "Error: SQL Plus for script Processing" >> ${LOGFILE}
echo "Resi Unit Scheduling Report Refresh failed" >> ${LOGFILE}
fi
) > ${LOGFILE} 2>&1
echo `date` >> ${LOGFILE}
if [ -f ${LOGFILE} ]
then
mail -s "Resi Unit Scheduling" "[email protected]" < ${LOGFILE}
sleep 3
`ck_error ${LOGFILE}`
fiplease help guys
thanksThanks for the reply
In Close_cancle.log also its the same msg which i posted.
logon denied..............
and this is the log file contents when i do set - X on
+ cd /u2144009/src/sigma6/ppadala/copg
+ test ! -f
+ /u2144009/src/sigma6/ppadala/copg/DM_Daily_EFolderCloseCancel_Report_1
+ 1192009.txt echo End of Checking for the existence of the file -
+ Successful
+ 1>> /u2144009/src/sigma6/ppadala/copg/log/test1119.xtr
+ sqlldr control=/u2144009/src/sigma6/ppadala/copg/Close_Cancle.ctl
+ log=/u2144009/src/sigma6/ppadala/copg/Close_cancle.log
Username:SQL*Loader-128: unable to begin a session
ORA-01017: invalid username/password; logon denied
SQL*Loader: Release 10.2.0.4.0 - Production on Thu Nov 19 17:32:17 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
+ userid=copg/copg silent=(HEADER,FEEDBACK,DISCARDS)
+ 1>> /u2144009/src/sigma6/ppadala/copg/log/test1119.xtr 2>& 1
+ :
+ sqlplus
+ 0<<
copg/copg
@Close_Cancle.sql
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Nov 19 17:32:58 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Enter user-name:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
0 rows updated.
Commit complete.
SQL> SQL> Disconnected from Oracle Database 10g Enterprise Edition
SQL> SQL> Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
+ [ 0 -ne 0 ]
Thu Nov 19 17:32:59 EST 2009Edited by: user10647455 on Nov 19, 2009 2:35 PM -
SQL Loader and weird source file structure
I am familiar with using SQL Loader to process comma or tab delimited text files into proper table data. But how do you process "positionally delimited" files?!
I mean, I have a text file which looks like this:
Item A
---attribute1
---attribute2
---attribute3
---attribute4
Item B
---attribute1
---attribute2
---attribute3
---attribute4
Item C
---attribute1
---attribute2
---attribute3
---attribute4
And so on. How do I tell SQL Loader, 'rows 1, 6 and 11 are the first column in the table; rows 2, 7 and 12 and the second column; rows 3, 8, 13 are the third and so on? I want to end up with data in the form
Item A Attribute1 Attribute2 Attribute3 Attribute 4
Item B Attribute1 Attribute2 Attribute3 Attribute 4
Item C Attribute1 Attribute2 Attribute3 Attribute 4
Is such a thing even possible with SQL Loader?If your data is exactly in that format like in sample provided by Enrique, you can try to play with that certain data pattern. Again, based on previous example:
~ >cat data.dat
map1
615050: ( 95, 83, 68) #5F5344 rgb(95,83,68)
605728: ( 36, 27, 22) #241B16 rgb(36,27,22)
225834: (154,107, 84) #9A6B54 rgb(154,107,84)
176305: (218,187,155) #DABB9B rgb(218,187,155)
141083: (188,142,111) #BC8E6F rgb(188,142,111)
map2
615050: ( 95, 83, 68) #5F5344 rgb(95,83,68)
605728: ( 36, 27, 22) #241B16 rgb(36,27,22)
225834: (154,107, 84) #9A6B54 rgb(154,107,84)
176305: (218,187,155) #DABB9B rgb(218,187,155)
141083: (188,142,111) #BC8E6F rgb(188,142,111)
map3
615050: ( 95, 83, 68) #5F5344 rgb(95,83,68)
605728: ( 36, 27, 22) #241B16 rgb(36,27,22)
225834: (154,107, 84) #9A6B54 rgb(154,107,84)
176305: (218,187,155) #DABB9B rgb(218,187,155)
141083: (188,142,111) #BC8E6F rgb(188,142,111)
~ >cat data.ctl
LOAD DATA
INFILE "data.dat" "str '\nm'"
DISCARDFILE "data.dsc"
DISCARDMAX 999
REPLACE
-- CONCATENATE 6
INTO TABLE data
fields terminated by X'0a' trailing nullcols
( item char "replace('m'||:item,'mm','m')",
attrib1 char,
attrib2 char,
attrib3 char,
attrib4 char,
attrib5 char
~ >sqlplus scott/tiger
SQL*Plus: Release 10.2.0.4.0 - Production on Wed Oct 15 16:27:25 2008
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select count(*) from data;
COUNT(*)
0
SQL> !sqlldr userid=scott/tiger control=data.ctl
SQL*Loader: Release 10.2.0.4.0 - Production on Wed Oct 15 16:28:29 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Commit point reached - logical record count 2
Commit point reached - logical record count 3
SQL> col item for a4
SQL> col attrib1 for a50
SQL> col attrib2 for a50
SQL> select item,attrib1,attrib2 from data;
ITEM ATTRIB1 ATTRIB2
map1 615050: ( 95, 83, 68) #5F5344 rgb(95,83,68) 605728: ( 36, 27, 22) #241B16 rgb(36,27,22)
map2 615050: ( 95, 83, 68) #5F5344 rgb(95,83,68) 605728: ( 36, 27, 22) #241B16 rgb(36,27,22)
map3 615050: ( 95, 83, 68) #5F5344 rgb(95,83,68) 605728: ( 36, 27, 22) #241B16 rgb(36,27,22)
SQL>As you see, i loaded on linux, on windows you may slightly adjust controlfile to reflect end of lines...
Best regards
Maxim -
SQL*Loader and pipe on unix
On unix is it possible to pipe the data to be loaded in to SQL*Loader instead of reading it from file? I have a program that generates data that is to be loaded, and it is a bit waste of time to first save it to file, just to read it back in.
Yes, it's possible :
TEST@db102 SQL> desc test1
Name Null? Type
A VARCHAR2(20)
B VARCHAR2(20)
TEST@db102 SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[ora102 work db102]$ cat test1.dat
aaaaa,bbbbb
ccccc,ddddd
eeeee,fffff
[ora102 work db102]$ cat test1.ctl
load data
replace
INTO TABLE test1
fields terminated by ','
trailing nullcols
a, b
[ora102 work db102]$ cat test1.dat | sqlldr test/test control=test1.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Mon Sep 25 14:29:50 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 3
[ora102 work db102]$ sqlplus test/test
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Sep 25 14:29:58 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
TEST@db102 SQL> select * from test1;
A B
aaaaa bbbbb
ccccc ddddd
eeeee fffff
TEST@db102 SQL> -
hi,
I want to insert 100,000 records daily in a table for the first month and then in next month these records are going to be replaced by new updated records.
there might be few addition and deletion in the previous records also.
actually its consumer data so there might be few consumer who have withdrawn the utility and there will be some more consumer added in the database.
but almost 99% of the previous month data have to be updated/replaced with the fresh month data.
For instance, what i have in my mind is that i will use sql loader to load data for the first month and then i will delete the previous data using sqlPlus and load the fresh month data using sql loader again.
1. Is this ok ? or there is some better solution to this.
2. I have heard of external files, are they feasible in my scenario?
3. I have planned that i will make scripts for sqlPlus and Loader and use them in batch files. (OS windows 2003 server, Oracle 9i database). is there some better choice to make all the procedure automatic?
looking for your suggestions
nadeem ameerI would suggest u use External tables since its more flexible then
sqlloader & is a better option.
For using external tables
1)u will have to create a directory first
2)Generally creation od directory is done by sys,hence after creating the directory
privileges read & write to be provided to user .
3)Creation of external tables.
4) Now use the table as a normal table to insert ,update delete in
ur table.
U can get more information from
http://www.oracle-base.com/articles/9i/SQLNewFeatures9i.php#ExternalTables
Create Directory <directory_name> as <Directory path where file be present>
Grant read,write on directory <directory_name> to <username>
CREATE TABLE <table_name>
(<column names>)
ORGANIZATION EXTERNAL
TYPE ORACLE_LOADER
DEFAULT DIRECTORY ,directory_name>
ACCESS PARAMETERS
RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY ','
LOCATION (<filename>)
PARALLEL 5
REJECT LIMIT 200;
Hope this helps. -
(urgent) SQL*Loader Large file support in O734
hi there,
i have the following sqlloader error when trying to upload data file(s),
each has size 10G - 20G to Oracle 734 DB on SunOS 5.6 .
>>
SQL*Loader-500: Unable to open file (..... /tstt.dat)
SVR4 Error: 79: Value too large for defined data type
<<
i know there's bug fix for large file support in Oracle 8 -
>>
Oracle supports files over 2GB for the oracle executable.
Contact Worldwide Support for information about fixes for bug 508304,
which will add large file support for imp, exp, and sqlldr
<<
however, really want to know if any fix for Oracle 734 ?
thx.Example
Control file
C:\DOCUME~1\MAMOHI~1>type dept.ctl
load data
infile dept.dat
into table dept
append
fields terminated by ',' optionally enclosed by '"'
trailing nullcols
(deptno integer external,
dname char,
loc char)
Data file
C:\DOCUME~1\MAMOHI~1>type dept.dat
50,IT,VIKARABAD
60,INVENTORY,NIZAMABAD
C:\DOCUME~1\MAMOHI~1>
C:\DOCUME~1\MAMOHI~1>dir dept.*
Volume in drive C has no label.
Volume Serial Number is 9CCC-A1AF
Directory of C:\DOCUME~1\MAMOHI~1
09/21/2006 08:33 AM 177 dept.ctl
04/05/2007 12:17 PM 41 dept.dat
2 File(s) 8,043 bytes
0 Dir(s) 1,165 bytes free
Intelligent sqlldr command
C:\DOCUME~1\MAMOHI~1>sqlldr userid=hary/hary control=dept.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Thu Apr 5 12:18:26 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 2
C:\DOCUME~1\MAMOHI~1>sqlplus hary/hary
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Apr 5 12:18:37 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
As I am appending I got two extra rows. One department in your district and another in my district :)
SQL> select * from dept;
DEPTNO DNAME LOC
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
50 IT VIKARABAD
60 INVENTORY NIZAMABAD
6 rows selected.
SQL> -
SQL Loader unicode (umlaut) problem
Hi
I want to load some data with SQL Loader. The data contains german umlaut like ä, ö, ü.
The loading process works, but the umlaut are transformed to something like 'ü' in the DB. How can I get to load them correctly?
My environment:
- DB 10g Rel.2
- Windows XP
- Registry key in Ora_Home: NLS_LANG=GERMAN_GERMANY.WE8MSWIN1252
I tried it with setting the character set in the CTL file:
characterset 'WE8MSWIN1252'
That didn't help either.
Does anyone have an idea? I searched the forum but didn't find a solution.
Thanks for your help,
RogerMaybe a codepage issue ? See this example :
C:\tmp>type umlaut.ctl
load data
infile umlaut.dat
replace
into table umlaut_tab
(a)
C:\tmp>sqlldr test/test control=umlaut.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Tue Jun 10 13:19:50 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 2
Commit point reached - logical record count 3
C:\tmp>sqlplus test/test
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jun 10 13:19:56 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> select * from umlaut_tab;
A
õ
÷
³
SQL> exit
Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Produ
ction
C:\tmp>chcp 1252
Tabella codici attiva: 1252
C:\tmp>sqlplus test/test
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jun 10 13:20:19 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> select * from umlaut_tab;
A
ä
ö
ü
SQL> -
Sql*loader in batch script
Hi,
I am calling a sqlloader and a procedure within a loop inside a batch script.
Sometimes, The sqlloader fails and subsequent procedure fails, I am not able move to the next iteration.
How to catch oracle errors in batch script
Thx.hi,
My batch script is something like this.
I want to catch errors when
1. sql*loader throws error
2. when my pl/sql throws error.
I welcome any suggestions to improve this code.
d:
echo cd Data\Scripts
for %%f in (D:\Data\DELIVERY_NOTE\*.csv) Do (
echo conn config/config;
echo delete from SQLLOAD_DELIVERY_STAGE;
)| sqlplus -s /nolog
sqlldr USERID=config/config control=D:\Data\Scripts\loaddata_del.ctl skip=2 data=%%f
echo conn config/config;
echo exec DELIVERY_NOTE_PKG.Populate_Del_Note_stage;
echo exec DELIVERY_NOTE_PKG.PROCESS_DELIVERY_NOTE;
)| sqlplus -s /nolog
move %%f D:\Data\Processed_Delivery\
cd D:\Data\processed_Delivery\
rename *.csv *.csv.processed
cd d:\Data\scripts\
echo #############
echo PROCESSED THE FILE %%f AT %data% %time%
echo ############
) -
Help in calling sql loader and an oracle procedure in a script
Hi Guru's
please help me in writing an unix script which will call sql loader and also an oracle procedure..
i wrote an script which is as follows.
!/bin/sh
clear
#export ORACLE_SID='HOBS2'
sqlldr USERID=load/ps94mfo16 CONTROL=test_nica.ctl LOG=test_nica.log
retcode=`echo $?`
case "$retcode" in
0) echo "SQL*Loader execution successful" ;;
1) echo "SQL*Loader execution exited with EX_FAIL, see logfile" ;;
2) echo "SQL*Loader execution exited with EX_WARN, see logfile" ;;
3) echo "SQL*Loader execution encountered a fatal error" ;;
*) echo "unknown return code";;
esac
sqlplus USERID=load/ps94mfo16 << EOF
EXEC DO_TEST_SHELL_SCRIPT
it is loading the data in to an oracle table
but the procedure is not executed..
any valuable suggestion is highly appriciated..
Cheersmultiple duplicate threads:
to call an oracle procedure and sql loader in an unix script
Re: Can some one help he sql loader issue. -
SQL * Loader with Spanish data!
Hi All,
I have a requirement to load Spanish data into a table. I am using SQL*Loader control file to load the data.
Everything is fine, but the Spanish charecters are not inserting as they have to. It is inserting some junk charecters.
How can I solve this issue?
Thanks in advance.Hello,
Are you using init.ora (pfile) or spfile? Anyway you can do this
sqlplus "/as sysdba"
sql> create pfile='/location_to_pfile/init.ora' from spfile;
File Created
Modify init.ora file and add parameter to support spanish characters
sql>shutdown immediate;
sql>startup pfile='/path_to_pfile/init.ora'; -- YOu should be able mount and open and successfully
Test your data using sqlldr and if it is doing what you are expected it do then.
sql>shutdown immediate;
sql>create spfile from pfile='/path_to_pfile/init.ora';
File Created
sql>startup;
sql>show parameter you_parameter_nameor you can try this to
sqlplus "/as sysdba"
sql> alter system set parameter_name=value scope=both sid='*';
or
sql>alter system set paramter_name=value sid='*';
sql> show parameter parameter_name;
Test your data using sqlldr Regards -
i have to export flat file into oracle 10g database table with same datatypes as created in MS Access but during load i am facing following errors i don't know why,how can i handle this situation where as i created flate file and control file in same drive but sql* loader cannot find it.
control file
load data
infile 'F:\dumy.dat'
BADFILE 'F:\dumy.BAD'
DISCARDFILE 'F:\dumy.DSC'
APPEND
INTO TABLE dumy
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(id INTEGER EXTERNAL,init_date sysdate 'mm/dd/yyyy mi:ss:hh',final_date date,
item varchar2(50))
*flat file*
1,12/22/2009 0:00:00,12/29/2009 0:00:00,"BRUSH"
2,12/22/2009 0:00:00,12/27/2009 0:00:00,"COMB"
all files are on f:\drive and i also copy control file in oracle home in BIN FOLDER
following error occur
SQL*Loader-500: Unable to open file (F:\DUM.CTL)
SQL*Loader-553: file not found
SQL*Loader-509: System error: The system cannot find the file specified.Here is something working with Oracle XE on Windows. All files are in the same directory C:\TMP and all commands are also run from C:\TMP:
c:\tmp>type dumy.sql
set echo on
select * from v$version;
drop table dumy purge;
create table dumy
id number,
init_date date,
final_date date,
item varchar2(50)
exit
c:\tmp>type dumy.ctl
load data
infile 'C:\tmp\dumy.dat'
BADFILE 'C:\tmp\dumy.BAD'
DISCARDFILE 'C:\tmp\dumy.DSC'
APPEND
INTO TABLE dumy
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
id integer external,
init_date date "mm-dd-yyyy hh24:mi:ss",
final_date date "mm-dd-yyyy hh24:mi:ss",
item char
c:\tmp>type dumy.dat
1,12/22/2009 0:00:00,12/29/2009 0:00:00,"BRUSH"
2,12/22/2009 0:00:00,12/27/2009 0:00:00,"COMB"
c:\tmp>sqlplus hr/hr @dumy
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 13 10:40:54 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> select * from v$version;
BANNER
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> drop table dumy purge;
Table dropped.
SQL>
SQL> create table dumy
2 (
3 id number,
4 init_date date,
5 final_date date,
6 item varchar2(50)
7 );
Table created.
SQL>
SQL> exit
Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Prod
ction
c:\tmp>sqlldr hr/hr control=dumy.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Sat Mar 13 10:41:00 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 1
Commit point reached - logical record count 2
c:\tmp>type dumy.log
SQL*Loader: Release 10.2.0.1.0 - Production on Sat Mar 13 10:41:00 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Control File: dumy.ctl
Data File: C:\tmp\dumy.dat
Bad File: C:\tmp\dumy.BAD
Discard File: C:\tmp\dumy.DSC
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 50
Bind array: 64 rows, maximum of 256000 bytes
Continuation: none specified
Path used: Conventional
Table DUMY, 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
ID FIRST * , O(") CHARACTER
INIT_DATE NEXT * , O(") DATE mm-dd-yyyy hh24:
i:ss
FINAL_DATE NEXT * , O(") DATE mm-dd-yyyy hh24:
i:ss
ITEM NEXT * , O(") CHARACTER
Table DUMY:
2 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: 66048 bytes(64 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 2
Total logical records rejected: 0
Total logical records discarded: 0
Run began on Sat Mar 13 10:41:00 2010
Run ended on Sat Mar 13 10:41:01 2010
Elapsed time was: 00:00:00.89
CPU time was: 00:00:00.06
{code}
Do not use VARCHAR SQL*Loader data type which is not a portable data type but use CHAR instead.
Do not use SYSDATE if you want to load a date from your .dat file.
Maybe you are looking for
-
ITunes 11.0.4 gives blank error message when opening with OS X 10.6.8
I canot get iTunes to open at all with either my admin or guest account. I have already run the repair permissions utility. Any suggestions?
-
Will a contract free iPhone 4S be unlocked as well?
Hi I am in the US for just a week and I want to buy a an unlocked iPhone 4S to take back to India. Will a contract free iPhone 4S be unlocked as well? Apple says unlocked phones will be available this November but i have not heard an dates yet .... I
-
6.0.5 introduces CC-level lost render files to CS6
With 6.0.5, CS6 has joined the ranks of CC, in not being able to retain links to rendered areas of the t-l when warp stabilization is applied to the footage (there may be other conditions as well which cause lost renders, haven't tested) -- not occas
-
HELP! Color transition property greyed out in Dreamweaver CC
I'm trying to add a color change transition for the text in my navigation and the color property is greyed out. How can I change this?
-
Where to find the example illustrated how to using script to deploy app
Hi my new job involves configure and deploy app in WL Server. one of tasks is to write script and use script file to configure and deploy app. This script may need to specify the JDBC for various app (like one app communicates with oracle, the other