Wednesday, August 19, 2009

Load Huge Data block into Oracle database

You can use sqlloader to insert or update huge amount of data into an oracle database. All you need is to create a control file and data file according to that.
example control file is shown below (load.ctl)
load data
infile 'b00000004.dat'
badfile 'b00110000.bad'
discardfile 'b00110000.dsc'
INSERT INTO TABLE CHANA_TEST
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
(R_TYPE,CAUSE,FLAG,A_NUM,B_NUM)

using this control file you can insert data into table chana_test where you have 5 columns in that table. examle data file is shown below.

0,aa,1,"1233","3333"
1,ww,1,"123","32323"
0,aa,1,"1233","3333"
1,ww,1,"123","32323"

once you have these two files you can upload huge number of data in to the database very quickly. All you need to do is run this command and shell prompt.

$sqlldr user/pass control=load.ctl

That's it enjoy.

No comments:

Post a Comment