Playing with new Oracle Database 21c in your VirtualBox

Last week Oracle released the newest Oracle Database 21c. This is an Innovation release (not long term like 19c) that introduces many cool new features, including also the 20c new features which DB release didn't happen:

Oracle is mindful of the unprecedented economic and business disruption our customers faced in 2020. We decided to not promote our Database 20c Preview version to General Availability. Instead, we incorporated all of the 20c functionality into the 21c release and made 21c available in our Autonomous Database Free Tier so that all can test drive the new features and enhancements for free.

Now that we have an Always Free tenancy option, our lab environments became OCI itself. Usually there is no reason for us to create databases under Virtualbox anymore as we can have them for free in the Oracle Cloud, without consuming our notebooks CPU, memory and storage.

However, as sometimes we want to be disconnected from the outer world during our lab tests (or maybe to give a live demo session without requiring internet), in this post I will show how you can deploy 21c in your VirtualBox environment for testing and lab purposes.

Note this article is being written on 12/Dec/2020 while there is no official way for doing that yet.

Getting Started

My strategy will be creating a Gold Image from the DBaaS 21c and import this Gold Image on my VirtualBox.

So for this lab, I've created a VBox VM compute with the following specs:

  • 1 CPU
  • 8 GB Ram
  • Oracle Linux 7.9

(Just like a VM.Standard.E2.1)

Let's start. First deploy a DBaaS 21c in you OCI using your always free tenancy. I won't go in the details how to do that, you can find over the internet.

After it's created, connect with SSH and let's try to create a Gold Image using runInstaller:

[opc@cloud ~]$ sudo su - oracle
[oracle@cloud dbhome_1]$ $ORACLE_HOME/runInstaller -createGoldImage -destinationLocation /u01/app/oracle/ -silent
Launching Oracle Database Setup Wizard...

[WARNING] [INS-35952] The installer has detected that the Oracle Database home software at (/u01/app/oracle/product/21.0.0.0/dbhome_1) is not complete.
   CAUSE: Following files are missing:
[/u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/Data_Warehouse.dbc, /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/General_Purpose.dbc, /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/New_Database.dbt, /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/Seed_Database.ctl, /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/Seed_Database.dfb]
   ACTION: Ensure that the Oracle Database home at (/u01/app/oracle/product/21.0.0.0/dbhome_1) includes the files listed above.

It complains that the following files are missing:

  • /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/Data_Warehouse.dbc
  • /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/General_Purpose.dbc
  • /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/New_Database.dbt
  • /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/Seed_Database.ctl
  • /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/Seed_Database.dfb

It makes sense. Oracle removed those files during the deployment to save space with unnecessary things as this is a DBaaS. The only one used in the DBaaS is the seed_db.dbc. So in this case, I will just create empty files to bypass this check.

touch /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/Data_Warehouse.dbc
touch /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/General_Purpose.dbc
touch /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/New_Database.dbt
touch /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/Seed_Database.ctl
touch /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/Seed_Database.dfb

And trying again:

[oracle@cloud dbhome_1]$ $ORACLE_HOME/runInstaller -createGoldImage -destinationLocation /u01/app/oracle/ -silent
Launching Oracle Database Setup Wizard...

Successfully Setup Software.
Gold Image location: /u01/app/oracle//db_home_2020-12-12_12-24-53PM.zip
[oracle@cloud ~]$ ls -lah /u01/app/oracle//db_home_2020-12-12_12-24-53PM.zip
-rw-r--r-- 1 oracle oinstall 3.4G Dec 12 12:35 /u01/app/oracle//db_home_2020-12-12_12-24-53PM.zip

Cool. Now I have my Gold Image on /u01/app/oracle//db_home_2020-12-12_12-24-53PM.zip

PS: There is the -exclFiles parameter on the runInstaller but I couldn't make it work, that's why I did the "touch" way =]

Now I will connect on my VirtualBox compute, move this image and install 21c pre-reqs package:

[root@lab21c ~]# yum -y install oracle-database-preinstall-19c.x86_64
...
Installed:
  oracle-database-preinstall-19c.x86_64 0:1.0-2.el7
...
Complete!
[root@lab21c ~]# mkdir -p /u01/app/oracle/product/21.0.0.0/dbhome_1
[root@lab21c ~]# mkdir /u01/app/oraInventory
[root@lab21c ~]# chown -R oracle: /u01/app/*

Now as oracle:

[root@lab21c ~]# sudo su - oracle
[oracle@lab21c ~]$ scp oracle@dbaas21c:/u01/app/oracle//db_home_2020-12-12_12-24-53PM.zip /u01/app/oracle/
db_home_2020-12-12_12-24-53PM.zip             100% 3440MB  45.1MB/s   01:16
[oracle@lab21c ~]$ unzip -q -d /u01/app/oracle/product/21.0.0.0/dbhome_1 /u01/app/oracle/db_home_2020-12-12_12-24-53PM.zip
[oracle@lab21c ~]$ export ORACLE_HOME=/u01/app/oracle/product/21.0.0.0/dbhome_1
[oracle@lab21c ~]$ export PATH=$PATH:$ORACLE_HOME/bin
[oracle@lab21c ~]$ sqlplus /nolog

