How to Upload Large Files to Oracle Object Storage with OCI CLI
Blog
  • Topics
  • Industries
  • Partners

Explore

Topics

Industries

Partners

How to Upload Large Files to Oracle Object Storage with OCI CLI

This post is in a series of blog posts on migrating schemas from an Oracle DB (Cloud DBaaS) to Autonomous Data Warehouse (ADW). This post is focused on uploading the large Data Dump files from the DBaaS compute machine onto Cloud Object Storage.

Quick links to other posts in this series:

Summary Blog Post

  1. Export Data into Dump Files
    1. Option 1: Export DB Schemas Using SQL Developer
    2. Option 2: Export DB Schemas Using Data Pump Command
  2. Transfer Data Dump Files over to Oracle Cloud Object Storage
    1. Option 1: Swift REST Interface to Upload Files to Oracle Object Storage
    2. Option 2: OCI CLI Utility to Upload Files to Oracle Object Storage (this post)
  3. Import Data Dump Files into ADW Using SQL Developer

The other approach I explain in the other post uses the Swift REST curl command. This post looks at using the OCI CLI utility which allows for non-scripted easy adjustment to how the file transfer happens from a local machine to the Oracle Cloud Object Store. Following are the steps to set up OCI CLI:

1. Create a Bucket on Oracle Object Storage

This bucket belongs to a compartment and serves to hold the files that will be uploaded to Object Storage. When uploading the DB DMP files later on, you will specify the Namespace and Bucket name for the Object Storage to upload into. So take note of these to use them later.

2. Install and Configure the OCI CLI Utility

It is best to install OCI CLI (Command Line Interface) on the machine that hosts the exported DB DMP files.

Note that if you exported from an Oracle Cloud DB, you can either install OCI CLI on the DB Cloud Compute or download the exported DMP files from the Oracle DB Cloud Compute to your local machine (using an FTP tool like WinSCP) and install OCI CLI on your local machine.

You don’t download CLI Utility manually, instead follow instructions using the below link and the command will automatically download and install the CLI utility from GitHub. OCI CLI is an Oracle Open Source project.

Install Instructions for OCI CLI Utility: https://docs.cloud.oracle.com/iaas/Content/API/SDKDocs/cliinstall.htm

After running the installation command, make sure to set up the CLI config file as described in the same link above. As part of the same configuration instructions, make sure the PEM Public Key is uploaded to your Oracle Cloud user.

3. Copy files over from local machines to Oracle Object Storage Cloud.

On Windows: Open a Command Line window and run one of the following commands:

  • If the exported DB dump is in a single file, run the following command:

oci os object put -ns <object_storage_namespace> -bn <bucket_name> –file <file_location>

For example, oci os object put -ns idvyzvnx1qqz -bn MazenADWComp –file C:\Users\Mazen4\Desktop\JHSAQCDVTTPZ_01.dmp

The namespace and bucket names are the same ones you noted from the first step.

The upload duration depends on how large the file is and the internet upload speed. Keep the command line window open until the upload command completes. Once the upload is done, the command prompt looks as follows to confirm the upload.
Oci Cli 1

  • If the exported DB dump is a single large file, it may be faster to use the command that breaks it into parts and uploads it with parallelism. This is done automatically using the following command. In the following example, it uses a part size of 100 MB.

oci os object put -ns <object_storage_namespace> -bn <bucket_name> –file <file_location> –part-size 100 –parallel-upload-count 4

For example: oci os object put -ns idvyzvnx1qqz -bn MazenADWComp –file C:\Users\Mazen4\Dropbox\Knowledge Base\ADW\OAC DBaaS Dumps for ADW\ITPASQTSTYLX_01.dmp –part-size 100 –parallel-upload-count 4

  • If the exported DB dump is already broken down into multiple files, run the following command to bulk upload all the dump files by referencing the local folder that contains all the DMP files.

oci os object bulk-upload -ns <object_storage_namespace> -bn <bucket_name> –src-dir <folder location>

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to the Weekly Blog Digest:

Sign Up