Installing Oracle 18c using command line

Posted in: Oracle, Technical Track

Just three days ago Oracle released Oracle 18c for general installation on-premises. We’ve had a taste of the new Oracle release on Oracle Cloud for quite some time, but now we can download and install it for in-house testing. I installed it for testing and decided to share my experience. Even though I didn’t experience any surprises and the process itself went smoothly, I still hope that a few people will benefit from some useful information about the process.

I was hoping to check how an “rpm” based installation worked, but alas that type of distribution was not yet available. I tested the general unzip and install way using the file from the Oracle site. The process was quite simple and straightforward.

I was starting from a fresh installed Oracle Linux 7 and the first step was to prepare the system. It was simple enough and I used a prepared file ora_preinst.lst with a list of packages to install.

[root@vm130-179 ~]# vi ora_preinst.lst
[root@vm130-179 ~]# cat ora_preinst.lst
oracle-database-preinstall-18c
lvm2
unzip
gcc
 
[root@vm130-179 ~]#
 
[root@vm130-179 ~]# yum -y install $(cat ora_preinst.lst)
Loaded plugins: ulninfo
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.8.5-28.0.1.el7_5.1 will be installed
--> Processing Dependency: libgomp = 4.8.5-28.0.1.el7_5.1 for package: gcc-4.8.5-28.0.1.el7_5.1.x86_64
--> Processing Dependency: cpp = 4.8.5-28.0.1.el7_5.1 for package: gcc-4.8.5-28.0.1.el7_5.1.x86_64
….
 
Complete!
[root@vm130-179 ~]#

I had a disk “/dev/xvdb” attached to the system to be used for software and a test database. To speed the process, I used a simple script to create an LVM volume and mount it to the system.

[root@vm130-179 ~]# cat add_disk.sh
#!/bin/bash
pvcreate $1
vgcreate vgsoft $1
lvcreate -l 100%FREE -n orasoft01 vgsoft
mkfs.ext4 /dev/mapper/vgsoft-orasoft01
cp /etc/fstab /etc/fstab.orig
sed -i '/^\s*$/d' /etc/fstab
echo -e '\n'`blkid /dev/mapper/vgsoft-orasoft01 | cut -d " " -f 2 | sed 's/"//g'`"\t\t/u01\text4\tdefaults\t1 2" >>/etc/fstab
mkdir /u01
mount -a
 
[root@vm130-179 ~]# sh add_disk.sh /dev/xvdb
  Physical volume "/dev/xvdb" successfully created.
  Volume group "vgsoft" successfully created
  Logical volume "orasoft01" created.
…
mkdir: cannot create directory ‘/u01’: File exists
[root@vm130-179 ~]# df -h /u01
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/vgsoft-orasoft01   50G   53M   47G   1% /u01
[root@vm130-179 ~]#

The system was ready and the rest of the steps were about installing the software and creating a test database.
We needed to create the necessary directories and a response file for the installation:

 
[oracle@vm130-179 ~]$ mkdir -p /u01/app/oracle/product/18.0.0/dbhome_1
[oracle@vm130-179 ~]$ unzip -q  /u01/app/oracle/distr/LINUX.X64_180000_db_home.zip -d /u01/app/oracle/product/18.0.0/dbhome_1/
[oracle@vm130-179 ~]$ cd /u01/app/oracle/product/18.0.0/dbhome_1/
[oracle@vm130-179 dbhome_1]$ sed -e '/\s*#.*$/d' -e '/^\s*$/d' install/response/db_install.rsp > install/response/soft_only.rsp
[oracle@vm130-179 dbhome_1]$ vi install/response/soft_only.rsp
 
[oracle@vm130-179 dbhome_1]$ cat install/response/soft_only.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v18.0.0
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
ORACLE_HOME=/u01/app/oracle/product/18.0.0/dbhome_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=dba
oracle.install.db.OSBACKUPDBA_GROUP=dba
oracle.install.db.OSDGDBA_GROUP=dba
oracle.install.db.OSKMDBA_GROUP=dba
oracle.install.db.OSRACDBA_GROUP=dba
[oracle@vm130-179 dbhome_1]$

Having everything ready I just ran the installer in silent mode using the prepared response file:

[oracle@vm130-179 dbhome_1]$ ./runInstaller -silent -responseFile install/response/soft_only.rsp
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. installActions2018-07-25_01-26-33PM.log
   ACTION: Identify the list of failed prerequisite checks from the log: installActions2018-07-25_01-26-33PM.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/18.0.0/dbhome_1/install/response/db_2018-07-25_01-26-33PM.rsp
 
