Oracle and MySQL are disparate systems. When you move binary data from one to other, you have to go through this conversion process.
While both MySql and ODP.Net access Blobs as Stream, in order to read from one and write to another, your program needs to speak the common tongue and that common tongue in .Net is byte[]
.
Now, with Oracle, you could just store the file as a BFILE
which is just a filesystem file as opposed to something that is managed by the RDBMS. If you do so, then you could just dump all blobs in MySql in a directory as outlined in this answer and you skip the byte array conversion from MySql altogether.
Adding the BFILE to Oracle will then be a batch job that you can run once the MySql dump is completed:
CREATE DIRECTORY test_dir AS '/tmp' -- replace tmp with actual my sql dump directory
-- Inserting the BFiles
INSERT INTO my_bfile_table VALUES (..., bfilename(test_dir, 'file1.pdf'));
INSERT INTO my_bfile_table VALUES (..., bfilename(test_dir, 'file2.pdf'));
...
Note that ODP.Net doesn't let you update BFILE
s, so you have to insert them via SQL Commands as shown above. You can do it via JDBC and other interfaces though.
If the files are large, you could actually gain some performance improvements due to reduced transaction log activity. There are off course some trade-offs associated with storing as BFILE
(like reduced manageability, need to separately backup filesystem etc.), so you may need to consider those.
If you have the option, then explore this idea - skip storing the PDFs in database altogether (BLOB or BFILE), move them to a CDN and store just a locator (URI) to the CDN asset in your database. Not only will the database be relieved largely, the end user experience will likely improve as well. It depends on your application and its requirements of course, but it may be worth exploring.