You may already have one or two free autonomous databases at OCI. Why then would you want a lower tier database offering, a database that is not autonomous?
It turns out there are many reasons why you may want this.
- FIle system access
There are many things you can do with a database that requires file system / operating system access . You may want the full access to look at performance, pull out a trace file configure misc file oriented things. Or maybe your are just more comfortable with a classic Oracle database.
- It is cheaper
You cannot beat free, right? No, it is not cheaper to set it up than a free autonomous database. But if you need more capacity than free can offer or you hvar usedup your two autonomous databases.
- You will migrate an existing application
It is possible to go directly to ATP, but often it is a two step move. You move to a database as identical to your on-prem installation as possible and once you are satisfied with that in the cloud you look at moving it to autonomous.
No matter what your reason is, setting it up is pretty easy. One thing before you start though, you canot stop it to stop spending money. You have to then terminate the service and later recreate it if you want it back.
As this blog post assumes you will want to be able to reach the database from outside OCI, you need to place it in a public subnet. Either ay, you need a VCN set up before you can create a database.
In case you don’t have a Virtual Cloud Network setup in OCI, you will want to create one. Same if you have one but it has no subnet, then you need to add a public subnet to it or add a new VCN that has a public subnet.
In the hamburger menu / navigation menu at OCI select Networking and then “Virtual Cloud Networks”. This leads to the VCN page where you can see the VCNs you have if any. To create a new VCN, click on the “Create VCN” button.
Give your VCN a name and enter an IPv4 CIDR block, for example 10.0.0.0/16. If you don’t know what that means, don’t worry it is just a block of IPs to allocate to the VCN. You can leave the rest of the options as they are and just clock “Create VCN”.
The next step is to set up a subnet. Let’s do that by clicking “Create subnet”.
Give it a name like “public” and enter a IPv4 CIDR like 10.0.0.0/24. Make sure “Public Subnet” is selected in “subnet access”.
Create Internet Gateway
With the VCN created you need to add an Internet Gateway. On the left side under resources click on “Internet Gateways”. This takes you to the list of such, there will be no gateways right now. Click on “Create Internet Gateway”.
Give it a name and click “Create Internet Gateway”.
Add route table entry
Now we need to add a route so the VCN can access the Internet Gateway.
- Click on “Route Tables” in the resources on the left side. Next Click on “Default Rout Table for <VCN-name>”. Click “Add Route Rules”.
- Select “Internet Gateway” as target type.
- Enter “0.0.0.0/0” as Destination CIDR block. That results in all IPs the VCN can address.
- Select the only gateway you have as target internet gateway, it is the one you just created.
- Click “Add Route Rules”.
That should be enough, you are ready to create a database that can be reached from outside of OCI (like your own PC).
In the navigation menu / hamburger menu you’ll click on “Oracle Database”. This leads to misc options for autonomous databases, efter those you find “Oracle Base Database”. That leads to a list of already created ones if you have any. Probably not as you are reading a blog post about creating one. So click “Create DB System”.
Giveit a more descriptive name than the default. Select an availability domain. You can change shape and storage if you want. CHange settings in configure DB settings if you want.
For SSH keys if you leave it as generate new ones will be created and if so download before you continue.
For license type chose license included unless you have available licenses that covers the database you’re creating.
In network settings select the VCN and subnet you just created. Enter a hostname prefix to make the database/server easy to identify from the hostname.
Here is how it looks with the choices I made.
Click next when you’ve made the changes you want/need.
Change the databasename to something descriptive. Select the version you want. As of this writing 19c is the current long term release. Thus, you want 19c for most things and you can opt for 21c for development and learning new things. This will of course change in the future when 23c is GA.
Enter a password that will be used for the SYS account.
Configure your backups, the defaults are probably a good start.
Here is how it looks with my selections.
With your modifications done, you are ready to create the database. Click “Create DB System” to start the creation.
The provisioning starts and with the single core I provisioned it took just over an hour to complete.
You now have a database and can connect into it.
Start with changing the privileges on your downloaded keys.
chmod 600 Download/ssh-key-2023-11-06.key*
You always connect in with the user “opc” and then you switch to oracle or other more privileged user.
On your provisioned database on the bottom left there are resources, clock on nodes and find the public IP.
sudo su - oracle sql / as sysdba
And you are logged into the database just as you are used to.
Yes, for the dinosaurs out there, you can also use sqlplus. Both sql and sqlplus are configured for you. But you know you really should join the revolution and start using a modern CLI.