External tables in oracle 8i
Hi,
I am working in Oracle 8i. I need to use Oracle 8i External Table to load data in the database. But I am getting the following error
ORA-00922: Missing or Invalid Option
The snippet which I used is as follows:
create table ext_table_csv (
a NUMBER,
n NUMBER,
m NUMBER
organization external
type oracle_loader
default directory swami
access parameters (
records delimited by newline
fields terminated by ';'
missing field values are null
location ('sample.txt')
PARALLEL
reject limit 0
The input file data is
018307;20080421;123457
018307;20080421;123457
Please let me know how this can be done in Oracle 8i and I have to use Oracle Loader only.
Its a new feature introduced in Oracle 9i.
http://download.oracle.com/docs/cd/A91202_01/901_doc/server.901/a90120/ch2_feat.htm#58871
For 8i, SQL*Loader is the only option.
Similar Messages
-
How to overwrite a log and bad file in external table in oracle 10g
Hi,
I have used external table in oracle 10g.whenever use select query in external table orace internally create one log file in specified directory,
but this log file is growing.How can i overwrite the log file(old to replace with new).I need overwrite a log and bad file in external table.
kindly give the solutions.
By
SivaI don't believe that is possible with the LOGFILE clause, but it may be with the BADFILE clause. Here is an excerpt from the documentation :
The LOGFILE clause names the file that contains messages generated by the external tables utility while it was accessing data in the datafile. If a log file already exists by the same name, the access driver reopens that log file and appends new log information to the end. This is different from bad files and discard files, which overwrite any existing file. NOLOGFILE is used to prevent creation of a log file.
If you specify LOGFILE, you must specify a filename or you will receive an error.
If neither LOGFILE nor NOLOGFILE is specified, the default is to create a log file. The name of the file will be the table name followed by _%p and it will have an extension of .log. -
OWB Mapping involving Oracle External Table to Oracle Target Table.
Hi All,
I created a mapping which involves External Table as source & oracle table as target.
Following were steps followed.
1> Created Directory & External Table on oracle server
2> Attached Text file with ',' delimiter to the External Table.
3> Imported the External Table in source module.
4> Created mapping which involves External Table as Source & Oracle Table as Target.
5> Validated & Generated Mapping in OWB.
6> Deployed the mapping in Deployment Manager.
7> Executed the mapping in Deployment Manager.
Execution Results: Completed with errors.
No error message is displayed, I am wondering where can I get more information about the error message?
Thanks in Advance.
Regards,
VidyanandHi,
Look in the logfile <your runtime owner>.log.* under the directory <owb home>/owb/log
thanks -
Why do we really use External tables in Oracle?
I looking why do we exactly use external tables in oracle and if you can help me please give me a scenario also.
Before External tables (long ago in a galaxy far, far away) we would have had to load the text file into the database, most likely using SQL Loader before we could 'read it'.
External tables allow us to define the text file in the Create table syntax and read that file over and over via SQL from the databse - In summary, I can access that text file (in parallel = fast) without loading it into my database, I just saved a step in my integration. I can also swap the file for a new file (same definition) and auto-magically access by new content.
Here is a good link with a scenario for you :
External Tables: An Introduction – All Things Oracle
Of course with ODI - the complexity of SQL Loader control files is hidden, we just define the text file, use the LKM File to SQL and load it in, but where is the fun in that?
Best check with your Solution Architect about what the best practises are for this in your organization.
Rgrds
Alastair -
How to register External table into Oracle APPS?
hi
can we register the External table in Oracle apps like SQL Loader?
So if yes, please share the steps.
Thx781261 wrote:
okk..
But i mean , we create Executable with Method type SQL Loader, to register in Oracle APPS.
SO like what would be Executable Method for External Table?
or can we call the External table in Procedure?
ThanxI don't know oracle APPS (and this isn't the APPS forum), but an external table is just like another table. It's created once and then used by queries to fetch data. You would reference it in your applications just the same as you would any other table. -
External tables in Oracle 11g database is not loading null value records
We have upgraded our DB from Oracle 9i to 11g...
It was noticed that data load to external tables in 9i is rejecting the records with null columns..However upgrading it to 11g,it allows the records with null values.
Is there are way to restrict loading the records that has few coulmns that are null..
Can you please share if this is the expected behaviour in Oracle 11g...
Thanks.Data isn't really loaded to an External Table. Rather, the external table lets you query an external data source as if it were a regular database table. To not see the rows with the NULL value, simply filter those rows out with your SQL statement:
SELECT * FROM my_external_table WHERE colX IS NOT NULL;
HTH,
Brian -
Error when i fetch the external table in oracle 9i ?
External table is created.
But, when i select the external table , it is thrwing the following error.
I have given READ and WRITE permission to the oracle directory.
And, i having the flat file with comma delimited data.
SQL> create table mohan_ext (
2 EMPNO NUMBER(5) ,
3 JOB VARCHAR2(15),
4 SALARY NUMBER(8,2),
5 MGR NUMBER(5) ,
6 HIREDATE DATE,
7 DEPTNO NUMBER(5)
8 )
9 organization external
10 (type oracle_loader
11 default directory ext_dir
12 access parameters (records delimited by newline
13 fields terminated by ','
14 missing field values are null
15 (
16 EMPNO NUMBER(5:5) ,
17 JOB VARCHAR2(15:15),
18 SALARY NUMBER(8,2:8,2),
19 MGR NUMBER(5:5) ,
20 HIREDATE DATE,
21 DEPTNO NUMBER(5:5)
22 )
23 )
24 LOCATION('flat.txt'));
Table created.
SQL> select * from mohan_ext;
select * from mohan_ext
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-00554: error encountered while parsing access parameters
KUP-01005: syntax error: found "identifier": expecting one of: "comma, char, date, defaultif,
decimal, double, float, integer, (, nullif, oracle_date, oracle_number, position, raw, recnum, ),
unsigned, varrawc, varchar, varraw, varcharc, zoned"
KUP-01008: the bad identifier was: NUMBER
KUP-01007: at line 5 column 11
ORA-06512: at "SYS.ORACLE_LOADER", line 14
ORA-06512: at line 1
SQL>You may need to scrub some of the data prior to using it as an external table. For instance, ensure that you do not have any extra commas lingering around somewhere within the data as this could cause mapping issues with the data. I've used this process hundreds of times, and more often than not there is an extra comma somewhere that is causing the issue.
-
External table in Oracle 10g and Windows server 2003 problem
I'm having a problem accessing an external table in an Oracle 10g and Windows 2003 server environment. The disk is remote (mapped) to the server. It's the usual access errors, kup-04001 or kup-04063.
I have the [seemingly] exact same setup in an Oracle 9i and Windows 2000 server environment which works perfectly. Services run as local SYSTEM and SYSTEM has full permissions on the disk. Directories exist and so do the permissions to the directories.
In the Oracle 10g and Windows 2003 environment, services run as local SYSTEM and SYSTEM has full permissions on the mapped disk. Directories exist and so do the permissions to the directories.
This obviously effects mappings, deployments, etc.
Does anyone know if something changed in either the db or the os?
Thank you,
MichaelThank you for your reply.
Your proposal is the standard solution. As a matter of fact, that's how it is on my "old" system. Server "A" Oracle services are started by SYSTEM. Server "B" Oracle services are started by SYSTEM and is where the flat files reside. SYSTEM has full permissions on a disk local to Server "B". Database directoriies defined on Server "A" point to Server "B" remote disk. External Tables on Server "A" are defined with directories that point to Server "B" remote (mapped) disk. I have no problems with this configuration.
I'm having a problem acheiving the same configuration with Oracle 10g and Windows 2003. I guess I'm baffled over the fact it isn't working the same way as my "old" environment. Why shouldn't it? Oracle (and you) want me to start services as a specific user. It shouldn't have to be that way unless something changed in the way the database makes calls to the os or if Microsoft slipped something in with one of it's numerous security patches. -
Unix permission problem for external table in oracle 10g, sun solaris
Hello All,
I'm facing a problem in accessing external table which has stumped me a bit.
What I'm looking for is to use a external table with restricted permission to Others(770) on unix.
Would appreciate if someone helps me out here.
Here are the steps:
1.create directory ext_tab_dir1 as '/home/ravi/test'
2.grant read,write on directory ext_tab_dir1 to scott
3.CREATE TABLE scott.emp_load1(employee_number CHAR(5))
ORGANIZATION EXTERNAL (
type oracle_loader
default directory ext_tab_dir1
access parameters (
records delimited by newline
fields terminated by ' '
optionally enclosed by '"'
missing field values are null
location ('info.dat')
Now I have added unix user oracle to unix group myDbGroup and provided myDbGroup read/write/exec permission on directory /home/ravi/test.
info.dat has been placed in /home/ravi/test.
#pwd
/home/ravi
#ls -l
drwxrwx--- 2 ravi myDbGroup 512 Mar 7 17:35 test
I have manually logged in as user oracle and successfully created a sample file in /home/ravi/test.
-rwxrwx--- 1 ravi myDbGroup 13 Mar 7 17:33 info.dat
-rw-r--r-- 1 oracle oinstall 0 Mar 7 18:05 sampleFile
I then connect to the db using sqlplus as ravi and do a
#select * from scott.emp_load1
I get the following error
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04063: unable to open log file emp_load1_18567.log
OS error Permission denied
ORA-06512: at "SYS.ORACLE_LOADER", line 19
After this, I gave full permission to /home/ravi/test
drwxrwxrwx 2 ravi myDbGroup 512 Mar 7 17:35 test
#select * from scott.emp_load1
And this was successful.
It created a log file in /home/ravi/test
-rwxrwx--- 1 ravi myDbGroup 13 Mar 7 17:33 info.dat
-rw-r--r-- 1 oracle oinstall 0 Mar 7 18:05 sampleFile
-rw-r--r-- 1 oracle oinstall 0 Mar 7 18:05 emp_load1_18567.log
Now what stumped me is the owner and group owner of the file emp_load1_18567.log.
It is same as the sampleFile which I created manually!!
From this it can be deducted oracle is not using user id oracle while reading/writing to the unix directory but somehow assigning user id oracle as owner to the log file at the end.
If someone has encountered this problem earlier or has some info about this...pls share.
Regards,
RavinandanThanks for the reply.
I have earlier checked this with NOLOGFILE option.
But no luck.
I would like to add one more detail(which I missed earlier) about the problem.
If I give 750 access to /home/ravi(That is read/exec to Group and none perm to Others),
I will get the same error(KUP-04063: unable to open log file emp_load1_18567.log).
This obviously means oracle is not even able to access the directory(Although unix user oracle has access via the group perms). -
External table in Oracle 10g and Windows server 2003
I'm having a problem accessing an external table in an Oracle 10g and Windows 2003 server environment. The disk is remote (mapped) to the server. It's the usual access errors, kup-04001 or kup-04063.
I have the [seemingly] exact same setup in an Oracle 9i and Windows 2000 server environment which works perfectly. Services run as local SYSTEM and SYSTEM has full permissions on the disk. Directories exist and so do the permissions to the directories.
In the Oracle 10g and Windows 2003 environment, services run as local SYSTEM and SYSTEM has full permissions on the mapped disk. Directories exist and so do the permissions to the directories.
Does anyone know if something changed in either the db or the os?
Thank you,
MichaelVersion 9.2.04.
Server "A" Oracle services are started by SYSTEM. Server "B" Oracle services are started by SYSTEM and is where the flat files reside. SYSTEM has full permissions on a disk local to Server "B". Database directoriies defined on Server "A" point to Server "B" remote disk. External Tables on Server "A" are defined with directories that point to Server "B" remote (mapped) disk. I have no problems with this configuration.
I'm having a problem acheiving the same configuration with Oracle 10g and Windows 2003. I guess I'm baffled over the fact it isn't working the same way as my "old" environment. Why shouldn't it? Oracle (and you) want me to start services as a specific user. It shouldn't have to be that way unless something changed in the way the database makes calls to the os or if Microsoft slipped something in with one of it's numerous security patches. -
Os error in external tables in oracle 9i
hi, iam geting the following err when selecting the external table.
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04063: unable to open log file log.log
OS error The system cannot find the file specified.
ORA-06512: at "SYS.ORACLE_LOADER", line 14
ORA-06512: at line 1
my script for the external table is as follows
CREATE OR REPLACE DIRECTORY EXT_data AS 'f:\kindle\daily\zippedfiles\';
CREATE OR REPLACE DIRECTORY EXT_log AS 'd:\2.fin2004\1.sqlloader\3.logentries\thd0\log';
CREATE OR REPLACE DIRECTORY EXT_bad AS 'd:\2.fin2004\1.sqlloader\3.logentries\thd0\bad';
grant read, write on directory EXT_data to fincon1;
grant read, write on directory EXT_log to fincon1;
grant read, write on directory EXT_bad to fincon1;
CREATE TABLE THD0_DATA1
STATUS_CHARACTER char(1),
ACCOUNT_NUMBER VARchar(13),
NODEF1 VARchar(7),
TRANSACTION_COUNTER VARCHAR(5)
ORGANIZATION EXTERNAL
TYPE ORACLE_LOADER
DEFAULT DIRECTORY ext_data
ACCESS PARAMETERS
RECORDS DELIMITED BY '@'
badfile ext_bad:'bad.bad'
logfile ext_log:'log.log'
FIELDs
STATUS_CHARACTER ,
ACCOUNT_NUMBER ,
NODEF1 ,
TRANSACTION_COUNTER
LOCATION ('thd0data.dat')
REJECT LIMIT UNLIMITED
how to rectify the above error.
thanks and regards
S. DjeanthiIf you have oracle metalink support then refer to Note:150737.1. If no support, i can paste it send to your email id.
-
Create a External Table in Oracle 10g:== ERROR: KUP-01005
Hello.
I have a problem working with external tables, hope someone can help me with this problem. Thanks.
This is the code of the external table
========================
CREATE TABLE SIAFI.RNP_IDS
NUMERO_ID VARCHAR2(30 BYTE),
PRIMER_NOMBRE VARCHAR2(300 BYTE),
SEGUNDO_NOMBRE VARCHAR2(300 BYTE),
APELLIDO_PATERNO VARCHAR2(300 BYTE),
APELLIDO_MATERNO VARCHAR2(300 BYTE),
DEPARTAMENTO VARCHAR2(300 BYTE),
CORRELATIVO VARCHAR2(300 BYTE)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY SEG_DIRECTORIO
ACCESS PARAMETERS
( records delimited by NEWLINE
badfile SEG_DIRECTORIO:'censo.bad'
logfile SEG_DIRECTORIO:'censo.log'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' and '"'LDRTRIM
REJECT ROWS WITH ALL NULL FIELDS
(NUMERO_ID VARCHAR(30) NULLIF NUMERO_ID=BLANKS
TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' and '"'LDRTRIM,
PRIMER_NOMBRE VARCHAR(300) NULLIF PRIMER_NOMBRE=BLANKS
TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' and '"'LDRTRIM,
SEGUNDO_NOMBRE VARCHAR(300) NULLIF SEGUNDO_NOMBRE=BLANKS
TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' and '"'LDRTRIM,
APELLIDO_PATERNO VARCHAR(300) NULLIF APELLIDO_PATERNO=BLANKS
TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' and '"'LDRTRIM,
APELLIDO_MATERNO VARCHAR(300) NULLIF APELLIDO_MATERNO=BLANKS
TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' and '"'LDRTRIM,
DEPARTAMENTO VARCHAR(300) NULLIF DEPARTAMENTO=BLANKS
TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' and '"'LDRTRIM,
CORRELATIVO VARCHAR(300) NULLIF CORRELATIVO=BLANKS
TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' and '"'LDRTRIM,
LOCATION (SEG_DIRECTORIO:'censo.txt')
REJECT LIMIT UNLIMITED
NOPARALLEL
NOMONITORING;
When executing the stament select from RNP_IDS* it returns the following error message:
===========================================================
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-00554: error encountered while parsing access parameters
KUP-01005: syntax error: found "terminated": expecting one of: "and, comma, defaultif, not, nullif, or, )"
KUP-01007: at line 6 column 56
ORA-06512: at "SYS.ORACLE_LOADER", line 19
ORA-06512: at line 1
This is the example of the file I'm using:
==========================
"0","DOUGLAS","AUGUSTO","ABBOTT","","1","3672097"
"0101190600010","MARIA","URBANA","GOMEZ","URBINA","2","1949122"
"0101190600076","ENRIQUETA","","GARCIA","","2","1162025"
"0101190800106","LUCILA","","FLORES","","2","1658013"Hi
Here we go...
I reduced the 300 length of varcahr t o30 for testing purpose...
SQL> CREATE TABLE RNP_IDS
2 (
3 NUMERO_ID VARCHAR2(30),
4 PRIMER_NOMBRE VARCHAR2(30),
5 SEGUNDO_NOMBRE VARCHAR2(30),
6 APELLIDO_PATERNO VARCHAR2(30),
7 APELLIDO_MATERNO VARCHAR2(30),
8 DEPARTAMENTO VARCHAR2(30),
9 CORRELATIVO VARCHAR2(30)
10 )
11 ORGANIZATION EXTERNAL
12 ( TYPE ORACLE_LOADER
13 DEFAULT DIRECTORY LOG
14 ACCESS PARAMETERS
15 ( records delimited by NEWLINE
16 badfile LOG:'censo.bad'
17 logfile LOg:'censo.log'
18 FIELDS TERMINATED BY ','
19 OPTIONALLY ENCLOSED BY '"' and '"'LDRTRIM
20 REJECT ROWS WITH ALL NULL FIELDS
21 (
22 NUMERO_ID ,
23 PRIMER_NOMBRE ,
24 SEGUNDO_NOMBRE ,
25 APELLIDO_PATERNO,
26 APELLIDO_MATERNO ,
27 DEPARTAMENTO,
28 CORRELATIVO
29 )
30 )
31 LOCATION ('sample1.txt')
32 )
33 REJECT LIMIT UNLIMITED
34 NOPARALLEL
35 NOMONITORING;
Table created.
SQL> desc rnp_ids
Name Null? Type
NUMERO_ID VARCHAR2(30)
PRIMER_NOMBRE VARCHAR2(30)
SEGUNDO_NOMBRE VARCHAR2(30)
APELLIDO_PATERNO VARCHAR2(30)
APELLIDO_MATERNO VARCHAR2(30)
DEPARTAMENTO VARCHAR2(30)
CORRELATIVO VARCHAR2(30)
SQL> select numero_id from rnp_ids;
NUMERO_ID
0
0101190600010
0101190600076
0101190800106
- Pavan Kumar N -
Bad file is not created during the external table creation.
Hello Experts,
I have created a script for external table in Oracle 10g DB. Everything is working fine except it does not create the bad file, But it creates the log file. I Cann't figure out what is the issue. Because my shell scripts is failing and the entire program is failing. I am attaching the table creation script and the shell script where it is refering and the error. Kindly let me know if something is missing. Thanks in advance
Table Creation Scripts:_-------------------------------
create table RGIS_TCA_DATA_EXT
guid VARCHAR2(250),
badge VARCHAR2(250),
scheduled_store_id VARCHAR2(250),
parent_event_id VARCHAR2(250),
event_id VARCHAR2(250),
organization_number VARCHAR2(250),
customer_number VARCHAR2(250),
store_number VARCHAR2(250),
inventory_date VARCHAR2(250),
full_name VARCHAR2(250),
punch_type VARCHAR2(250),
punch_start_date_time VARCHAR2(250),
punch_end_date_time VARCHAR2(250),
event_meet_site_id VARCHAR2(250),
vehicle_number VARCHAR2(250),
vehicle_description VARCHAR2(250),
vehicle_type VARCHAR2(250),
is_owner VARCHAR2(250),
driver_passenger VARCHAR2(250),
mileage VARCHAR2(250),
adder_code VARCHAR2(250),
bonus_qualifier_code VARCHAR2(250),
store_accuracy VARCHAR2(250),
store_length VARCHAR2(250),
badge_input_type VARCHAR2(250),
source VARCHAR2(250),
created_by VARCHAR2(250),
created_date_time VARCHAR2(250),
updated_by VARCHAR2(250),
updated_date_time VARCHAR2(250),
approver_badge_id VARCHAR2(250),
approver_name VARCHAR2(250),
orig_guid VARCHAR2(250),
edit_type VARCHAR2(250)
organization external
type ORACLE_LOADER
default directory ETIME_LOAD_DIR
access parameters
RECORDS DELIMITED BY NEWLINE
BADFILE ETIME_LOAD_DIR:'tstlms.bad'
LOGFILE ETIME_LOAD_DIR:'tstlms.log'
READSIZE 1048576
FIELDS TERMINATED BY '|'
MISSING FIELD VALUES ARE NULL(
GUID
,BADGE
,SCHEDULED_STORE_ID
,PARENT_EVENT_ID
,EVENT_ID
,ORGANIZATION_NUMBER
,CUSTOMER_NUMBER
,STORE_NUMBER
,INVENTORY_DATE char date_format date mask "YYYYMMDD HH24:MI:SS"
,FULL_NAME
,PUNCH_TYPE
,PUNCH_START_DATE_TIME char date_format date mask "YYYYMMDD HH24:MI:SS"
,PUNCH_END_DATE_TIME char date_format date mask "YYYYMMDD HH24:MI:SS"
,EVENT_MEET_SITE_ID
,VEHICLE_NUMBER
,VEHICLE_DESCRIPTION
,VEHICLE_TYPE
,IS_OWNER
,DRIVER_PASSENGER
,MILEAGE
,ADDER_CODE
,BONUS_QUALIFIER_CODE
,STORE_ACCURACY
,STORE_LENGTH
,BADGE_INPUT_TYPE
,SOURCE
,CREATED_BY
,CREATED_DATE_TIME char date_format date mask "YYYYMMDD HH24:MI:SS"
,UPDATED_BY
,UPDATED_DATE_TIME char date_format date mask "YYYYMMDD HH24:MI:SS"
,APPROVER_BADGE_ID
,APPROVER_NAME
,ORIG_GUID
,EDIT_TYPE
location (ETIME_LOAD_DIR:'tstlms.dat')
reject limit UNLIMITED;
_***Shell Script*:*----------------_*
version=1.0
umask 000
DATE=`date +%Y%m%d%H%M%S`
TIME=`date +"%H%M%S"`
SOURCE=`hostname`
fcp_login=`echo $1|awk '{print $3}'|sed 's/"//g'|awk -F= '{print $2}'`
fcp_reqid=`echo $1|awk '{print $2}'|sed 's/"//g'|awk -F= '{print $2}'`
TXT1_PATH=/home/ac1/oracle/in/tsdata
TXT2_PATH=/home/ac2/oracle/in/tsdata
ARCH1_PATH=/home/ac1/oracle/in/tsdata
ARCH2_PATH=/home/ac2/oracle/in/tsdata
DEST_PATH=/home/custom/sched/in
PROGLOG=/home/custom/sched/logs/rgis_tca_to_tlms_create.sh.log
PROGNAME=`basename $0`
PROGPATH=/home/custom/sched/scripts
cd $TXT2_PATH
FILELIST2="`ls -lrt tstlmsedits*.dat |awk '{print $9}'`"
NO_OF_FILES2="`ls -lrt tstlmsedits*.dat |awk '{print $9}'|wc -l`"
$DEST_PATH/tstlmsedits.dat for i in $FILELIST2
do
cat $i >> $DEST_PATH/tstlmsedits.dat
printf "\n" >> $DEST_PATH/tstlmsedits.dat
mv $i $i.$DATE
#mv $i $TXT2_PATH/test/.
mv $i.$DATE $TXT2_PATH/test/.
done
if test $NO_OF_FILES2 -eq 0
then
echo " no tstlmsedits.dat file exists " >> $PROGLOG
else
echo "created dat file tstlmsedits.dat at $DATE" >> $PROGLOG
echo "-------------------------------------------" >> $PROGLOG
fi
NO_OF_FILES1="`ls -lrt tstlms*.dat |awk '{print $9}'|wc -l`"
FILELIST1="`ls -lrt tstlms*.dat |awk '{print $9}'`"
$DEST_PATH/tstlms.datfor i in $FILELIST1
do
cat $i >> $DEST_PATH/tstlms.dat
printf "\n" >> $DEST_PATH/tstlms.dat
mv $i $i.$DATE
# mv $i $TXT2_PATH/test/.
mv $i.$DATE $TXT2_PATH/test/.
done
if test $NO_OF_FILES1 -eq 0
then
echo " no tstlms.dat file exists " >> $PROGLOG
else
echo "created dat file tstlms.dat at $DATE" >> $PROGLOG
fi
cd $TXT1_PATH
FILELIST3="`ls -lrt tstlmsedits*.dat |awk '{print $9}'`"
NO_OF_FILES3="`ls -lrt tstlmsedits*.dat |awk '{print $9}'|wc -l`"
$DEST_PATH/tstlmsedits.datfor i in $FILELIST3
do
cat $i >> $DEST_PATH/tstlmsedits.dat
printf "\n" >> $DEST_PATH/tstlmsedits.dat
mv $i $i.$DATE
#mv $i $TXT1_PATH/test/.
mv $i.$DATE $TXT1_PATH/test/.
done
if test $NO_OF_FILES3 -eq 0
then
echo " no tstlmsedits.dat file exists " >> $PROGLOG
else
echo "created dat file tstlmsedits.dat at $DATE" >> $PROGLOG
echo "-------------------------------------------" >> $PROGLOG
fi
NO_OF_FILES4="`ls -lrt tstlms*.dat |awk '{print $9}'|wc -l`"
FILELIST4="`ls -lrt tstlms*.dat |awk '{print $9}'`"
$DEST_PATH/tstlms.datfor i in $FILELIST4
do
cat $i >> $DEST_PATH/tstlms.dat
printf "\n" >> $DEST_PATH/tstlms.dat
mv $i $i.$DATE
# mv $i $TXT1_PATH/test/.
mv $i.$DATE $TXT1_PATH/test/.
done
if test $NO_OF_FILES4 -eq 0
then
echo " no tstlms.dat file exists " >> $PROGLOG
else
echo "created dat file tstlms.dat at $DATE" >> $PROGLOG
fi
#connecting to oracle to generate bad files
sqlplus -s $fcp_login<<EOF
select count(*) from rgis_tca_data_ext;
select count(*) from rgis_tca_data_history_ext;
exit;
EOF
#counting the records in files
tot_rec_in_tstlms=`wc -l $DEST_PATH/tstlms.dat | awk ' { print $1 } '`
tot_rec_in_tstlmsedits=`wc -l $DEST_PATH/tstlmsedits.dat | awk ' { print $1 } '`
tot_rec_in_tstlms_bad=`wc -l $DEST_PATH/tstlms.bad | awk ' { print $1 } '`
tot_rec_in_tstlmsedits_bad=`wc -l $DEST_PATH/tstlmsedits.bad | awk ' { print $1 } '`
#updating log table
echo "pl/sql block started"
sqlplus -s $fcp_login<<EOF
define tot_rec_in_tstlms = '$tot_rec_in_tstlms';
define tot_rec_in_tstlmsedits = '$tot_rec_in_tstlmsedits';
define tot_rec_in_tstlms_bad = '$tot_rec_in_tstlms_bad';
define tot_rec_in_tstlmsedits_bad='$tot_rec_in_tstlmsedits_bad';
define fcp_reqid ='$fcp_reqid';
declare
l_tstlms_file_id number := null;
l_tstlmsedits_file_id number := null;
l_tot_rec_in_tstlms number := 0;
l_tot_rec_in_tstlmsedits number := 0;
l_tot_rec_in_tstlms_bad number := 0;
l_tot_rec_in_tstlmsedits_bad number := 0;
l_request_id fnd_concurrent_requests.request_id%type;
l_start_date fnd_concurrent_requests.actual_start_date%type;
l_end_date fnd_concurrent_requests.actual_completion_date%type;
l_conc_prog_name fnd_concurrent_programs.concurrent_program_name%type;
l_requested_by fnd_concurrent_requests.requested_by%type;
l_requested_date fnd_concurrent_requests.request_date%type;
begin
--getting concurrent request details
begin
SELECT fcp.concurrent_program_name,
fcr.request_id,
fcr.actual_start_date,
fcr.actual_completion_date,
fcr.requested_by,
fcr.request_date
INTO l_conc_prog_name,
l_request_id,
l_start_date,
l_end_date,
l_requested_by,
l_requested_date
FROM fnd_concurrent_requests fcr, fnd_concurrent_programs fcp
WHERE fcp.concurrent_program_id = fcr.concurrent_program_id
AND fcr.request_id = &fcp_reqid; --fnd_global.conc_request_id();
exception
when no_data_found then
fnd_file.put_line(fnd_file.log, 'Error:RGIS_TCA_TO_TLMS_CREATE.sh');
fnd_file.put_line(fnd_file.log, 'No data found for request_id');
fnd_file.put_line(fnd_file.log, sqlerrm);
raise_application_error(-20001,
'Error occured when executing RGIS_TCA_TO_TLMS_CREATE.sh ' ||
sqlerrm);
when others then
fnd_file.put_line(fnd_file.log, 'Error:RGIS_TCA_TO_TLMS_CREATE.sh');
fnd_file.put_line(fnd_file.log,
'Error occured when retrieving request_id request_id');
fnd_file.put_line(fnd_file.log, sqlerrm);
raise_application_error(-20001,
'Error occured when executing RGIS_TCA_TO_TLMS_CREATE.sh ' ||
sqlerrm);
end;
--calling ins_or_upd_tca_process_log to update log table for tstlms.dat file
begin
rgis_tca_to_tlms_process.ins_or_upd_tca_process_log
(l_tstlms_file_id,
'tstlms.dat',
l_conc_prog_name,
l_request_id,
l_start_date,
l_end_date,
&tot_rec_in_tstlms,
&tot_rec_in_tstlms_bad,
null,
null,
null,
null,
null,
null,
null,
l_requested_by,
l_requested_date,
null,
null,
null,
null,
null);
exception
when others then
fnd_file.put_line(fnd_file.log, 'Error:RGIS_TCA_TO_TLMS_CREATE.sh');
fnd_file.put_line(fnd_file.log,
'Error occured when executing rgis_tca_to_tlms_process.ins_or_upd_tca_process_log for tstlms file');
fnd_file.put_line(fnd_file.log, sqlerrm);
end;
--calling ins_or_upd_tca_process_log to update log table for tstlmsedits.dat file
begin
rgis_tca_to_tlms_process.ins_or_upd_tca_process_log
(l_tstlmsedits_file_id,
'tstlmsedits.dat',
l_conc_prog_name,
l_request_id,
l_start_date,
l_end_date,
&tot_rec_in_tstlmsedits,
&tot_rec_in_tstlmsedits_bad,
null,
null,
null,
null,
null,
null,
null,
l_requested_by,
l_requested_date,
null,
null,
null,
null,
null);
exception
when others then
fnd_file.put_line(fnd_file.log, 'Error:RGIS_TCA_TO_TLMS_CREATE.sh');
fnd_file.put_line(fnd_file.log,
'Error occured when executing rgis_tca_to_tlms_process.ins_or_upd_tca_process_log for tstlmsedits file');
fnd_file.put_line(fnd_file.log, sqlerrm);
end;
end;
exit;
EOF
echo "rgis_tca_to_tlms_process.sql started"
sqlplus -s $fcp_login @$SCHED_TOP/sql/rgis_tca_to_tlms_process.sql $fcp_reqid
exit;
echo "rgis_tca_to_tlms_process.sql ended"
_**Error:*----------------------------------*_
RGIS Scheduling: Version : UNKNOWN
Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
TCATLMS module: TCA To TLMS Import Process
Current system time is 18-AUG-2011 06:13:27
COUNT(*)
16
COUNT(*)
25
wc: cannot open /home/custom/sched/in/tstlms.bad
wc: cannot open /home/custom/sched/in/tstlmsedits.bad
pl/sql block started
old 33: AND fcr.request_id = &fcp_reqid; --fnd_global.conc_request_id();
new 33: AND fcr.request_id = 18661823; --fnd_global.conc_request_id();
old 63: &tot_rec_in_tstlms,
new 63: 16,
old 64: &tot_rec_in_tstlms_bad,
new 64: ,
old 97: &tot_rec_in_tstlmsedits,
new 97: 25,
old 98: &tot_rec_in_tstlmsedits_bad,
new 98: ,
ERROR at line 64:
ORA-06550: line 64, column 4:
PLS-00103: Encountered the symbol "," when expecting one of the following:
( - + case mod new not null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute forall merge time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
<an alternatively-quoted string literal with character set specification>
<an alternatively-q
ORA-06550: line 98, column 4:
PLS-00103: Encountered the symbol "," when expecting one of the following:
( - + case mod new not null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql st
rgis_tca_to_tlms_process.sql started
old 12: and concurrent_request_id = '&1';
new 12: and concurrent_request_id = '18661823';
old 18: and concurrent_request_id = '&1';
new 18: and concurrent_request_id = '18661823';
old 22: rgis_tca_to_tlms_process.run_tca_data(l_tstlms_file_id,&1);
new 22: rgis_tca_to_tlms_process.run_tca_data(l_tstlms_file_id,18661823);
old 33: rgis_tca_to_tlms_process.run_tca_data_history(l_tstlmsedits_file_id,&1);
new 33: rgis_tca_to_tlms_process.run_tca_data_history(l_tstlmsedits_file_id,18661823);
old 44: rgis_tca_to_tlms_process.send_tca_email('TCATLMS',&1);
new 44: rgis_tca_to_tlms_process.send_tca_email('TCATLMS',18661823);
declare
ERROR at line 1:
ORA-20001: Error occured when executing RGIS_TCA_TO_TLMS_PROCESS.sql ORA-01403:
no data found
ORA-06512: at line 59
Executing request completion options...
------------- 1) PRINT -------------
Printing output file.
Request ID : 18661823
Number of copies : 0
Printer : noprint
Finished executing request completion options.
Concurrent request completed successfully
Current system time is 18-AUG-2011 06:13:29
---------------------------------------------------------------------------Hi,
Check the status of the batch in SM35 transaction.
if the batch is locked by mistake or any other error, now you can release it and aslo you can process again.
To Release -Shift+F4.
Also you can analyse the job status through F2 button.
Bye -
Comparison of Data Loading techniques - Sql Loader & External Tables
Below are 2 techniques using which the data can be loaded from Flat files to oracle tables.
1) SQL Loader:
a. Place the flat file( .txt or .csv) on the desired Location.
b. Create a control file
Load Data
Infile "Mytextfile.txt" (-- file containing table data , specify paths correctly, it could be .csv as well)
Append or Truncate (-- based on requirement) into oracle tablename
Separated by "," (or the delimiter we use in input file) optionally enclosed by
(Field1, field2, field3 etc)
c. Now run sqlldr utility of oracle on sql command prompt as
sqlldr username/password .CTL filename
d. The data can be verified by selecting the data from the table.
Select * from oracle_table;
2) External Table:
a. Place the flat file (.txt or .csv) on the desired location.
abc.csv
1,one,first
2,two,second
3,three,third
4,four,fourth
b. Create a directory
create or replace directory ext_dir as '/home/rene/ext_dir'; -- path where the source file is kept
c. After granting appropriate permissions to the user, we can create external table like below.
create table ext_table_csv (
i Number,
n Varchar2(20),
m Varchar2(20)
organization external (
type oracle_loader
default directory ext_dir
access parameters (
records delimited by newline
fields terminated by ','
missing field values are null
location ('file.csv')
reject limit unlimited;
d. Verify data by selecting it from the external table now
select * from ext_table_csv;
External tables feature is a complement to existing SQL*Loader functionality.
It allows you to –
• Access data in external sources as if it were in a table in the database.
• Merge a flat file with an existing table in one statement.
• Sort a flat file on the way into a table you want compressed nicely
• Do a parallel direct path load -- without splitting up the input file, writing
Shortcomings:
• External tables are read-only.
• No data manipulation language (DML) operations or index creation is allowed on an external table.
Using Sql Loader You can –
• Load the data from a stored procedure or trigger (insert is not sqlldr)
• Do multi-table inserts
• Flow the data through a pipelined plsql function for cleansing/transformation
Comparison for data loading
To make the loading operation faster, the degree of parallelism can be set to any number, e.g 4
So, when you created the external table, the database will divide the file to be read by four processes running in parallel. This parallelism happens automatically, with no additional effort on your part, and is really quite convenient. To parallelize this load using SQL*Loader, you would have had to manually divide your input file into multiple smaller files.
Conclusion:
SQL*Loader may be the better choice in data loading situations that require additional indexing of the staging table. However, we can always copy the data from external tables to Oracle Tables using DB links.Please let me know your views on this.
-
I have an external table in Oracle 10.2.0.3. Can I update, insert or delete records through sqlplus?
Thanks a lot!That documentation is actually slightly misleading on that point...
Prior to 10g, the statement "External tables are read only; therefore, no DML operations are possible" was unambiguously true.
Starting in 10g, however, Oracle introduced ORACLE_DATAPUMP external tables (which are different than ORACLE_LOADER external tables that load human readable flat files). You are allowed to insert data into an ORACLE_DATAPUMP external table as the documentation goes on to discuss "Oracle also provides the ORACLE_DATAPUMP type, which lets you unload data (that is, read data from a table in the database and insert it into an external table) and then reload it into an Oracle database."
Justin
Maybe you are looking for
-
I remove my hard drive from time machine,now it won't recognize hard drive
i got a delayed error on my time machine backup saying Time Machine couldn't complete the backup to my back up hardrive, so what i did i removed my hard drive in time machine "select disk" , thinking if ill plug it back it'll recognize but it didn't.
-
HT3910 How to install Windows 7 on Macbook Air
i have windows7 on my pen drive.....suggest me how to install it on Macbook Air....
-
How to compare two files in SAP
Hi All, I have downloaded the contents of a custom table in two files and saved in the uncoverted format, now I want to comapre the contents of these files and see if there is any difference in these files or not. So is there any utility in SAP which
-
Destination unreachable; nested exception
Environment: JDeveloper 11.1.1.3.0 Build JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660 Oracle 12.1.1 JDK 1.6 I got this exception on the '23rd' step of this tutorial http://www.oracle.com/technology/obe/obe11jdev/ps1/ejb/ejb.html Thanks for your help
-
I am running Adobe Photoshop on Windows Vista 64 Bit. Some problems aroused while using the 64 bit version and I was now wondering if I could just remove the folder for Adobe Photoshop (64 Bit) since Adobe Photoshop works fine without it anyway?