Move BLOBs between Oracle databases

Photo by Andy Vult on Unsplash

Move BLOBs between Oracle databases

When you need to move BLOBs between databases (especially when DBs can't talk with each other), it needs a little bit more work, but it is still easy.

Necessary tools

  • SQL Developer

  • Oracle Instant Client with SQLLoader inside (file is called "sqlldr" and it's out of the box) - if you have SQLcl working, SQLLoader should work too.

Step 1 - Export BLOBS from source DB using SQL Developer "Cart"

Go to SQL Developer and use Cart to export objects containing BLOBs from your source database.

I prefer exporting files as a zip e.g. to /my_path/blobs.zip

Using Cart is well described in details by Jeff Smith here.

Step 2- Use SQL Loader to import BLOBs to target DB

Unzip the file created in step 1 to, e.g. /my_path/blobs

Ensure that you can connect to your target DB from the above location.

Use terminal and go to /my_path/blobs folder.

Review *.ctl file inside your folder - it shows what will happen if you run the script below.

sqlldr your_target_db_usr/password@your_db_tns_name CONTROL=BLOB_TABLE.ctl LOG=your_path_to_log_file/log.log BAD=your_path_to_error_log_file/err_log.bad skip=1

That's all.