3.1.1.1 Import Data

Import data into the database by using Object Storage (for Cloud).

If using a cloud account, one of the methods of importing the data is through Object Storage. Upload the data set to an Object Storage. The Object Storage URI will be used in another procedure.You can load data into your Oracle Autonomous Database (Autonomous Data Warehouse [ADW] or Autonomous Transaction Processing [ATP]) using Oracle Database tools, and Oracle and 3rd party data integration tools. You can load data:
  • from local files in your client computer, or
  • from files stored in a cloud-based object store

Follow the steps to upload your data file to the Object Storage bucket.

  1. Login to your cloud account.
  2. Click the left-side hamburger menu and select Storage from the menu.
  3. Select Buckets from the Object Storage & Archive Storage option.
  4. Select the compartment in which you want to upload the data.
  5. Click Create Bucket.
  6. Enter a name for your bucket. For example, Bucket1. Leave the rest of the fields as default.
  7. Click Create.
  8. Click on the bucket that you created. Scroll down and click Upload under Objects.
  9. Leave the Object Name Prefix field black. Click select files to navigate to the data file that you want to upload or drag and drop the data file. In this use case, select the modified .csv file.
  10. Click Upload. The data file appears under Objects.
  11. Click the ellipses on the right side of the data file to view the menu. Click View Object Details.
  12. Copy the URL PATH (URI) to a text file. This URI is used in the DBMS_CLOUD.COPY_DATA procedure.

This procedure creates an object storage containing the data file in your cloud account.

Create Auth Token

The Auth Token is required in the DBMS_CLOUD.CREATE_CREDENTIAL procedure. You can generate the Auth Token in your cloud account.

  1. Login into your ADW Cloud account.
  2. Hover your mouse cursor over the human figure icon at the top right of the console and click User Settings from the drop-down menu.
  3. Click Auth Tokens under Resources on the left of the console.
  4. Click Generate Token. A pop-up dialog appears.
  5. Enter a description (optional).
  6. Click Generate Token.
  7. Copy the generated token to a text file. The token does not appear again.
  8. Click Close.

Create Object Storage Credential

The object storage credential is used in the DBMS_CLOUD.COPY_DATA procedure.

  1. Login to the OML Notebooks page and create a notebook. See Create a Notebook Classic
  2. Open the notebook that you just created.
  3. Enter the following query to create an object storage credentials:
    %script
    begin
      DBMS_CLOUD.create_credential (
        credential_name => 'CRED',
        username => '<your cloud account username>',
        password => '<your Auth Token>'
      );
    end;
    /
    ---------------------------  PL/SQL procedure successfully completed.
        ---------------------------

    Examine the query:

    • credential_name: The name of the credential to be stored. Provide any name. Here, CRED is the name given.
    • username: This is your cloud account username.
    • password: Enter your Auth Token password that you copied after generating the Auth Token.
  4. Click the play icon to run the query in your notebook. Your credentials are stored in the ADW user schema.
  5. In another para, run the following query to check the user credentials:
    SELECT* FROM USER_CREDENTIALS;