Performing a mass-load of BLOBS                                                       Administration TipsMass-loading BLOB...
Performing a mass-load of BLOBS                                                Administration TipsYou should find the thin...
Upcoming SlideShare
Loading in …5
×

Loadblobs

215 views
171 views

Published on

oracle foreign key primary key constraints performance tuning MTS IOT 9i block size backup rman corrupted column drop rename recovery controlfile backup clone architecture database archives export dump dmp duplicate rows extents segments fragmentation hot cold blobs migration tablespace locally managed redo undo new features rollback ora-1555 shrink free space user password link TNS tnsnames.ora listener java shutdown sequence

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
215
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Loadblobs

  1. 1. Performing a mass-load of BLOBS Administration TipsMass-loading BLOBS into a tableHeres a real issue I had to deal with recently, and thanks to Anurag Varma(avdbi@hotmail.com) whos a regular poster on the comp.databases.oracle.servernewsgroup and who proffered these techniques in response to my own pleas for help, I cannow share them with you.My table was constructed thus:CREATE TABLE ALBUM (PHOTOID NUMBER CONSTRAINT PHOTOID_PK PRIMARY KEY,PHOTO BLOB);...with a sequence and trigger to generate a unique number for each photo to be loaded:CREATE SEQUENCE PHOTONUM;CREATE OR REPLACE TRIGGER IDPHOTOBEFORE INSERT ON ALBUMFOR EACH ROWBEGIN SELECT PHOTONUM.NEXTVAL INTO :NEW.PHOTOID FROM DUAL;END;10So how best to load all 10000+ photos into the album table?First, get a listing of all the files, and store it in a text file which well call photos.lst. Easyenough: just type DIR /B /S D:PHOTOALBUM*.* > PHOTOS.LST in a DOS window.Second, create a SQL Loader control file, which well call loadalbum.ctl, containing thefollowing lines:LOAD DATAINFILE PHOTOS.LSTINTO TABLE ALBUM(EXT_FNAME FILLER CHAR(200),PHOTO LOBFILE(EXT_FNAME) TERMINATED BY EOF)Finally, run SQL Loader by typing the following command:SQLLDR USERID=USERNAME/PASSWOIRD@TNSNAMES_ALIAS CONTROL=LOADALBUM.CTLCopyright © Howard Rogers 2001 10/18/2001 Page 1 of 2
  2. 2. Performing a mass-load of BLOBS Administration TipsYou should find the thing now proceeds apace, and at the end of it, you should check theSQL Loader log file for any errors that might have been encountered. That will be locatedin a file called (in this case) loadalbum.log, located in the directory from which youlaunched SQL Loader in the first place.The principle lesson to be learned here is that SQL Loader is a fine tool for mass-loadingblobs into Oracle -a fact which Id forgotten, and of which Anurag kindly reminded me.Copyright © Howard Rogers 2001 10/18/2001 Page 2 of 2

×