Wednesday, September 30, 2020

OCI Cloud shell: Connect ADW database

8:44 AM Posted by Dilli Raj Maharjan No comments

 


OCI Cloud Shell Overview.

OCI Cloud Shell is a  browser-based terminal accessible from the Oracle Cloud Console. It is free to use and provides access to a Linux shell. Oracle announced Oracle Cloud shell on Feburary 11, 2020. It contains a pre-authenticated OCI command line interface and a lot of other useful tools to perform OCI cloud related tasks. Cloud shell is a feature available to all OCI users that is accessible from the OCI console. It appears in the persistent frame of the console and will stay active while navigating to different pages of the console.

Cloud shell provides an ephemeral machine, that lasts for a short time. It acts as a host for a Linux shell with pre-configured latest version of the OCI command line interface and a number of useful tools. Cloud shell provides 5 GB of storage for our home directory and all the files will be saved during reboot of cloud shell. The storage for Cloud Shell VM's home directory remains persistent from session to session. The administrator of Cloud will receive notification that the storage will be removed in 60 days if the Cloud Shell is not used for 6-months. 

The resource name for Cloud Shell is `cloud-shell`. IAM Policy required to access cloud shell will be something like below

allow group <group name> to use cloud-shell in tenancy

For more details about cloud shell Please visit link below.

https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/cloudshellintro.htm

https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/cloudshellgettingstarted.htm

https://blogs.oracle.com/cloud-infrastructure/announcing-oracle-cloud-shell


Accessing Cloud Shell in the Oracle Cloud Console.

On the top right corner of the console you will get the icon for OCI cloud shell. Click on it to access OCI Cloud Shell.



At the bottom of the OCI cloud console page, a new persistent frame will be available. If you are using cloud shell for the first time it will take few minutes to start. 



From the second time it will be quicker to load cloud shell. It is just provisioning VM and attaching and mounting the storage to home dir.



Once Oracle Cloud shell is connected it looks something like below.



Available buttons in Cloud Shell.



I read the redhat-release file and noticed operating system is RHEL 7.8



Checked disk details with df command and found home is 5 GB in size.



Checked location of utilities.



Following utilities are available with Cloud shell.

  1. Git
  2. Java
  3. Python (2 and 3)
  4. SQL Plus
  5. kubectl
  6. helm
  7. maven
  8. gradle
  9. terraform
  10. ansible

Create Autonomous Data Warehouse Database.

Open Oracle Cloud Console. Click on Create an ADW database on Quick Actions page.



Provide the name of Autonomous Database.



Scroll down and provide Admin user password. Click on Create Autonomous Database.



We can noticed that ADW is in PROVISIONING state.

Once provisioning is completed, status will be changed to available. Click on DB Connection button.



Click on Download Wallet button.



Provide the wallet login password and click on Download.




Create Object Storage to temporarily upload wallet and download to OCI cloud shell.

Click on Navigation menu. Click on Object Storage and click on Object Storage.



Click on Create Bucket.



Provide the name of Bucket.



Click on Create Bucket button to create bucket.



Upload Wallet file to the bucket.



Click on three vertical dots at the right and click on Create Pre-Authenticated Request.



Provide the name of the Pre-Authenticated Request and click on Create Pre-Authenticated Request button.



Copy PRE-Authenticated request URL



Go to Cloud Shell and download the wallet with wget command.
 


It looks something like below once wallet is downloaded completely.



Create directory to store wallet files. Move wallet files to the directory and extract it.
mkdir -p network/admin
mv Wallet_cstest.zip network/admin
cd network/admin
unzip Wallet_cstest.zip 



Open sqlnet.ora file and modify the Directory value to the directory location where wallet files are located.



Connect to ADW database using sqlplus <username>@<tnsnames>.