Oracle Analytics Cloud — Automate Snapshot Creation and Backup to Object Storage

Rampradeep Pakalapati
2 min readOct 30, 2020

--

This post outlines the process of setting up an automation mechanism to create Snapshots and backing them to Oracle Cloud Infrastructure Object Storage bucket.

For code base please refer to my GitHub repository

Pre-requisites

  • We would be needing an BI Service Administrator access to Oracle Analytics Cloud to create and manage snapshots
  • OCI Config to upload BAR file to Object Storage bucket
  • Linux machine to setup and schedule the job
  • Google Chrome along with supported chromedriver to be installed on Linux machine
  • Python3 and Selenium package

Setting up the code base

1. Chrome Install

My code is based on Chrome browser and I’m using Oracle Linux 7

# Oracle Linux 7
sudo wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
sudo yum -y install redhat-lsb libXScrnSaver
sudo yum -y localinstall google-chrome-stable_current_x86_64.rpm

2. OCI and Selenium Packages for Python

We need to make sure we have the selenium package available.

pip3 install selenium # For Automating Snapshot Creation
pip3 install oci # For uplaod to Object Storage

3. Clone the Git Repo

Clone the repository to your Server/Machine

git clone https://github.com/prampradeep/OACSnapshotAutomation

4. Download chromedriver

Download the chromedriver which is in line with your chrome version. Make sure to place it inside Cloned repository directory.

cd OACSnapshotAutomation
wget https://chromedriver.storage.googleapis.com/85.0.4183.87/chromedriver_linux64.zip
unzip chromedriver_linux64.zip

5. Edit Configuration.py

This is the most important part where we provide all the necessary information. Edit the configuration.py file and add information as needed.

hostname = '< OAC HOST NAME>'
UserName = '<USERNAME>'
Password = '<PASSWORD>'
prefix = '<PREFIX_FOR_FILENAME>'
SnapPassword = '<SNAPSHOT_PASSWORD>'
namespace = '<TENANCY NAMESPACE>'
bucket = '<BUCKET_NAME>'

6. OCI Config

This is needed for uploading Snapshot to Object Storage bucket. make sure to have the config file under $HOME/.oci folder.

Sample Config file:

[DEFAULT]
user= <USER_OCID>
fingerprint= <FINGERPRINT_API_SIGNING_KEY>
key_file= <PATH_TO_PRIVATE_KEY>
tenancy= <TENANCY_OCID>
region= <REGION>

Schedule using the crontab

schedule the CreateSnapshot.py file using crontab on the Linux machine. Refer here for examples of different schedules.

I will be happy to help incase of any issues setting this up, reach out to me at rampradeep.pakalapati@gmail.com

--

--