This post covers How To Create Database on Oracle’s Gen2 Cloud (OCI) on VM Database.
Note: There are different types of DB systems in the Oracle Cloud To know more about Oracle Cloud Database Options (VMDB, BMDB, ExaCS, ExaCS & Autonomous (ADW, ATP), Check here
Database Deployment
In Oracle Cloud, there are two deployment models in User-Managed Database i.e., Public Subnet or Private Subnet where Subnet is a part of VCN
Note: To know more about VCN, Subnet, Firewall (Security List), IGW, DRG & how to create it, check here
1) Database Deployed Inside Private Subnet
Database Host on a private subnet listen on a Private IP, We recommend the Deploying database on a private subnet & you will be able to access the database within the Virtual Cloud Network. You can access it from the on-premises network via DRG (Dynamic Routing Gateway) using either FastConnect or IPSec VPN
2) Database Deployed Inside Public Subnet
A database running on Public Subnet will get both Private IP & Public IP, you will be able to access it via Public IP & Internet Gateway is required for connectivity.
We only recommend creating a database on the public subnet only when you are using this database for testing purposes or if you want to expose your database to the internet.
How to Create Database on Oracle Cloud
1) Register & Log into the Oracle Cloud account, cloud.oracle.com
Note: First, you should have an Account at Oracle Cloud and if you don’t have one, then you can register FREE using my step-by-step video & guide that I covered in episode 30. You can get it by visiting k21academy.com/30.
2) Configure Network: Next, as we want to access the database over the internet, so we’ll create it in the Public Subnet and assign Public IP in addition to configuring Internet Gateway on VCN.
Note: If you are not familiar with VCN, Subnet or Internet Gateway then learn about them in one of my previous episodes on networking at http://k21academy.com/1z093215. Trust me, it is easy and should not take more than 15-20 minutes. If you hit an issue, leave a comment and either I or someone from my team will help you.
3) Generate SSH Keys: Once you are done with creating VCN & Public Subnet, then you also need one more thing i.e. SSH Keys Pair that you generate using Puttygen, so that you can access the Autonomous Linux using SSH private key.
Note: If you are new to SSH Keys or don’t have one, then create them using the step-by-step guide that we use in our Oracle Cloud Training. Check at https://k21academy.com/oci51.
4) Sign In: Once you have all the things sorted, sign in to Oracle Cloud Account, and you will land on the OCI Console.
5) Create Database Instance: Click on the hamburger menu on the top left side, select Bare metal, VM & Exadata & then Click on Create DB System.
6) First, select the Compartment in which you want to create the Database. A Compartment is a logical collection of your OCI Cloud resources or any OCI resource that you create like a Database, Linux machine, LoadBalancer, etc.
On that Compartment, you can create IAM policy and then apply that policy on to a group and give appropriate access to the group whether it is read-only, read/write or read/write/destroy access, By giving the access to the group, users attached to that group will also get same access as group.
Note: If you want to know more about the Compartments and Policy, check our previous post here
7) Enter the name of DB System, Then choose Availability Domain inside which you want to create the Instance, If you want higher CPU & higher memory, then click on “Change Shape“.
Note: Want to know more about Region & Availability Domain in OCI, then click HERE.
8) Under “Add Public SSH key”, Copy the content of SSH Public key.
Note: If you are new to SSH Keys or don’t have one, then create them using the step-by-step guide that we use in our Oracle Cloud Training. Check at https://k21academy.com/oci51.
9) Select the VCN & Public Subnet, then click on Next
10) Enter the DB Name, & select the Database version. Create the SYS admin password (make sure you remember the password)
Note: The password must be nine to thirty characters and contain at least two uppercase, two lowercase, two numeric, and two special characters. The special characters must be _, #, or –
11) When the database creation is complete, the status changes from Provisioning to Available
Note: It will take 50-60 minutes to make your instance up & Running
How To Connect
1) In order to connect to Database Host deployed in Oracle Gen2 Cloud (OCI), you need to open port 22, which is SSH port and you will be able to connect to your database Instance and In case you want to connect to database listener port you have to open port 1521, so that your application will be able to talk to the database or other services over internet.
Note: When you create VCN using default options various resources are by default created by Oracle (Security List, IGW, Route Table).
To know how to create a security list and open port in Oracle Gen2 Cloud check here
2) To connect to the Instance you will need the Public IP of the Instance & the PuTTY Software.
Note: To know how to get the Public IP of the Database, check here
Enter the Public IP Address in the Hostname, then add the SSH Private key (That we created before) under SSH & then Auth. Click on “Open”
Troubleshooting
So that’s all how you can create and provision Database on OCI. Now, some of you might face issues while connecting the instances.
There could be multiple reasons of Instance Connectivity issues in OCI like:
- Issue 1: In the Security List SSH port 22 (Linux) is not open.
- Issue 2: Internet Gateway (IG) is not configured.
- Issue 3: SSH Public key you generated was not uploaded properly while creating the instance (or you are not using Private Key Properly in Putty).
- Issue 4: You have forgotten to add the Private key under SSH->Auth
- Issue 5: It could be a typo issue for username
For the Fixes of the above issue, you can check our previous post [Troubleshooting] Compute (Linux/Windows) & Database Instance Connectivity Issue in Oracle Cloud (OCI), Here
Related/Further Readings
- Oracle Cloud: Create VCN, Subnet, Firewall (Security List), IGW, DRG: Step By Step
- Oracle Cloud Database Options (VMDB, BMDB, ExaCS, ExaCS & Autonomous (ADW, ATP)
- How to Get Public IP of Database In Oracle Gen 2 Cloud (OCI)
- [Video] Oracle Autonomous Data Warehouse Cloud Service 18c Now on OCI
- [Troubleshooting] Compute (Linux/Windows) & Database Instance Connectivity Issue in Oracle Cloud (OCI)
How Can I Learn More
We cover all this in detail in our DBA to Oracle Cloud DBA Training program. To Know, what to expect in our training, Register for our FREE Masterclass on “Upgrade From DBA To Oracle Cloud DBA Including Certification & Earn More In 2020″
Leave a Reply