We have a production table that has millions of rows in it and contains a BLOB field, I would like to copy a smaller selection of these records into our development database without getting a DBA involved if possible. I tried the following COPY command but received a CPY-0012: Datatype cannot be copied
COPY FROM user/password@prod_db TO user/password@dev_db -
INSERT TABLE_A (COL1, COL2, COL3, BLOB_COL) USING -
SELECT COL1, COL2, COL3, BLOB_COL -
FROM TABLE_A WHERE COL1='KEY'
Is there a way to copy records with a BLOB field between databases via SQL?
Unfortunately you cannot copy
BLOB
values using theCOPY
command.An alternative is to set up a DB link on the source database, and execute a
SQL INSERT
statement:I came up with a solution I like--this version has a 4000 character limitation on the CLOB.
1) on the COPY TO database:
2) then run the copy command
3) on the COPY TO database:
4) then drop the tmp table
I had been struggling with this limitation, and this solution has helped me alot.
Oracle's Data Pump (started 10g+) supports moving BLOB data.