SQL*Plus: Release 21.0.0.0.0 - Production on Sat Dec 12 13:00:27 2020
Version 21.1.0.0.0

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

SQL>

Even though it's working, let's use the runInstaller to fully deploy this database installation.

First I will create a response file with the following lines:

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v21.0.0
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
ORACLE_HOME=/u01/app/oracle/product/21.0.0.0/dbhome_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oper
oracle.install.db.OSBACKUPDBA_GROUP=backupdba
oracle.install.db.OSDGDBA_GROUP=dgdba
oracle.install.db.OSKMDBA_GROUP=kmdba
oracle.install.db.OSRACDBA_GROUP=racdba

And now calling runInstaller:

[oracle@lab21c ~]$ $ORACLE_HOME/runInstaller -responseFile /home/oracle/db_install_lab.rsp -silent
Launching Oracle Database Setup Wizard...

The response file for this session can be found at:
 /u01/app/oracle/product/21.0.0.0/dbhome_1/install/response/db_2020-12-13_12-21-31PM.rsp

You can find the log of this install session at:
 /tmp/InstallActions2020-12-13_12-21-31PM/installActions2020-12-13_12-21-31PM.log

As a root user, execute the following script(s):
        1. /u01/app/oraInventory/orainstRoot.sh
        2. /u01/app/oracle/product/21.0.0.0/dbhome_1/root.sh

Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes:
[lab21c]
Execute /u01/app/oracle/product/21.0.0.0/dbhome_1/root.sh on the following nodes:
[lab21c]


Successfully Setup Software.
Moved the install session logs to:
 /u01/app/oraInventory/logs/InstallActions2020-12-13_12-21-31PM

And finally as root:

[root@lab21c ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@lab21c ~]# /u01/app/oracle/product/21.0.0.0/dbhome_1/root.sh
Check /u01/app/oracle/product/21.0.0.0/dbhome_1/install/root_lab21c_2020-12-13_12-24-58-437409529.log for the output of root script
[root@lab21c ~]#

Now I will remove on my VM the empty templates I've created just for the Gold Image feature to work:

rm /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/Data_Warehouse.dbc
rm /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/General_Purpose.dbc
rm /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/New_Database.dbt
rm /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/Seed_Database.ctl
rm /u01/app/oracle/product/21.0.0.0/dbhome_1/assistants/dbca/templates/Seed_Database.dfb

Good. We have the binaries deployed. What about the database?

I will talk about this in the next article: How to create your 21c Oracle Database.

Have you enjoyed? Please leave a comment or give a 👍!

4 comments

Skip to comment form

    • prashant k on January 31, 2021 at 00:36
    • Reply

    I tried with same technique on Amazon ec2 Oracle Linix 7.9 unfortunately did not work.

    • Kevin on February 17, 2021 at 19:11
    • Reply

    Hello Jorge,

    First of all, huge thanks for the guide! However, I am having some issues after running runInstaller. I followed the exact same process (except that I got the Oracle 21c Gold image from Bare Metal, VM and Exadata instead of Always Free version of Oracle 21c) and I get the following message with a warning:

    [oracle@oracle21c ~]$ $ORACLE_HOME/runInstaller -responseFile /home/oracle/db_install_lab.rsp -silent
    Launching Oracle Database Setup Wizard...

    [WARNING] [INS-13014] Target environment does not meet some optional requirements.
    CAUSE: Some of the optional prerequisites are not met. See logs for details. installActions2021-02-17_08-35-30AM.log
    ACTION: Identify the list of failed prerequisite checks from the log: installActions2021-02-17_08-35-30AM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
    The response file for this session can be found at:
    /u01/app/oracle/product/21.0.0.0/dbhome_1/install/response/db_2021-02-17_08-35-30AM.rsp

    ... (rest are the same as guide)

    Successfully Setup Software with warning(s).
    Moved the install session logs to:
    /u01/app/oraInventory/logs/InstallActions2021-02-17_08-35-30AM

    Am I supposed to not see any error message as your guide?

    Thank you!

    1. Hi Kevin. The message you've received is just a Warning, so you can continue. Maybe your instance is missing some pre-reqs. Check the log files for further details about this warning. Sometimes it's related with the allocated memory, swap, disk, etc..

    • Renan Medeiros on January 19, 2023 at 21:38
    • Reply

    I built a RAC in virtual box environment composed of a NAS server (emulator) and two nodes. I didn't use an image. I installed Grid and Database. Today I applied patch 21.9

Leave a Reply

Your email address will not be published.