AWS RDS Oracle Database – Download files from S3 bucket

Download Files from AWS S3 Bucket to RDS Oracle DB


1. Download all files from S3 Bucket folder

Step 1:

Login in to the AWS Console and check the S3 bucket folder path for availability of the Files to be moved into to RDS DB Instance.

Step 2:

Execute the below download query with the right details for S3 bucket folder name, files name

SELECT rdsadmin.rdsadmin_s3_tasks.download_from_s3(
p_bucket_name => ‘db-bkps’,
p_directory_name => ‘DATA_PUMP_DIR’)
AS TASK_ID FROM DUAL;
/

You will get a task ID and replace the dbtask ID in the below query to check the file download status.

(‘BDUMP’,’dbtask-<ID>.log’));

The download status of the files from S3 bucket to RDS Instance will be displayed as below.

Step 3:

When you cross the status in the Database Data Pump folder path with the below query, you get the status as below

select filename, filesize/1024/1024.00 size_in_gb from table(RDSADMIN.RDS_FILE_UTIL.LISTDIR(‘DATA_PUMP_DIR’)) order by filename;

The status show that the file as <xxxxx.incomplete> denotes as downloading is in progress.

Files Download from S3 bucket to RDS instances can be found from few methods as shown below.


2. Download a specific individual file from S3 Bucket

Use the below query to download the specific individual file from the S3 bucket folder.

SELECT rdsadmin.rdsadmin_s3_tasks.download_from_s3(
p_bucket_name => ‘db-bkps’, — S3 bucket name where you want to download from.
p_s3_prefix => ‘db-bkps/DBA.dmp’, — Folder name and individual file name
p_directory_name => ‘DATA_PUMP_DIR’) — Directory Name you want to download to.
AS TASK_ID FROM DUAL;
/


* End of Document *

You may also like...