How to Upload Files from Autonomous Database directory to OCI Object Storage Bucket

This article guides you through the commands for uploading the dump files or any other files from an Oracle Autonomous Database directory (DATA_PUMP_DIR) to OCI Object Storage Bucket. The directory can be any other directory as well. It doesn’t necessarily have to be only DATA_PUMP_DIR.
1. Let's first see which files currently exist in your Autonomous Database DATA_PUMP_DIR directory.
SQL> SELECT object_name, bytes, created, last_modified FROM DBMS_CLOUD.LIST_FILES('DATA_PUMP_DIR');
-- Output:
OBJECT_NAME BYTES CREATED LAST_MODIFIED
------------------------------------------------------------ ---------- ---------------------------------------- ----------------------------------------
MOVIESTREAM-14_21_39.DMP 261926912 06-APR-25 02.33.10.000000000 PM GMT 06-APR-25 02.34.09.000000000 PM GMT
2. As you see in the above output, one file called “MOVIESTREAM-14_21_39.DMP” is available in your DATA_PUMP_DIR. Now, to upload / copy this file to your OCI Object Storage Bucket, execute the following commands:
-- First Create the Credential
BEGIN
DBMS_CLOUD.CREATE_CREDENTIAL(
credential_name => 'MY_CLOUD_CREDENTIAL', -- Give any name of your choice
username => 'identitycloudservice/baskar.babu@xyz.com', -- This is taken from your OCI User Profile
password => '+BM4(U)d-GgxUXirFkGS' ); -- This is your Auth Token ID / Password
END;
/
-- Use DBMS_CLOUD.PUT_OBJECT procedure.
BEGIN
DBMS_CLOUD.PUT_OBJECT(credential_name => 'MY_CLOUD_CREDENTIAL', -- Credential Name from above step.
object_uri => '<BUCKET_PAR_URL>/MOVIESTREAM.DMP', -- Change <BUCKET_PAR_URL> with actual PAR URL. And, append with any meaningful Filename.
directory_name => 'DATA_PUMP_DIR', -- Directory Name
file_name => 'MOVIESTREAM-14_21_39.DMP'); -- Filename in DATA_PUMP_DIR directory
END;
/
Thanks for reading this pretty straight-forward and simple article.
Subscribe to my newsletter
Read articles from Baskar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
