Export Data to a Directory as Oracle Data Pump Files

You can export data to a directory as Oracle Data Pump dump files by specifying a query.

With this export method you use the DBMS_CLOUD.EXPORT_DATA procedure to specify a query to select the data to export as a dump file to a directory.

  1. Connect to your Autonomous AI Database instance.

  2. Create a directory.

    For example:

    CREATE DIRECTORY export_dir AS 'export_dir';

    See Create Directory in Autonomous AI Database for more information.

  3. Export data from Autonomous AI Database to your directory as Oracle Data Pump dump file(s) with DBMS_CLOUD.EXPORT_DATA and specify the format parameter type as datapump. For example:

    BEGIN
     DBMS_CLOUD.EXPORT_DATA(
        file_uri_list => 'export_dir:sales.dmp',
        format => json_object('type' value 'datapump'),
        query => 'SELECT * FROM sales'
     );
    END;
    /

    Example to export data as multiple Data Pump files to a directory:

    BEGIN
     DBMS_CLOUD.EXPORT_DATA(
        file_uri_list => 'export_dir:sales1.dmp, export_dir:sales2.dmp',
        format => json_object('type' value 'datapump'),
        query => 'SELECT * FROM sales'
     );
    END;
    /

    The parameters are:

    • file_uri_list: is a comma delimited list of the export file(s). Use of wildcard and substitution characters is not supported in the file_uri_list.

    • format: specifies the required type parameter. The valid values are datapump, json, xml, csv and parquet and it also optionally defines the options you can specify for the export with the ORACLE_DATAPUMP Access Driver.

    • query: specifies a SELECT statement so that only the required data is exported. The query determines the contents of the dump file(s).

    Note: The DBMS_CLOUD.EXPORT_DATA procedure creates the dump file(s) that you specify in the file_uri_list.

    For detailed information about the parameters, See EXPORT_DATA Procedure.

Notes for exporting data with DBMS_CLOUD.EXPORT_DATA: