Import Data Using Oracle Data Pump on Autonomous Data Warehouse

Oracle Data Pump offers very fast bulk data and metadata movement between Oracle databases and Autonomous Data Warehouse.

Data Pump Import lets you import data from Data Pump files residing on Oracle Cloud Infrastructure Object Storage, Microsoft Azure, AWS S3, and Oracle Cloud Infrastructure Object Storage Classic. You can save your data to your Cloud Object Store and use Oracle Data Pump to load data to Autonomous Data Warehouse.

Export Your Existing Oracle Database to Import into Autonomous Data Warehouse

You need to use Oracle Data Pump Export to export your existing Oracle Database schemas to migrate them to Autonomous Data Warehouse using Oracle Data Pump Import.

Oracle recommends using the following Data Pump Export parameters for faster and easier migration to Autonomous Data Warehouse:

exclude=index,cluster,indextype,materialized_view,materialized_view_log,materialized_zonemap,db_link
data_options=group_partition_table_data 
parallel=n
schemas=schema_name
dumpfile=export%u.dmp

Oracle Data Pump Export provides several export modes, Oracle recommends using the schema mode for migrating to Autonomous Data Warehouse. You can list the schemas you want to export by using the schemas parameter.

For a faster migration, export your schemas into multiple Data Pump files and use parallelism. You can specify the dump file name format you want to use with the dumpfile parameter. Set the parallel parameter to at least the number of CPUs you have in your Autonomous Data Warehouse database.

The exclude and data_options parameters ensure that the object types not required in Autonomous Data Warehouse are not exported and table partitions are grouped together so that they can be imported faster during the import to Autonomous Data Warehouse. If you want to migrate your existing indexes, materialized views, and materialized view logs to Autonomous Data Warehouse and manage them manually, you can remove those object types from the exclude list which will export those object types too. Similarly, if you want to migrate your existing partitioned tables as-is without converting them into non-partitioned tables and manage them manually you can remove the data_options argument which will export your partitioned tables as-is. For more information, see Managing Partitions, Indexes, and Materialized Views.

The following example exports the SH schema from a source Oracle Database for migration to an Autonomous Data Warehouse database with 16 CPUs:

expdp sh/sh@orcl \
exclude=index,cluster,indextype,materialized_view,materialized_view_log,materialized_zonemap,db_link \
data_options=group_partition_table_data  \
parallel=16 \
schemas=sh \
dumpfile=export%u.dmp

You can use other Data Pump Export parameters, like compression, depending on your requirements. For more information on Oracle Data Pump Export see Oracle Database Utilities.

Import Data Using Oracle Data Pump Version 18.3 or Later

Oracle recommends using the latest Oracle Data Pump version for importing data from Data Pump files into your Autonomous Data Warehouse as it contains enhancements and fixes for a better experience.

Download the latest version of Oracle Instant Client, which includes Oracle Data Pump, for your platform from Oracle Instant Client Downloads. See the installation instructions on the platform install download page for the installation steps required after you download Oracle Instant Client.

In Oracle Data Pump version 18.3 and later, the credential argument authenticates Data Pump to the Cloud Object Storage service you are using for your source files. The dumpfile argument is a comma delimited list of URLs for your Data Pump files.

In Oracle Data Pump, if your source files reside on the Oracle Cloud Infrastructure Object Storage you can use the Oracle Cloud Infrastructure native URIs or the Swift URIs. See DBMS_CLOUD Package File URI Formats for details on these file URI formats.

Importing with Oracle Data Pump and Setting credential Parameter

  1. Store your Cloud Object Storage credential using DBMS_CLOUD.CREATE_CREDENTIAL. For example:
    BEGIN
      DBMS_CLOUD.CREATE_CREDENTIAL(
        credential_name => 'DEF_CRED_NAME',
        username => 'adwc_user@example.com',
        password => 'password'
      );
    END;
    /

    For more information on the credentials for different Cloud Object Storage services, see CREATE_CREDENTIAL Procedure.

  2. Run Data Pump Import with the dumpfile parameter set to the list of file URLs on your Cloud Object Storage and the credential parameter set to the name of the credential you created in the previous step. For example:
    impdp admin/password@ADWC1_high \       
         directory=data_pump_dir \       
         credential=def_cred_name \      
         dumpfile= https://objectstorage.us-ashburn-1.oraclecloud.com/n/adwc/b/adwc_user/o/export%u.dmp \
         parallel=16 \
         partition_options=merge \ 
         transform=segment_attributes:n \
         transform=dwcs_cvt_iots:y transform=constraint_use_default_index:y \
         exclude=index,cluster,indextype,materialized_view,materialized_view_log,materialized_zonemap,db_link

    For the best import performance use the HIGH database service for your import connection and set the PARALLEL parameter to the number of CPUs in your Autonomous Data Warehouse as shown in the example.

    For information on which database service name to connect to run Data Pump Import, see Managing Concurrency and Priorities on Autonomous Data Warehouse.

    For the dump file URL format for different Cloud Object Storage services, see DBMS_CLOUD Package File URI Formats.

    This example shows the recommended parameters for importing into your Autonomous Data Warehouse.

    In this example:

    • Partitioned tables are converted into non-partitioned tables.

    • Storage attributes for tables are ignored.

    • Index-organized tables are converted into regular tables.

    • Indexes created for primary key and unique key constraints will be renamed to the constraint name.

    • Indexes, clusters, indextypes, materialized views, materialized view logs, and zone maps are excluded during Data Pump Import.

    Note:

    To perform a full import or to import objects that are owned by other users, you need the DATAPUMP_CLOUD_IMP role.

    For information on disallowed objects in Autonomous Data Warehouse, see Restrictions for SQL Commands.

    For detailed information on Oracle Data Pump Import parameters see Oracle Database Utilities.

Import Data Using Oracle Data Pump (Versions 12.2.0.1 and Earlier)

You can import data from Data Pump files into your Autonomous Data Warehouse using Data Pump client versions 12.2.0.1 and earlier by setting the default_credential parameter.

Data Pump Import versions 12.2.0.1 and earlier do not have the credential parameter. If you are using an older version of Data Pump Import you need to define a default credential property for Autonomous Data Warehouse and use the default_credential keyword in the dumpfile parameter.

Importing with Older Oracle Data Pump Versions and Setting default_credential

  1. Store your Cloud Object Storage credential using DBMS_CLOUD.CREATE_CREDENTIAL. For example:
    BEGIN
      DBMS_CLOUD.CREATE_CREDENTIAL(
        credential_name => 'DEF_CRED_NAME',
        username => 'adwc_user@example.com',
        password => 'password'
      );
    END;
    /

    For more information on the credentials for different Cloud Object Storage services, see CREATE_CREDENTIAL Procedure.

  2. Set the credential as the default credential for your Autonomous Data Warehouse, as the ADMIN user. For example:
    alter database property set default_credential = 'ADMIN.DEF_CRED_NAME'
  3. Run Data Pump Import with the dumpfile parameter set to the list of file URLs on your Cloud Object Storage, and set the default_credential keyword. For example:
    impdp admin/password@ADWC1_high \      
         directory=data_pump_dir \
         dumpfile=default_credential:https://objectstorage.us-ashburn-1.oraclecloud.com/n/adwc/b/adwc_user/o/export%u.dmp \
         parallel=16 \      
         partition_options=merge \ 
         transform=segment_attributes:n \      
         exclude=index,cluster,indextype,materialized_view,materialized_view_log,materialized_zonemap,db_link
    

    For the best import performance use the HIGH database service for your import connection and set the PARALLEL parameter to the number of CPUs in your Autonomous Data Warehouse as shown in the example.

    For information on which database service name to connect to run Data Pump Import, see Managing Concurrency and Priorities on Autonomous Data Warehouse.

    For the dump file URL format for different Cloud Object Storage services, see DBMS_CLOUD Package File URI Formats.

    This example shows the recommended parameters for importing into your Autonomous Data Warehouse.

    In this example:

    • Partitioned tables are converted into non-partitioned tables.

    • Storage attributes for tables are ignored.

    • Indexes, clusters, indextypes, materialized views, materialized view logs, and zone maps are excluded during Data Pump Import.

Note:

To perform a full import or to import objects that are owned by other users, you need the DATAPUMP_CLOUD_IMP role.

For information on disallowed objects in Autonomous Data Warehouse, see Restrictions for SQL Commands.

For detailed information on Oracle Data Pump Import parameters see Oracle Database Utilities.

Access Log Files for Data Pump Import

The log files for Data Pump Import operations are stored in the directory you specify with the data pump impdp directory parameter.

To access the log file you need to move the log file to your Cloud Object Storage using the procedure DBMS_CLOUD.PUT_OBJECT. For example, the following PL/SQL block moves the file import.log to your Cloud Object Storage:

BEGIN
  DBMS_CLOUD.PUT_OBJECT(
    credential_name => 'DEF_CRED_NAME',
    object_uri => 'https://objectstorage.us-ashburn-1.oraclecloud.com/n/adwc/b/adwc_user/o/import.log',
    directory_name  => 'DATA_PUMP_DIR',
    file_name => 'import.log');
END;
/

For more information, see Summary of DBMS_CLOUD Subprograms.