Best Practices from Oracle Development's A‑Team

  • May 14, 2015

Getting Started with Oracle Database Cloud Service – Virtual Image - Creating a database

Roland Koenn
Consulting Solution Architect


The Oracle Database Cloud Service - Virtual Image option gives great flexibility on how to deploy databases in the Oracle Cloud. It allows customization options in almost all aspects of the database (e.g. file system layout, memory management, etc.). This makes this option very beneficial - for example - in highly customized database deployments that are being migrated to the cloud.  Please note when using the Oracle Database Cloud Service – Virtual Image option: All subsequent maintenance operations, including backup, patching and upgrades, are performed by you. This way all instances can be integrated in your existing maintenance schedule for already existing On Premise databases.

Only when the Oracle Database Cloud Service - Database as a Service option is selected, a database instance is created based as part of the provisioning. It comes with automatic backup and point-in-time recovery options plus patching and upgrades, however offers less flexibility, e.g. for the layout of data files. Please review this document to find the right option for your requirements.

This example will show you how to create a database after the Virtual instance has been provisioned as described in this document.


Create Storage Volumes

Login to your Database Cloud Services Console - Home Page and navigate to the Instance Detail page of your instance by clicking on the name - 'dbaas-demo-vi1' in this example. On the details page: Locate the Node where the database is supposed to be created and select the "Scale Out" option from the context menu as shown is the picture below.



Select the required size - in this example 30 GB have been chosen which gives plenty of space for patches etc. The disk automatically gets attached to the instance, once "Yes, Scale Up Service" has been clicked.


After pressing the "Yes, Scale Up Service" the instance goes into Maintenance Mode and is restarted.


Once the instance is restarted - navigate to the Compute Cloud Services Console and click on the storage section to review the created storage volume. The overview page will show the newly attached volume. It is attached to the instance as the next available slot: In this example this is /dev/xvdc. The first disk - /dev/xvdb - holds the base operating system etc.



Login to the VM using the opc user – described here– issuing fdisk -l will reveal the newly attached volume /dev/xvdc.


In order to use the disk, a partition has to be created. This can be achieved by running fdisk /dev/xvdc – further details on this topic can be found in the Oracle Linux Administrator Guide.


The next step is to create a file system on the new volume – optionally logical volumes can also be created. For this example ext4 is chosen, which can be seen as a default in the Oracle Cloud. It is recommended to use a label for the volume – this can be done with the “-L” flag of mkfs.ext4 – this ensures that if the order of the disks attached to the VM changes the volume stays mounted to the right mount point.


After the partition is created a mount point /u01 needs to be created to mount the binaries for the database home. To enable this mount point across reboots the mount information should be recorded in the /etc/fstab. After mounting the file system on /u01 make sure to change the ownership to the user oracle with the group oinstall.


Every Virtual Image instance comes with the database binaries pre-deployed in a tar.gz archive. To extract it: Switch to the user oracle and extract it in the directory /u01. It should be extracted using the p flag to ensure the proper ownership of the files in the archive after extraction.


After the extraction is complete two scripts have to be run by opc with the sudo option or root. These scripts set permissions on the oraInventory and adds certain files outside the Oracle Base, like the /etc/oratab file.


At this stage additional storage should be added and mounted using the process described here to satisfy the database storage requirements. To create databases with the Virtual Image option - the Database Configuration Assistance (dbca) is used - using the same process as for on premise databases.

dbca can be used in the command line as shown in this image:


Alternatively the GUI version can be used, once X11 Forwarding is configured correctly. In order to enable the forwarding simply add the lines to the sshd_config as shown and restart the ssh daemon.


Starting a local XServer and logging into the Instance using oracle allows the start of dbca with the GUI being display on the local screen. The process of creating a database is identical to creating a database on premise.



Further Reading

Creating a Database on a Virtual Image Service Instance


Oracle Linux Chapter 18 Storage Management


Oracle Database Cloud Service Documentation


Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha