An .rpm to install Oracle Database 18c

Submitted by fpachot on
Blog article:

It was announced at Oracle Open World 2017 and here it is just before the start of OOW18: an RPM to install the Oracle Database software.

Download

In the Oracle Database 18c download page there are two files for 18.3. One is a zip of the Oracle Home that we have to unzip and run the setup (named runInstaller but different than the one we had in pre-18c releases). The other file is an RPM: oracle-database-ee-18c-1.0-1.x86_64.rpm

The RPM contains the Oracle Home, as in the .zip, with its 7.8 GB full of 37399 files. Well, actually the .zip distribution has 8.7 GB with 38656 files. It seems that there was some cleanup done on the .patch_storage. But it is exactly the same 18.3 build from June, same patches, same SQL Developer 17.3 which we should either remove if not used, or upgrade.

Dependencies

The first advantage of an .rpm installation is the automatic installation of the dependencies. Most of them are already packaged in the oracle-database-preinstall-18. There is an additional dependency for net-tools here. I have not seen that the installation uses those programs, but as they are obsolete now, they are probably not installed in a new system, and installed just in case.

 

# yum install -y oracle-database-ee-18c-1.0-1.x86_64.rpm

Loaded plugins: ulninfo
Examining oracle-database-ee-18c-1.0-1.x86_64.rpm: oracle-database-ee-18c-1.0-1.x86_64
Marking oracle-database-ee-18c-1.0-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-ee-18c.x86_64 0:1.0-1 will be installed
--> Processing Dependency: net-tools for package: oracle-database-ee-18c-1.0-1.x86_64
--> Processing Dependency: oracle-database-preinstall-18c for package: oracle-database-ee-18c-1.0-1.x86_64
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.22.20131004git.el7 will be installed
---> Package oracle-database-preinstall-18c.x86_64 0:1.0-1.el7 will be installed
--> Finished Dependency Resolution


Dependencies Resolved

========================================================================================================================================================================
 Package                                       Arch                  Version                                  Repository                                           Size
========================================================================================================================================================================
Installing:
 oracle-database-ee-18c                        x86_64                1.0-1                                    /oracle-database-ee-18c-1.0-1.x86_64                7.8 G
Installing for dependencies:
 net-tools                                     x86_64                2.0-0.22.20131004git.el7                 ol7_latest                                          305 k
 oracle-database-preinstall-18c                x86_64                1.0-1.el7                                ol7_latest                                           18 k

 

/opt/oracle

I use to install the Oracle Home under /u01 but this RPM installs under /opt.

Without a dedicated filesystem for /opt, it will add 8GB to the root filesystem, which is not a good idea:

Error Summary
-------------
Disk Requirements:
  At least 7543MB more space needed on the / filesystem.

 

My first idea, on my lab where I didn't want to add a new disk, was to symlink /opt/oracle to another filesystem where I have enough space. But then I need to already have the oracle user, and even with the right chmod I got:

 

[SEVERE] The install cannot proceed because ORACLE_BASE directory (/opt/oracle)
is not owned by "oracle" user. You must change the ownership of ORACLE_BASE
directory to "oracle" user and retry the installation.

 

And this even with what seems to be the right owners:

# ln -s /u01/opt/oracle /opt
# ls -ld /opt/oracle /u01/opt/oracle
lrwxrwxrwx. 1 root 0   15 Oct 19 20:06 /opt/oracle -> /u01/opt/oracle
drwxr-xr-x. 2 root 0 4096 Oct 19 20:05 /u01/opt/oracle

 

Anyway, the right solution is to have a filesystem for /opt but in my case I just created /opt as a symbolic link to some other filesystem (but you will see that it is not a good idea).

 

Oracle Home Installation

You can find the log in /var/log/oracle-database-ee-18c/results/oraInstall.log which contain the following when executed on a machine without any Oracle Inventory yet:

[INFO] Starting the installation process of the Oracle Database...
10/19/2018-08:02:53 AM
[INFO] Registering Oracle home to the Oracle inventory...
[INFO] Oracle home registered to the Oracle inventory.
[INFO] Executing post installation scripts...
[INFO] Setting up inventory as it has not been setup on this machine.
[INFO] Configuring ADR directories...
[INFO] ADR directories configured.
[INFO] Post installation scripts executed successfully.
[INFO] Oracle home installed successfully and ready to be configured.

 

After user (oracle id=54321), groups (oinstall, dba, oper, backupdba, dgdba, kmdba, racdba) and all directories have been created, once the Oracle Home is extracted from the .rpm to /opt/oracle/product/18c/dbhome_1, the 18c runInstaller.sh is executed to register the Oracle Home in the Inventory. It is an -attachHome only (no re-link), and with -ignoreSysPrereqs. Then diagsetup is run to configure the ADR directories under $ORACLE_BASE/diag. And that's all, the software is installed:

 

Install  1 Package

Total size: 7.8 G
Installed size: 7.8 G
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : oracle-database-ee-18c-1.0-1.x86_64 [##                                                                                                            ] 1/1
  Installing : oracle-database-ee-18c-1.0-1.x86_64 [###                                                                                                           ] 1/1
  Installing : oracle-database-ee-18c-1.0-1.x86_64 [###########                                                                                                   ] 1/1
  Installing : oracle-database-ee-18c-1.0-1.x86_64 [##########################                                                                                    ] 1/1
  Installing : oracle-database-ee-18c-1.0-1.x86_64 [################################################                                                              ] 1/1

  Installing : oracle-database-ee-18c-1.0-1.x86_64                                                                                                                  1/1
[INFO] Executing post installation scripts...
[INFO] Oracle home installed successfully and ready to be configured.
To configure a sample Oracle Database you can execute the following service configuration script as root: /etc/init.d/oracledb_ORCLCDB-18c configure
  Verifying  : oracle-database-ee-18c-1.0-1.x86_64                                                                                                                  1/1
Installed:
  oracle-database-ee-18c.x86_64 0:1.0-1

Complete!

 

Note that we may want to re-use the scripts used for this install and here is the way to extract them from the .rpm:

rpm -qp --scripts oracle-database-ee-18c-1.0-1.x86_64.rpm  | awk '/^(pre|post)(un)?install/{print "\n###\t"$0"\n";next}{print}'

 

So, the software is there and the output mentions that there's a script here to create a first database: /etc/init.d/oracledb_ORCLCDB-18c

At this point you may set the Oracle Home as Read Only with roohctl as this new installation does not user this new feature.

oracledb_ORCLCDB-18c configure

In addition to the ORACLE_BASE (/opt/oracle) where I have diag, checkpoint, oraInventory and product/18c/dbhome_1, the two following files were installed in /etc:

# du -a /etc | grep ORCL
4       /etc/sysconfig/oracledb_ORCLCDB-18c.conf
8       /etc/rc.d/init.d/oracledb_ORCLCDB-18c

 

Those files will help us to create a default database, and to start/stop them automatically. From the first one I can choose the listener and EM Express ports and the location of the database files:

LISTENER_PORT=1521
ORACLE_DATA_LOCATION=/opt/oracle/oradata
EM_EXPRESS_PORT=5500

 

The second one is the init.d script. It will be used by the obsolete SysV service management to start and stop the instances. But it has also a configure argument which is used to create a default database. This script has some more environment variables which I may want to change, or not:

 

export ORACLE_HOME=/opt/oracle/product/18c/dbhome_1
export ORACLE_VERSION=18c
export ORACLE_SID=ORCLCDB
export TEMPLATE_NAME=General_Purpose.dbc
export CHARSET=AL32UTF8
export PDB_NAME=ORCLPDB1
export LISTENER_NAME=LISTENER
export NUMBER_OF_PDBS=1
export CREATE_AS_CDB=true

 

You recognize the arguments that will be passed to DBCA. The ORACLE_VERSION combined with the ORACLE_SID are used to read the configuration file with ports and datafile directory (oracledb_ORCLCDB-18c.conf here).

 

Note that this init.d file is specific to one ORACLE_SID. This is one service per instance, like what we have on Windows for decades.

So, I'll run this script manually, as root, to create the first database:

 

# /etc/rc.d/init.d/oracledb_ORCLCDB-18c configure
Configuring Oracle Database ORCLCDB.
Prepare for db operation
8% complete
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
43% complete
[WARNING] ORA-20002: Directory creation failed
ORA-06512: at "SYS.DBMS_QOPATCH", line 1461
ORA-06512: at "SYS.DBMS_QOPATCH", line 1341
ORA-06512: at line 1

46% complete
Completing Database Creation
51% complete
54% complete
Creating Pluggable Databases
58% complete
77% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
 /opt/oracle/cfgtoollogs/dbca/ORCLCDB.
Database Information:
Global Database Name:ORCLCDB
System Identifier(SID):ORCLCDB
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log" for further

Database configuration failed.

 

As I said before I have created a symbolic link instead of mounting another filesystem. Unfortunately, I forgot that I encountered a problem in the past with datapatch with the Oracle Home defined under a symbolic link. This is why I got the error above. I should have changed the Oracle Home in the init.d script.

chkconfig

Now that the database is created, the init.d file will be used to automatically start and stop the instance. It was not automatically enabled in chkconfig and we have to do it manually:

 

# chkconfig --add /etc/rc.d/init.d/oracledb_ORCLCDB-18c

 

 

# chkconfig --list

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use 'systemctl list-unit-files'.
      To see services enabled on particular target use
      'systemctl list-dependencies [target]'.

netconsole      0:off   1:off   2:off   3:off   4:off   5:off   6:off
network         0:off   1:off   2:on    3:on    4:on    5:on    6:off
oracledb_ORCLCDB-18c    0:off   1:off   2:on    3:on    4:on    5:on    6:off
rhnsd           0:off   1:off   2:on    3:on    4:on    5:on    6:off
setupAtBoot     0:off   1:off   2:on    3:on    4:on    5:on    6:off

 

I can now start and stop my ORCLCDB instance with systemctl start and stop. Note that this does not use the /etc/oratab flag. chkcfg is the way to choose what starts on boot. Unfortunately, there it no status implemented:

 

# /etc/rc.d/init.d/oracledb_ORCLCDB-18c status
Usage: /etc/rc.d/init.d/oracledb_ORCLCDB-18c {start|stop|restart|configure}

 

Deinstall

Providing a .rpm to install means that you should be able to deinstall it. This runs the $ORACLE_HOME/deinstall/deinstall (so be sure to have a few GB in /tmp). However, this yum remove cannot ask for confirmation to remove the database belonging to this Oracle Home, as deinstall does. And then it fails:

 

[SEVERE] Listeners or databases are present in the system, remove them before proceeding with the deinstallation
error: %preun(oracle-database-ee-18c-1.0-1.x86_64) scriptlet failed, exit status 1
Error in PREUN scriptlet in rpm package oracle-database-ee-18c-1.0-1.x86_64
  Verifying  : oracle-database-ee-18c-1.0-1.x86_64                             1/1

Failed:
  oracle-database-ee-18c.x86_64 0:1.0-1

Complete!

 

So finally, I've run deinstall manually before running yum remove (which displays lot of warnings, then).

The only files remaining are those from rc.d directories:

 

ls -ld /etc/rc.d/*/*oracle*
-rwx------. 1 root 0 1281 Jun 20 12:37 /etc/rc.d/init.d/oracle-database-preinstall-18c-firstboot
-rwx------. 1 root 0 1299 Sep 20 09:06 /etc/rc.d/init.d/oracle-rdbms-server-12cR1-preinstall-firstboot
lrwxrwxrwx. 1 root 0   30 Oct 19 17:31 /etc/rc.d/rc0.d/K05oracledb_ORCLCDB-18c -> ../init.d/oracledb_ORCLCDB-18c
lrwxrwxrwx. 1 root 0   30 Oct 19 17:31 /etc/rc.d/rc1.d/K05oracledb_ORCLCDB-18c -> ../init.d/oracledb_ORCLCDB-18c
lrwxrwxrwx. 1 root 0   30 Oct 19 17:31 /etc/rc.d/rc2.d/S80oracledb_ORCLCDB-18c -> ../init.d/oracledb_ORCLCDB-18c
lrwxrwxrwx. 1 root 0   30 Oct 19 17:31 /etc/rc.d/rc3.d/S80oracledb_ORCLCDB-18c -> ../init.d/oracledb_ORCLCDB-18c
lrwxrwxrwx. 1 root 0   30 Oct 19 17:31 /etc/rc.d/rc4.d/S80oracledb_ORCLCDB-18c -> ../init.d/oracledb_ORCLCDB-18c
lrwxrwxrwx. 1 root 0   30 Oct 19 17:31 /etc/rc.d/rc5.d/S80oracledb_ORCLCDB-18c -> ../init.d/oracledb_ORCLCDB-18c
lrwxrwxrwx. 1 root 0   30 Oct 19 17:31 /etc/rc.d/rc6.d/K05oracledb_ORCLCDB-18c -> ../init.d/oracledb_ORCLCDB-18c

 

I should have disabled the service with chkconfig first.

So what?

There's nothing too exciting here. Your can also read Tim Hall thoughts about this. RPM exists for decades. Oracle was long to use it for dependencies, with the preinstall package, and for software shipping now. But the required step for this was to ship the software as a golden image rather than installation software, and this came with 18.3 last July. The next step is this .rpm and it can be useful it it can be directly downloaded from ULN. I hope that the future will bring the choice of Release Updates, and applying a new one with a yum update.

update Nov-18

While fixing a typo, I add a link to Tim Hall thoughts about it: https://oracle-base.com/articles/18c/oracle-db-18c-rpm-installation-on-oracle-linux-6-and-7#thoughts

 

 


The comments are closed on this post, but do not hesitate to give feedback, comment or questions on Twitter (@FranckPachot)

 

Disclaimer

The views expressed in this blog are those of the authors and cannot be regarded as representing CERN’s official position.

CERN Social Media Guidelines

 

Blogroll