txt file to oracle database


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting txt file to oracle database
# 8  
Old 03-07-2005
Quote:
Originally Posted by jorhul
i tried that link but its asks for username/password
Sorry about that. Register for a free account at Oracle's Technet.

Here is a simple control file to use:
Code:
# pir.ctl
LOAD DATA 
INFILE 'pir.dat' 
BADFILE 'pir.bad'
DISCARDFILE 'pir.dsc'

INTO TABLE "PIR_UD"
INSERT
(gid,time)

Put your data in the ".dat" file as comman delimited.

Code:
GID1,Value1
GID2,Value2

Invoke sqlldr as follows:
Code:
sqlldr control=pir.ctl data=pir.dat

Oracle should prompt you for your username and password.

Don't let this fool you though. If you increase your data's complexity, you are going to increase the complexity of the control file as well.

Good luck,

Thomas
# 9  
Old 03-09-2005
Quote:
Originally Posted by ZealeS
Code:
bash-2.05$ cat filename
2005/02/21 16:56:54.301: 111 PS (200, 10) sent <log instrument="FXA.ROSS" name="FXA.COSS.PAH.URR"><gid_id>1434025</gid_id><submit_id>22</submit_id><taker_name>shannop2</taker_name><taker_group_name>SupportClients/SupportUsers</taker_group_name><taker_account>Demo 

2005/02/21 16:56:55.596: 111 PS (200, 10) sent <log instrument="FXA.ROSS" name="FXA.ROSS.PUR.URR"><gid_id>1534025</gid_id><submit_id>22</submit_id><taker_name>shannop2</taker_name><taker_group_name>SupportClients/SupportUsers</taker_group_name><taker_account>Demo

bash-2.05$ awk '/^20/{a=index($0,"gid_id>");b=index($0,"</gid_id");print substr($2,0,length($2)-1)"\t"substr($0, a+7, b-a-7);}' filename
16:56:54.301    1434025
16:56:55.596    1534025
bash-2.05$

Hi , I tried that piece of code it gave me the following error:

awk: record `2005/02/21 16:56:45....' too long
record number 1

cheers,
Jo
# 10  
Old 03-09-2005
Hi guys, i'm being a bt dumn here but will be great if you can help!

I'm writing this script(named as Jo.sh), now i'm wondering if i need to include the ctl file within the unix script or should the ctl file be called from within the script file. Here are the details:

Should the script look like this:

#jo.sh (this is the script file on my unix machine)
nice grep sent pac.txt |nice grep 'log ins'|nice grep spot_markup|cut -c12-23>jo.txt
nice grep sent pac.txt |nice grep 'log ins'|nice grep spot_markup|cut -c107-113>jo1.txt

paste jo.txt jo1.txt>pir.dat

# pir.ctl

sqlplus -s asasas/asasa@asas.com << ++ > /dev/null

LOAD DATA
INFILE 'pir.dat'
BADFILE 'pir.bad'
DISCARDFILE 'pir.dsc'

INTO TABLE "PIRSUP_GID_ORDERS"
INSERT
(GID_ID,DEAL_TIME)


cheers,
Jo
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

Identify a specific environment Oracle variable to connect a remote Oracle database ?

Good evening I nned your help pls, In an unix server i want to connect to a remote oracle databse server by sqlplus. I tried to find out the user/passwd and service name by env variable and all Ive got is this: ORACLE_SID_REPCOL=SCL_REPCOL ORACLE_SID=xmeta ORACLE_SID_TOL=SCL_PROTOLCOL... (2 Replies)
Discussion started by: alexcol
2 Replies

2. Shell Programming and Scripting

shellscript to read data from txt file and import to oracle db

Hi all, Help needed urgently. I am currently writing a shellscript to read data/record from a flat file (.txt) file, and import/upload the data to oracle database. The script is working fine, but it takes too long time (for 18000 records, it takes around 90 mins). I guess it takes so long... (1 Reply)
Discussion started by: robot_mas
1 Replies

3. Shell Programming and Scripting

Using csh / awk / sed to compare database sizes in a txt file

Hello, I have an output file showing database sizes across the 3 environments that I use (LIVE, TEST & DEVELOPMENT). I am trying to write a script that lets me know if the size of a db on one environment is different to its corresponding db on the other environments. Here is an example... (4 Replies)
Discussion started by: stevie_g
4 Replies

4. Solaris

Can't create database after Oracle Database installation

I installed Oracle 10 software on Solaris 11 Express, everything was fine execpt I can't create database using dbca.rsp file. I populated file with following options. OPERATION_TYPE = "createDatabase" GDBNAME = "solaris_user.domain.com" SID = "solaris_user" TEMPLATENAME = "General... (0 Replies)
Discussion started by: solaris_user
0 Replies

5. Shell Programming and Scripting

Find similar entry in a .txt file acting as a database.

May i know how do i go along finding similar entry in a .txt file, which is used a as a "database" and post and error saying the entry existed when we key in the entry. ---------- Post updated at 05:18 PM ---------- Previous update was at 05:16 PM ---------- i mean post an error saying the... (5 Replies)
Discussion started by: santonio
5 Replies

6. Shell Programming and Scripting

how to extract the data from database (oracle) and send the output as an .xls file?

Hi, How to extract the data from Oracle database and sent the output data to mails using mailx command with .xls attachement? Here i know how to connect the database using unix shell script and how to use the mailx command in UNIX script But i don't know how to use the .xls format file (i... (1 Reply)
Discussion started by: psiva_arul
1 Replies
Login or Register to Ask a Question