You can find the log of this install session at:
 /tmp/InstallActions2018-07-25_01-26-33PM/installActions2018-07-25_01-26-33PM.log
 
As a root user, execute the following script(s):
        1. /u01/app/oraInventory/orainstRoot.sh
        2. /u01/app/oracle/product/18.0.0/dbhome_1/root.sh
 
Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes:
[vm130-179]
Execute /u01/app/oracle/product/18.0.0/dbhome_1/root.sh on the following nodes:
[vm130-179]
 
Successfully Setup Software with warning(s).
Moved the install session logs to:
 /u01/app/oraInventory/logs/InstallActions2018-07-25_01-26-33PM
[oracle@vm130-179 dbhome_1]$

The new Oracle release comes as an already zipped Oracle home prepared for a clone. Because of that, the installation part was quick since you only needed to relink binaries and register the home in the global inventory.
The last step was to execute the root.sh script as root user:

[root@vm130-179 ~]# /u01/app/oracle/product/18.0.0/dbhome_1/root.sh
Check /u01/app/oracle/product/18.0.0/dbhome_1/install/root_vm130-179.dlab.pythian.com_2018-07-25_13-28-58-244286954.log for the output of root script
[root@vm130-179 ~]#

It was quick and easy. One part of the process I thought was bit outdated was the usage of the response file for the installer. I thought it could be slightly improved by using an interactive command line based installer but maybe I was asking too much. Anyway, the response file worked.
Creating a database was even easier. You just needed to allocate storage and run the dbca utility.

 
[oracle@vm130-179 dbhome_1]$ mkdir /u01/app/oracle/oradata
[oracle@vm130-179 dbhome_1]$ export PATH=/u01/app/oracle/product/18.0.0/dbhome_1/bin:$PATH
[oracle@vm130-179 dbhome_1]$ dbca -createDatabase -silent -createAsContainerDatabase true -pdbName pdb1 -templateName General_Purpose.dbc -gdbName orcl -sysPassword welcome1 -systemPassword welcome1 -pdbAdminPassword welcome1 -dbsnmpPassword welcome1 -datafileDestination /u01/app/oracle/oradata -storageType FS -sampleSchema true
[WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards.
   CAUSE:
…..
100% complete
Database creation complete. For details check the logfiles at:
 /u01/app/oracle/cfgtoollogs/dbca/orcl.
Database Information:
Global Database Name:orcl
System Identifier(SID):orcl
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
[oracle@vm130-179 dbhome_1]$

I got a couple of warnings because passwords I used for sys, system and pdbadmin users were not up to security standards. Keep in mind that if you don’t want to show the passwords in the command line, you can skip the parameters and put the passwords interactively when the dbca asks you to do that.
Everything is ready for the tests:

[oracle@vm130-179 dbhome_1]$ . oraenv
ORACLE_SID = [oracle] ? orcl
The Oracle base has been set to /u01/app/oracle
[oracle@vm130-179 dbhome_1]$ sqlplus / as sysdba
 
SQL*Plus: Release 18.0.0.0.0 - Production on Wed Jul 25 13:57:05 2018
Version 18.3.0.0.0
 
Copyright (c) 1982, 2018, Oracle.  All rights reserved.
 
 
Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0
 
SQL>

The entire process didn’t take too much time and could be easily automated to be executed either by ansible scripts or used in a docker container. Overall the install is pretty similar to the older releases. The one main difference is that the binaries are now extracted from the zip file directly into the Oracle home, rather than into a staging location only to be copied by the OUI. One more thing I noticed was that after unzipping the Oracle home we got 1.4 Gb “.patch_storage” directory inside. I am not sure why we need it, but hope somebody from Oracle will tell us soon. Happy testing.

email

Interested in working with Gleb? Schedule a tech call.

About the Author

Regarded by his peers as an Oracle guru, Gleb is known for being able to resolve any problem related to Oracle. He loves the satisfaction of troubleshooting, and his colleagues even say that seeking Gleb’s advice regarding an issue is more efficient than looking it up. Gleb enjoys the variety of challenges he faces while working at Pythian, rather than working on the same thing every day. His areas of speciality include Oracle RAC, Exadata, RMAN, SQL tuning, high availability, storage, performance tuning, and many more. When he’s not working, running, or cycling, Gleb can be found reading.

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *