Extracting data into flat file thru unix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Extracting data into flat file thru unix
# 1  
Old 09-30-2010
Extracting data into flat file thru unix

Hi,

I need to extract a oracle staging table to a flat file thru unix batch process.We are expecting more than 4million records in the table.I know I can do it using "UTL_FILE" .But,since "UTL_FILE" takes a lot of time I am looking for better options.Can any body suggest some better options?

I tried spooling but couldn't get the file created in a specific path.Below is the code which I tried.

Unix script
Code:
vValue=`sqlplus -s <<-EOF 
$DB_id/$DB_pswd@$DB_server
start test.sql
exit
EOF`

SQL :
Code:
 
set echo off
set lines 150
set pages 0
set verify off
set feedback off
spool /u/dgapps/ikbdev/dta/tempbin
select pog_name ||',' ||status ||','||effective_from||','||effective_to from ikb_pog;
spool off

Please help.

Last edited by Scott; 09-30-2010 at 01:45 PM.. Reason: Please use code tags
# 2  
Old 09-30-2010
Can you make sure you have write permission in the target path ?
Code:
/u/dgapps/ikbdev/dta/tempbin

# 3  
Old 09-30-2010
I modified the code a little bit.Below is my modified code:

Code:
set echo off
set lines 150
set pages 0
set verify off
set feedback off
spool /u/dgapps/ikbdev/dta/ikb_pog.dat
select pog_name ||',' ||status ||','||effective_from||','||effective_to from ikb_pog;
spool off

And my program is in /u/dgapps/ikbdev/bin and it have write permission to dta.

Last edited by Scott; 09-30-2010 at 02:16 PM.. Reason: Code tags, please...
# 4  
Old 09-30-2010
Beena,
What is the location of your test.sql ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

URGENT HELP!!! Extracting db table into flat file

Hi All, I am writing a shell script to extract oracle table into a pipe dilemited flat file. Below is my code and I have attached two files that I have abled to generate so far. 1. Table.txt ==> database extract file 2. flat.txt ==> pipe delimited after some manipulation of the original db... (0 Replies)
Discussion started by: express14
0 Replies

2. Shell Programming and Scripting

Getting data from a flat file based on condition

Hi, I have a flaty file from which i am fetching few columns in tablular form as below code. Now i want to fetch the column 6 and 7 in below code only if it either of them is non zero.However below startement awk -F, '$6==0 && $7==0{exit 1}' ${IFILE} is not working..Not sure where is the... (36 Replies)
Discussion started by: Vivekit82
36 Replies

3. Shell Programming and Scripting

Data is available or not in a flat file generated by Oracle

Hello, please help me an the below issue. i need to check whether data is available or not in a flat file generated by oracle (sometimes sql didn't any records) to overcome this. without opening flat file. Thanks....... (1 Reply)
Discussion started by: mahesh1987
1 Replies

4. UNIX for Dummies Questions & Answers

Normalize Data and write to a flat file

All, Can anyone please help me with the below scenario. I have a Flat file of the below format. ID|Name|Level|Type|Zip|MAD|Risk|Band|Salesl|Dealer|CID|AType|CValue|LV|HV|DCode|TR|DU|NStartDate|UserRole|WFlag|EOption|PName|NActivationDate|Os|Orig|Cus|OType|ORequired|DType 03|... (10 Replies)
Discussion started by: sp999
10 Replies

5. Shell Programming and Scripting

Extracting email addresses from a flat file

All, I have a flat file which contains an email address in every line. I am trying to find a way to extract all the email addresses delimited by comma (,). Can you please show me a way, it will be very helpful, thanks. (3 Replies)
Discussion started by: sed_beginner19
3 Replies

6. Shell Programming and Scripting

Extracting data between tags based on search string from unix file

Input file is on Linux box and the input file has data in just one line with 1699741696 characters. Sample Input: <xxx><document coll="uspatfull" version="0"><CMSdoc>xxxantivirus</CMSdoc><tag1>1</tag1></document><document coll="uspatfull"... (5 Replies)
Discussion started by: gaya
5 Replies

7. Shell Programming and Scripting

Load data from a flat file to oracle.

I have a flat file with records like Header 123 James Williams Finance2000 124 Pete Pete HR 1500 125 PatrickHeather Engg 3000 Footer The structure is: Eno:4 characters Name:8 characters Surname : 9 characters Dept:7 characters Sal:4characters These are sample... (1 Reply)
Discussion started by: Shivdatta
1 Replies

8. Shell Programming and Scripting

Loading Oracle data to unix in flat file

Hi I would like to know how to load oracle data to unix flat file using a shell script. Can we use sqlldr to import data from oracle, if so can anyone help me with it. (2 Replies)
Discussion started by: raghav288
2 Replies

9. Shell Programming and Scripting

inserting data into a table from a flat file

Hi, I want to insert data into a table from a flat file, the file is having around 25 columns and some 10,000 records. The columns values are seperated by a space. Thanks (1 Reply)
Discussion started by: ss_ss
1 Replies

10. Shell Programming and Scripting

urgent-extracting block data from flat file using shell script

Hi, I want to extract block of data from flat file. the data will be like this start of log One two three end of log i want all data between start of log to end of log i.e One two three to be copied to another file. This particular block may appear multiple times in same file. I... (4 Replies)
Discussion started by: shirish_cd
4 Replies
Login or Register to Ask a Question