OraCmd - Oracle access without client tool »

Download OraCmd Free Trial »

Import LOB Data

OraCmd can import LOB (BLOB, CLOB) data.

A Short Example

This section contains a short example showing how OraCmd import LOB (BLOB, CLOB) data.

The Table

We used the following SQL statement to create the table:

	create table T_FILE1
	(
	  ID          NUMBER not null,
	  FILEDATA    BLOB,
	  constraint PK_T_FILE primary key (ID)
	)
		

We need import the BLOB data in "FILEDATA" field.

See data files:

	E:\temp\lob>dir

	2008-07-30  20:21    <DIR>          .
	2008-07-30  20:21    <DIR>          ..
	2008-07-30  20:21             6,518 1.dat
	2008-07-30  20:21         5,571,204 2.dat
	2008-07-30  20:21            82,084 3.dat
	2008-07-30  20:21             1,033 4.dat
	2008-07-30  20:21            49,304 5.dat
	2008-07-30  20:21            85,799 6.dat
	2008-07-30  20:21           921,654 7.dat
	2008-07-30  20:21            36,304 8.dat
	2008-07-30  20:21            45,104 9.dat
		

OraCmd commmand

	importlob table=t_file1 lobfield=filedata namefield=id fileext=dat 
	folder="E:\temp\lob" importtype=insert;
		
Oracle import lob command

Or a batch file(replace the userid with your own database user info. The lines wrap in this page, but in the file is 1 line):

	"C:\Program files\OraCmd\OraCmd" userid=hr/hr@localhost:1521:xe 
	task=importlob table=t_file1 lobfield=filedata namefield=id fileext=dat 
	folder="E:\temp\lob" importtype=insert 
	log="E:\temp\importlob.log" quit=y
		

Import results:

Oracle Command Tool - import oracle lob result

The OraCmd parameter descriptions are as follows:

schema: schema name, use this prameter to unload specific schema's data, if not set, use logon user's default schema

table: table name 

lobfield: the lob field to be imported

namefield: files named field

fileext: file extension

folder: data files folder 

recursive: true|false, set to "ture" to import data from subfolders

importtype: insert|update