8i | 9i | 10g | 11g | 12c | 13c | 18c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux

Home » Articles » Vm » Here

Oracle Cloud Infrastructure (OCI) : Create a Database VM

This article shows how to create a database virtual machine under Oracle Cloud Infrastructure (OCI).

Related articles.

Assumptions

This article assumes you've already defined a Virtual Cloud Network (VCN) in the same compartment as the database VM you are about to create. You can see how to do that here.

This article describes the creation of a database VM on Oracle Cloud Infrastructure, similar to the Database Cloud Service on the "Classic" Oracle Public Cloud. This is not one of the autonomous database services. If that's what you want, links are provided above.

Create SSH Key

Before you start, you are going to need a key pair for authentication to your service.

$ ssh-keygen -b 2048 -t rsa -f myOracleCloudKey
$ chmod 600 myOracleCloudKey*

Enter and confirm the passphrase when prompted. You will be asked to upload the public key during the service creation.

If you have any problems, or need instructions for using PuTTYgen on Windows, check out the documentation here.

Create a Database VM (DBaaS)

Log into the Oracle Cloud and navigate to the Oracle Cloud Infrastructure (OCI) console.

Oracle Cloud Infrastructure Console

Use the top-left menu to select the "Bare Metal, VM and Exadata" option.

Bare Metal, VM and Exadata Menu

Select the compartment and click on the "Lauch DB System" button.

Bare Metal, VM and Exadata Dashboard

The popup allows you to enter all the details about the service you want to provision, including the system, networking and database details. You will need to upload your public key for operating system access, and remember to select the Virtual Cloud Network and associated subnet you created previously. All other settings should be self explanatory. When you are ready, click the "Launch DB System" button.

Database VM Creation

Wait for the service to be provisioned.

Database VM Provisioning

Once the service is provisioned, click on the service name to drill down into the detail screen.

Database VM Provisioned

The detail screen is shown below.

Database VM Detail

Connecting to the VM using SSH

Connect to the "opc" operating system user by specifying your private key and the public IP address from your DB Systems page.

$ ssh -i ./myOracleCloudKey opc@123.123.123.123

[opc@obtest1 ~]$

Once connected, you can switch to the "oracle" OS user and do all the usual stuff.

[opc@obtest1 ~]$ sudo su - oracle
[oracle@obtest1 ~]$ sqlplus / as sysdba
[oracle@obtest1 ~]$ . oraenv
ORACLE_SID = [oracle] ? cdb1
The Oracle base has been set to /u01/app/oracle
[oracle@obtest1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 18.0.0.0.0 - Production on Mon Sep 24 20:52:48 2018
Version 18.2.0.0.0

Copyright (c) 1982, 2018, Oracle.  All rights reserved.


Connected to:
Oracle Database 18c EE High Perf Release 18.0.0.0.0 - Production
Version 18.2.0.0.0

SQL> ALTER SESSION SET CONTAINER = pdb1;

Session altered.

SQL> CREATE USER test IDENTIFIED BY TesT123456##;

User created.

SQL> GRANT CREATE SESSION TO test;

Grant succeeded.

SQL>

If you need to perform any tasks as root, you must connect to the "opc" user and run them using "sudo".

$ ssh -i ./myOracleCloudKey opc@123.123.123.123
-bash-4.1$ sudo vi /etc/hosts

For more information see:

Hope this helps. Regards Tim...

Back to the Top.