Load Data into Autonomous Database from
Google Cloud Storage
This example shows how to load data from Google Cloud Storage to Autonomous Database.
You have various options to perform data loading into Autonomous Database, such as:
Using UI options: You can use the
Data Studio Load tool user interface to create credentials for the
cloud store location, select files containing data, and run data
load jobs.
All these methods use the
same PL/SQL package DBMS_CLOUD for loading data.
However, Data Studio provides additional benefits over SQL commands.
It not only helps to analyze the source and create table definitions
but also performs validation checks.
You require Google Cloud Platform (GCP)
access credentials for user account authentication and an object URL for accessing
the object in Google Cloud Storage bucket.
To load data from a Google Cloud Storage
bucket:
Create credentials for GCP user account in the Autonomous Database.
Copy data from the Google Cloud Storage bucket to the database.
Prepare for Loading Data from Google Cloud Storage 🔗
Verify the prerequisites and prepare for loading data from Google Cloud Storage.
Prerequisites
A data file, for example, gcp-data.txt exists in the Google Cloud Storage bucket that you can import. The
sample file in this example has the following
contents:
1,GCP Direct Sales
2,GCP Tele Sales
3,GCP Catalog
4,GCP Internet
5,GCP Partners
On the Google side, log in to your Google Cloud Platform (GCP) account and do the following:
Steps for Loading Data from Google Cloud Storage 🔗
Run these steps to load data from Google Cloud Storage to Autonomous Database.
Store the Google Cloud Platform (GCP) access
credentials in your Autonomous Database and specify a credential name. This enables the database to
authenticate with your GCP user account and access the items in the Google Cloud Storage bucket.
SET DEFINE OFF
BEGIN
DBMS_CLOUD.CREATE_CREDENTIAL(
credential_name => 'GOOGLE_CRED_NAME',
username => 'username',
password => 'password'
);
END;
/
Note
Here, the
username is your Google account access key and the
password is your access key secret.
You have successfully imported data from Google Cloud Storage to your Autonomous Database. You can run this statement and verify the data in your
table.
SELECT * FROM mygoogletable;
ID NAME
-- –-------------
1 GCP Direct Sales
2 GCP Tele Sales
3 GCP Catalog
4 GCP Internet
5 GCP Partners