Use Data Pump to Export Data to Cloud Object Storage in Oracle Database 26ai

Oracle Database 26ai supports direct Oracle Data Pump exports from Autonomous AI Database to the following Cloud Object Storage:

  • Oracle Cloud Infrastructure Object Storage
  • Amazon S3
  • Azure Blob Storage or Azure Data Lake Storage
  • Google Cloud Storage

With this export method, Oracle Data Pump writes the dump files directly to the target Cloud Object Storage. You do not need to first save the dump files in a database directory and then upload them separately.

To perform a direct export, you:

  1. Create a credential for the target Cloud Object Storage using DBMS_CLOUD.CREATE_CREDENTIAL.
  2. Specify the credential name using the Data Pump credential parameter.
  3. Specify the target Cloud Object Storage location using the dumpfile parameter.
  4. Run Data Pump Export using a parameter file.

For general information about using the Data Pump credential parameter, see Use Oracle Data Pump to Export Data to Object Store Using CREDENTIAL Parameter (Version 19.9 or Later).

Before You Begin

Before you begin:

  1. Create a bucket or container in the target Cloud Object Storage.
  2. Obtain the credentials required to access the target Cloud Object Storage.
  3. Install Oracle Data Pump 19.9 or later. Oracle recommends using the latest version of Oracle Instant Client Downloads, including the Tools package.
  4. Connect to Autonomous AI Database using the HIGH service for best export performance.

The directory parameter specifies the database directory used for the Data Pump log file. The dump files are written directly to the Cloud Object Storage service specified by the dumpfile parameter.

Create a Cloud Object Storage Credential

Create a credential for the Cloud Object Storage to which you want to export the dump files.

Examples

The following examples show how to create credentials for each supported Cloud Object Storage. Use the credential name that you create in the corresponding Data Pump parameter file.

OCI Object Storage

For Oracle Cloud Infrastructure Object Storage, use OCI native authentication supported for Oracle Database 26ai. For example:

BEGIN
  DBMS_CLOUD.CREATE_CREDENTIAL(
    credential_name => 'OCI_OBJECT_STORAGE_CRED',
    username        => 'oci_user@example.com',
    password        => 'oci_authentication_token'
  );
END;
/

Amazon S3

For Amazon S3, specify the AWS access key ID as username and the AWS secret access key as password:

BEGIN
  DBMS_CLOUD.CREATE_CREDENTIAL(
    credential_name => 'AWS_S3_CRED',
    username        => 'AKIAEXAMPLE123456789',
    password        => 'aws_secret_access_key'
  );
END;
/

Azure Blob Storage

For Azure Blob Storage or Azure Data Lake Storage, specify the storage account name as username and the shared access signature (SAS) token as password:

BEGIN
  DBMS_CLOUD.CREATE_CREDENTIAL(
    credential_name => 'AZURE_BLOB_CRED',
    username        => 'myadlsstorageacct',
    password        => 'azure_sas_token'
  );
END;
/

Google Cloud Storage

For Google Cloud Storage, create a credential using the service account information required by your Google Cloud Storage authentication method. For example:

BEGIN
  DBMS_CLOUD.CREATE_CREDENTIAL(
    credential_name => 'GCS_CRED',
    username        => 'gcs-service-account@example-project.iam.gserviceaccount.com',
    password        => 'google_private_key'
  );
END;
/

For more information:

Create a Data Pump Parameter File

Create a parameter file that specifies the objects to export, the credential, and the Cloud Object Storage URL. The following examples use DATA_PUMP_DIR for the log file and %L to create additional dump files as needed.

Export a Schema to Azure Blob Storage

The following parameter file exports the HR schema to Azure Blob Storage:

schemas=HR
credential=AZURE_BLOB_CRED
dumpfile=https://<azure_storage_account>.blob.core.windows.net/<container>/hr_exp%L.dmp
filesize=5GB
parallel=8
directory=DATA_PUMP_DIR
logfile=hr_export.log
encryption_pwd_prompt=yes

Export a Full Database to Amazon S3

The following parameter file exports the full database to Amazon S3:

full=y
credential=AWS_S3_CRED
dumpfile=https://s3.<aws_region>.amazonaws.com/<bucket>/adb_exp%L.dmp
filesize=5GB
parallel=8
directory=DATA_PUMP_DIR
logfile=aws_export.log
encryption_pwd_prompt=yes

Export a Full Database to OCI Object Storage

The following parameter file exports the full database to an OCI Object Storage bucket. It uses the OCI_OBJECT_STORAGE_CRED credential created in the previous step.

full=y
credential=OCI_OBJECT_STORAGE_CRED
dumpfile=https://<namespace>.objectstorage.<region>.oci.customer-oci.com/n/<namespace>/b/<bucket>/o/adb_exp%L.dmp
filesize=5GB
parallel=8
directory=DATA_PUMP_DIR
logfile=oci_export.log
encryption_pwd_prompt=yes

In this example, Data Pump uses the OCI credential to authenticate with Object Storage and writes the dump files to the specified bucket. Replace <NAMESPACE>, <REGION>, and <BUCKET> with the values for your OCI tenancy.

Export a Schema to Google Cloud Storage

The following parameter file exports the HR schema to a Google Cloud Storage bucket. It uses the GCS_CRED credential created in the previous step.

schemas=HR
credential=GCS_CRED
dumpfile=https://storage.googleapis.com/<BUCKET>/hr_exp%L.dmp
filesize=5GB
parallel=8
directory=DATA_PUMP_DIR
logfile=gcs_export.log
encryption_pwd_prompt=yes

In this example, Data Pump exports only the HR schema and writes the dump files to the specified Google Cloud Storage bucket.

Run the Data Pump Export

Run Data Pump Export with the parameter file. For example:

expdp admin/<password>@<db_service_name> parfile=azure_expdp.par

For the Amazon S3 example, run:

expdp admin/<password>@<db_service_name> parfile=aws_expdp.par

For the OCI Object Storage example, run:

expdp admin/<password>@<db_service_name> parfile=oci_expdp.par

For the Google Cloud Storage example, run:

expdp admin/<password>@<db_service_name> parfile=gcs_expdp.par

The Data Pump log file is written to DATA_PUMP_DIR. The dump files are written to the Cloud Object Storage URL specified in the parameter file.

Usage Notes

  • Use the HIGH database service for best export performance.
  • Set parallel to approximately one quarter of the available ECPUs.
  • The %L substitution variable creates multiple dump files as needed.
  • Consider using compression=all for large exports.
  • Use encryption_pwd_prompt=yes when exporting sensitive data. Use the same encryption password when you import the dump files.
  • To perform a full export or export objects owned by other users, you need the DATAPUMP_CLOUD_EXP role.
  • For information about downloading dump files, running Data Pump Import, and cleaning up the object store, see Download Dump Files, Run Data Pump Import, and Clean Up Object Store.

For detailed information about Data Pump Export parameters, see Oracle AI Database Utilities.