I am first and foremost a developer. I am not an administrator. I know more about IDEs and GUIs than about command line. I have always been a little scared of system administration and non-wizard (next-next-finish) based installations. I am not proud of it. I have other skills and interests. I know how to drive my car but I cannot do engine maintenance. Something like that. Now Oracle has released Oracle Database 12c. And the only way for me to run it today is to install it on Linux. So I have a big impetus to finally get started. First with the creation of a Virtual Machine (VirtualBox) with Oracle Enterprise Linux inside (I wrote about my baby steps in this article https://technology.amis.nl/2013/06/29/how-to-create-a-virtual-box-vm-with-oracle-enterprise-linux-inside-a-dummy-guide/) and next with the installation of the Oracle Database 12c in that machine.
This article describes how I went from a clean Oracle Enterprise Linux 6.4 environment in a VirtualBox VM to a VM with additional hard disk, volume group and logical volume with the Oracle Database 12c up and running. The steps are:
- add hard disk to VM
- leverage the new disk in the Linux file system (through physical device, file partition, volume group, logical volume, directory with mount of disk)
- make some pre-install preparations
- download the Oracle Database 12c installation archives and extract them
- run the installer and provide the proper configuration details
- perform post-installation activities
- verify access to the database is available
Our objective:
1. import VirtualBox appliance with Oracle Enterprise Linux 6.4
In the article https://technology.amis.nl/2013/06/29/how-to-create-a-virtual-box-vm-with-oracle-enterprise-linux-inside-a-dummy-guide/ I have shown in quite some detail how to set up a Virtual Box VM with Oracle Enterprise Linux 6.4 inside. At the end of this article, I have exported the VM as an Appliance that can be used as the starting point for new VMs.
Here I am using that appliance as the foundation for the Oracle Database 12c installation. So my first step in this article, is the import of that appliance. If you already have a Linux environment at your disposal, you can skip this section as well as the next and go straight to section 4.
Start Virtual Box. From the File menu, choose Import Appliance:
Find the .ova file for the appliance:
Change some of the settings, such as the name and the target location for the .vmdk file:
Press Import to start the import of the appliance:
When the import is done, you have a new virtual machine with OEL 6.4 inside, ready to rock!
2. Add a new hard disk to the VM to hold the Oracle Database software and data
It makes sense to extend the VM with a hard disk on which the Oracle software will be installed. Go to the Settings for the VM, select the Storage tab and click on the hard disk icon:
Create a new disk.
I have used the VMDK type and it worked for my purpose – I am not sure about the other types.
I selected Dynamically allocated:
Provide the name and location of the file that is the virtual hard disk. Also specify its maximum size. 20 GB should do the trick is my guess. Extending a physical hard disk later on is not possible. Adding disks and using them to extend the logical volume certainly is possible.
Click Create. The hard disk is added.
Click OK to close the Settings dialog.
3. Start the VM and leverage the new disk in the Linux file system
connect as root user.
Making use of the new hard disk inside the Virtual Machine takes a few steps that for the non-Linux initiated such as myself is a little peculiar at first:
as root, open a terminal window
The new hard disk is available inside the VM at dev/sdd. In order to actually make use of it, we create a physical partition inside this device:
fdisk /dev/sdb
then go through the following dialog:
Now the physical partition has been set up.
Type the next statement to create the Physical Volume
pvcreate /dev/sdb1
Type this statement to create a volume group:
vgcreate -v vg_oracledb /dev/sdb1
and this one to create a logical volume that currently has about 18GB of space (more can be added to it later on):
lvcreate -v –size 18g –name lv_oracledb vg_oracledb
A file system has to be set up (similar to format I believe) on the logical volume. The next statement takes care of this:
mkfs.ext4 -v /dev/mapper/vg_oracledb-lv_oracledb
Finally, we need to mount the logical volume somewhere in a directory. First create the directory /u01 that will be the mount point:
mkdir -v /u01
then perform the mount itself:
mount -t ext4 /dev/vg_oracledb/lv_oracledb /u01
and verify whether it succeeded:
df -h /u01
In order to ensure that /u01 is mounted correctly when the system reboots, we need to edit the file /etc/fstab. Add a line for the /dev/mapper/vg_oracledb-lv_oracledb to be mounted at /u01:
Finally, as root, grant ownership of /u01 to user oracle:
chown oracle:oracle /u01
4. Pre-install Preparations
This article on OTN – http://www.oracle.com/technetwork/articles/servers-storage-admin/ginnydbinstallonlinux6-1845247.html – was a big help in preparing my Linux environment for the installation of the Oracle Database 12c. The article outlined a number of things to put in place and especially introduces an RPM that will take care of most of these preparations. All I had to do – in order for my environment to meet the installer’s requirements – was start a terminal session as root and execute this line:
yum install oracle-rdbms-server-11gR2-preinstall
I accepted all proposals put before me and a lot of packages were installed (that the Oracle Database installers checks for) and other configuration actions (creation of group, update of system parameters) were performed:
Enter y to confirm the installation of the required packages:
and finally
I later found out in Tim’s article that there is a comparable rpm for Database 12c. It seems that for me this 11gR2 RPM did the job, but for completeness sake:
yum install oracle-rdbms-server-12cR1-preinstall -y
The hostname of the Linux machine should be mapped to an IP address in the /etc/hosts file. Edit this file:
gedit /etc/hosts
and make sure that the hostname (look it up through the hostname command in the terminal) is added to the line for 127.0.0.1:
5. download the Oracle Database 12c installation archives and extract them
Configure Firefox to always ask where to download files (otherwise these files may end up on a device that may not have enough space):
Go to the OTN Download page (or to eDelivery) and download the two zip files for Linux 64 bit
Before the download commences, Firefox asks where to save the file:
Create new directory /u01/download and use it as target for both files:
These downloads are pretty fast these days:
As soon as the first of downloads is complete, open the file to extract it.
Extract the two archives two another new directory /u01/installer:
After both files are extracted, everything is prepared to start the installer.
6. Run the installer and provide the proper configuration details
As user oracle from the terminal run the installer:
At this point, I ran into a problem. One of the check carried out by the installer failed with this message: Could not execute auto check for display colors using command /usr/X11R6/bin/xdpyinfo. Check if the DISPLAY variable is set. Failed.
After quite some googling, I found a solution that worked for me:
- open terminal as root
- DISPLAY=:0.0
- export DISPLAY
- xhost +
- su – oracle
- DISPLAY=:0.0
- export DISPLAY
- goto /u01/installer/database
- sh runInstaller
And now the installer will run.
Press Next on each page except the few highlighted below:
Here is some important information about where the installation should write the files – both data files for the initial database and the database product itself – and what the name is of the database (service). Also the character set (!), the administrator password (for SYS and SYSTEM) and the decision whether the database is a container database or a ‘normal’ database. If a container database, then the name of the pluggable database must be provided as well.
Press Install to kick things off for real.
After some time, the installer prompts us to run two scripts – as root:
Open a terminal as root and run both scripts.
Then press OK in the popup window and the installer resumes.
After installation of all the software is done, a database will be created by the Database Configuration Assistant.
When it is done, a window is presented with some important details about the database was created and how it can be accessed:
The URL https://localhost:5500/em is where the Database Express tool can be reached.
In case you are interested: a log file of the installation is available in /u01/app/oraInventory/logs.
7. Perform post-installation activities
Remove installation zip files and the extracted installation files. They are no longer required and occupy a lot of diskspace (about 2.5 GB each)
Configure automatic startup of the database – using Tim Hall’s article: http://www.oracle-base.com/articles/linux/automating-database-startup-and-shutdown-on-linux.php
First step:
edit the file /etc/oratab and change the :N to :Y for the orcl database that was created by the DBCA:
8. Verify access to the database is available
From the terminal window, as oracle, you can run many database related tools and utilities, such as DBCA, lstnrctl and sqlplus.
Make sure that the ORACLE_BASE and ORACLE_HOME are set in your terminal session like this:
ORACLE_BASE=/u01/app/oracle
export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1
export ORACLE_HOME
Then run the lsnctl like this:
$ORACLE_HOME/bin/lsnrctl
and ask with status for an overview of the database services listened for:
To gain entry into the database and actually perform DBA or developer activities, you can use sqlplus; start it up using:
$ORACLE_HOME/bin/sqlplus ‘sys/Oracle123@orcl as sysdba’
(where Oracle123 is to be replaced with the administrative password you provided during installation)
After shutting down the VM and restarting it, I do not immediately get access to the database. In fact, it is not automatically started yet. I have to look into that. What I had to do was:
open a terminal as oracle
enter:
. oraenv
then respond with the ORACLE_SID, which is orcl in my case.
Next, type:
$ORACLE_HOME/bin/sqlplus ‘/ as sysdba’
then when sqlplus starts, connected to an idle instance, then type:
startup
[oracle@myoel64 ~]$ . oraenv
ORACLE_SID = [oracle] ? orcl
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@myoel64 ~]$ $ORACLE_HOME/bin/sqlplus ‘/ as sysdba’
SQL*Plus: Release 12.1.0.1.0 Production on Sun Jun 30 08:53:55 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 839282688 bytes
Next steps
Run Database Control through browser
Open Firefox and enter the url: https://localhost:5500/em/login.
The browser will protest a little, because of the https connection. Accept the risk and add an exception:
Now depending on whether the Flash-player is already installed in your browser, you may see this:
or much better, this:
Download SQL Developer and start accessing the database to try out new administration or development facilities
One very easy way to get access to the database and give it a spin is through SQL Developer. I decided to grab it and install it (still a bit of a GUI girl rather than a command line boy I guess).
Go to OTN and download SQL Developer for Linux:
Run the package installer for this download:
Once the download is complete, the RPM installer kicks in and asks for confirmation:
After click on Install, the installation takes place:
Provide the root password to proceed with the actual installation:
When the installation is done, SQL Developer can be started from the command line with $ORACLE_HOME/sqldeveloper/sqldeveloper.sh:
The first thing you are likely to require is a connection. Create it using the following dialog:
When you open the DBA window (using View | DBA) you get an overview of the CDB and PDBs:
Credits
While working my way through the installation of first Linux and then Oracle Database 12c, I received a tremendous amount of help. Through articles on the internet, discussion forum threads and community members in real time – through Twitter and many inside my own organization (AMIS). I would like to mention Job Oprel, Frits Hoogland, Jaap Poot, Lonneke Dikmans, Chris Gralike, Hans IJssenbout, Marco Gralike who all, at some point, helped me with small suggestions or big breakthroughs. I understand it is a small step for mankind, but for me this has been a pretty substantial leap forward.
Resources
To resolve the DISPLAY issue with OUI: https://forums.oracle.com/thread/571326
Create a Virtual Box VM with Oracle Enterprise Linux 6.4 inside – https://technology.amis.nl/2013/06/29/how-to-create-a-virtual-box-vm-with-oracle-enterprise-linux-inside-a-dummy-guide/
The article I noticed only after I had written the above story myself – I could have saved myself a lot of trouble! – by Tim Hall about installing Oracle Database 12c on Linux 6: http://www.oracle-base.com/articles/12c/oracle-db-12cr1-installation-on-oracle-linux-6.php
OTN: How I Simplified Oracle Database 11g Installation on Oracle Linux 6 – http://www.oracle.com/technetwork/articles/servers-storage-admin/ginnydbinstallonlinux6-1845247.html
Oracle Linux Hands On Lab – Hands-on lab – Storage Management – https://wikis.oracle.com/display/oraclelinux/Hands-on+lab+-+Storage+Management
Thank you Lucas for these super helpful tutorials.
I am following your steps to install the 12c Database on OEL 5.5 rather than 6.4. So far everything is alright.
I have a question though, I got an error while trying to execute this step:
A file system has to be set up (similar to format I believe) on the logical volume. The next statement takes care of this:
mkfs.ext4 -v /dev/mapper/vg_oracledb-lv_oracledb
I got this error:
mke4fs 1.41.9 (22-Aug-2009)
mkfs.ext4: invalid blocks count – lv_oracledb
Any suggestions ?
Thank you
Hey.. thanks for this wonderful post…
Hi, How to add more volume. I got errors during the installation and I installed twice so it consumed almost all my space.
Please let me know how to add more volume and resume my installation.
I am getting this error, From the terminal window, as oracle, you can run many database related tools and utilities, such as DBCA, lstnrctl and sqlplus.
Make sure that the ORACLE_BASE and ORACLE_HOME are set in your terminal session like this:
ORACLE_BASE=/u01/app/oracle
export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1
export ORACLE_HOME
Then run the lsnctl like this:
$ORACLE_HOME/bin/lsnrctl
I am unable to set this… I get -bash: /bin/lsnrctl: No sch file or directory, even for Sqlplus, I get the same error. please help.
Great post… it all worked perfectly. Only question – did you ever get a startup script working?
I am afraid that I did not. However, I know of some of my colleagues who did. I will ask them and add a link to their reply. Thanks for your kind comment.
Lucas
Hello Mr. Jellema,
I encountered a problem in the third step: lvcreate -v –size 18g –name lv_oracledb vg_oracledb
I copied the command from Firefox and an illegal character (the ‘–’ hyphen instead of two minus characters) crept in.
Naturally Linux refused the command and I had a moment of panic. Other users could also be disturbed.
I solved this issue and continue to follow your instructions when the downloads of the database files are ready…
Thank you very much.
Excellent article! You got me up and running in less than two hours.
Woohoo! 😉
Be assured, although little steps, you will immensely start enjoying Linux once you’he got thru the rough (nowadays short) learning curve.