Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing oracle 12c R2 on ubuntu 18.04

Tags:

oracle

ubuntu

Installing Oracle 12c Release 2 on Ubuntu fails because it is not a supported distribution. How can I install it anyway?

like image 341
fjalvingh Avatar asked Jun 27 '18 10:06

fjalvingh


People also ask

Can I install Oracle 12c on Ubuntu?

Now I am going to share my experience of installing Oracle database 12c on Ubuntu 16.04 so that it can help others who are spending their valuable times for it. First of all. download the software from the official site. You will prompt to set to password.

Can I install Oracle database on Ubuntu?

As for Linux distributions, Oracle recommends to install Oracle database on Red-Hat, Oracle Linux, and SUSE Linux Enterprise Server. However, you can install Oracle on Ubuntu Linux and Open SUSE Linux as well.

Is Oracle supported on Ubuntu?

Note: Oracle Database Client supports only 64-bit client installations on Ubuntu.


1 Answers

Download the installation files and unzip them as usual.

Create the oracle, dba and oinstall users:

sudo groupadd oinstall
sudo groupadd dba
sudo useradd -g oinstall -G dba,oinstall -s /bin/bash -m -d /home/oracle oracle

Add the following parameters to /etc/sysctl.conf:

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 3355443
kernel.shmmax = 17179869184
kernel.shmmni = 4096

# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_default=262144
net.core.wmem_max=1048576

The above is for a 32GB machine. If you have a different amount then set:

  • shmmax = (memory in bytes / 2)

Now install a set of packages needed for the install to complete. Start by updating your packages:

sudo apt update

Then install the following:

sudo apt install libc6-i386 \
gcc-multilib g++-multilib libc6-dev-i386 libstdc++6:i386 \
alien autoconf automake autotools-dev elfutils rpm rpm-common \
build-essential debhelper expat gawk gsfonts-x11 html2text sysstat \
unixodbc unixodbc-dev doxygen ksh openssh-server pax perl-doc rlwrap \
lsb lsb-core zlibc \
lib32z1-dev lib32ncurses5 libaio1 libaio-dev \
libelf-dev libodbcinstq4-1 libpth-dev libpthread-stubs0-dev \
libpthread-workqueue0 libpthread-workqueue-dev \
libtiff5-dev libzthread-dev libqt4-opengl:i386 libodbcinstq4-1:i386 \
libglu1-mesa:i386 libxtst6:i386 libxtst6

sudo apt-get install -s cabextract
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt update
sudo apt install wimtools libwim-dev
sudo apt install -s libbz2-dev:i386

Create a number of soft links so that the installation can find the files it needs at the places it expects them to be:

sudo ln -s /usr/bin/basename /bin/basename
sudo ln -s bin/bash /usr/bin/bash
sudo ln -s /usr/bin/rpm /bin/rpm
sudo ln -s /usr/bin/awk /bin/awk
sudo ln -s /usr/lib/x86_64-linux-gnu /usr/lib64
sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /lib64/libstdc++.so.6
sudo ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib64/libgcc_s.so.1
sudo ln -s /usr/lib/i386-linux-gnu/libpthread_nonshared.a /usr/lib/libpthread_nonshared.a
sudo ln -s /lib/lsb/init-functions /etc/init.d/functions
sudo ln -sf /bin/bash /bin/sh

Now start the Oracle installer running under account "oracle", usually as follows:

xhost +
sudo su - oracle
cd /path/to/unzipped/files/database
./runInstaller

Install the database but do not create a database during the installation!

After a while the installation will give an error on linking. Leave the error message on-screen, then open a terminal and edit the file $ORACLE_HOME/bin/orald. Find, at the start, the part reading:

if [ -z "$BASH_VERSION" -o -n "$ORALD_USE_GCC" ] ; then
  exec gcc "$@"
  exit 1
fi

and change the gcc line to read:

exec gcc -no-pie "$@"

(the -no-pie option starts with a single dash).

Then copy the following script into a file, for instance /tmp/fixora:

#!/bin/bash

# Change the path below to point to your installation
export ORACLE_HOME=/opt/oracle/12cr2

sudo ln -s $ORACLE_HOME/lib/libclntshcore.so.12.1 /usr/lib
sudo ln -s $ORACLE_HOME/lib/libclntsh.so.12.1 /usr/lib

cp $ORACLE_HOME/rdbms/lib/ins_rdbms.mk $ORACLE_HOME/rdbms/lib/ins_rdbms.bkp
cp $ORACLE_HOME/rdbms/lib/env_rdbms.mk $ORACLE_HOME/rdbms/lib/env_rdbms.bkp

sed -i 's/\$(ORAPWD_LINKLINE)/\$(ORAPWD_LINKLINE) -lnnz12/' $ORACLE_HOME/rdbms/lib/ins_rdbms.mk
sed -i 's/\$(HSOTS_LINKLINE)/\$(HSOTS_LINKLINE) -lagtsh/' $ORACLE_HOME/rdbms/lib/ins_rdbms.mk
sed -i 's/\$(EXTPROC_LINKLINE)/\$(EXTPROC_LINKLINE) -lagtsh/' $ORACLE_HOME/rdbms/lib/ins_rdbms.mk
sed -i 's/\$(OPT) \$(HSOTSMAI)/\$(OPT) -Wl,--no-as-needed \$(HSOTSMAI)/' $ORACLE_HOME/rdbms/lib/env_rdbms.mk
sed -i 's/\$(OPT) \$(HSDEPMAI)/\$(OPT) -Wl,--no-as-needed \$(HSDEPMAI)/' $ORACLE_HOME/rdbms/lib/env_rdbms.mk
sed -i 's/\$(OPT) \$(EXTPMAI)/\$(OPT) -Wl,--no-as-needed \$(EXTPMAI)/' $ORACLE_HOME/rdbms/lib/env_rdbms.mk
sed -i 's/^\(TNSLSNR_LINKLINE.*\$(TNSLSNR_OFILES)\) \(\$(LINKTTLIBS)\)/\1 -Wl,--no-as-needed \2/g' $ORACLE_HOME/network/lib/env_network.mk
sed -i 's/\$(SPOBJS) \$(LLIBSERVER)/\$(SPOBJS) -Wl,--no-as-needed \$(LLIBSERVER)/' $ORACLE_HOME/rdbms/lib/env_rdbms.mk
sed -i 's/\$(S0MAIN) \$(SSKFEDED)/\$(S0MAIN) -Wl,--no-as-needed \$(SSKFEDED)/' $ORACLE_HOME/rdbms/lib/env_rdbms.mk
sed -i 's/\$(S0MAIN) \$(SSKFODED)/\$(S0MAIN) -Wl,--no-as-needed \$(SSKFODED)/' $ORACLE_HOME/rdbms/lib/env_rdbms.mk
sed -i 's/\$(S0MAIN) \$(SSKFNDGED)/\$(S0MAIN) -Wl,--no-as-needed \$(SSKFNDGED)/' $ORACLE_HOME/rdbms/lib/env_rdbms.mk
sed -i 's/\$(S0MAIN) \$(SSKFMUED)/\$(S0MAIN) -Wl,--no-as-needed \$(SSKFMUED)/' $ORACLE_HOME/rdbms/lib/env_rdbms.mk
sed -i 's/^\(ORACLE_LINKLINE.*\$(ORACLE_LINKER)\) \($(PL_FLAGS)\)/\1 -Wl,--no-as-needed \2/g' $ORACLE_HOME/rdbms/lib/env_rdbms.mk
sed -i 's/\$LD \$LD_RUNTIME/$LD -Wl,--no-as-needed \$LD_RUNTIME/' $ORACLE_HOME/bin/genorasdksh
sed -i 's/\$(GETCRSHOME_OBJ1) \$(OCRLIBS_DEFAULT)/\$(GETCRSHOME_OBJ1) -Wl,--no-as-needed \$(OCRLIBS_DEFAULT)/' $ORACLE_HOME/srvm/lib/env_srvm.mk

sed -i 's/LDDISABLENEWDTAGS=-Wl,--disable-new-dtags/LDDISABLENEWDTAGS=-Wl,--no-as-needed,--disable-new-dtags/' $ORACLE_HOME/rdbms/lib/env_rdbms.mk
sed -i 's/LDDISABLENEWDTAGS=-Wl,--disable-new-dtags/LDDISABLENEWDTAGS=-Wl,--no-as-needed,--disable-new-dtags/' $ORACLE_HOME/crs/lib/env_has.mk;
sed -i 's/LDDISABLENEWDTAGS=-Wl,--disable-new-dtags/LDDISABLENEWDTAGS=-Wl,--no-as-needed,--disable-new-dtags/' $ORACLE_HOME/odbc/lib/env_odbc.mk;
sed -i 's/LDDISABLENEWDTAGS=-Wl,--disable-new-dtags/LDDISABLENEWDTAGS=-Wl,--no-as-needed,--disable-new-dtags/' $ORACLE_HOME/precomp/lib/env_precomp.mk;
sed -i 's/LDDISABLENEWDTAGS=-Wl,--disable-new-dtags/LDDISABLENEWDTAGS=-Wl,--no-as-needed,--disable-new-dtags/' $ORACLE_HOME/srvm/lib/env_srvm.mk;
sed -i 's/LDDISABLENEWDTAGS=-Wl,--disable-new-dtags/LDDISABLENEWDTAGS=-Wl,--no-as-needed,--disable-new-dtags/' $ORACLE_HOME/network/lib/env_network.mk;
sed -i 's/LDDISABLENEWDTAGS=-Wl,--disable-new-dtags/LDDISABLENEWDTAGS=-Wl,--no-as-needed,--disable-new-dtags/' $ORACLE_HOME/ldap/lib/env_ldap.mk;
sed -i 's/LDDISABLENEWDTAGS=-Wl,--disable-new-dtags/LDDISABLENEWDTAGS=-Wl,--no-as-needed,--disable-new-dtags/' $ORACLE_HOME/ord/im/lib/env_ordim.mk;
sed -i 's/LDDISABLENEWDTAGS=-Wl,--disable-new-dtags/LDDISABLENEWDTAGS=-Wl,--no-as-needed,--disable-new-dtags/' $ORACLE_HOME/plsql/lib/env_plsql.mk;
sed -i 's/LDDISABLENEWDTAGS=-Wl,--disable-new-dtags/LDDISABLENEWDTAGS=-Wl,--no-as-needed,--disable-new-dtags/' $ORACLE_HOME/ctx/lib/env_ctx.mk;
sed -i 's/LDDISABLENEWDTAGS=-Wl,--disable-new-dtags/LDDISABLENEWDTAGS=-Wl,--no-as-needed,--disable-new-dtags/' $ORACLE_HOME/sqlplus/lib/env_sqlplus.mk;

Change the ORACLE_HOME line in the script to point to your installation directory for Oracle. Make the script executable and run it as the oracle user:

chmod a+x /tmp/fixora
sudo su - oracle
/tmp/fixora

Now return to the installer and press the "retry" button on the error dialog. The installation should now finish without further issues.

The resulting installation does not work, however: creating a database will hang in the "startup mount" command, with an oracle BEQ process deadlocked inside localtime. To fix that do the following, again as the user oracle:

cd $ORACLE_HOME/lib/stubs
rm libc*
cd ../../bin
./relink all

After the relink creating a database should work; you can create one using:

dbca -silent -createDatabase \
-templateName General_Purpose.dbc \
-gdbname $DBNAME -sid $DBNAME -responseFile NO_VALUE \
-characterSet AL32UTF8 \
-sysPassword REPLACE_WITH_PASSWORD \
-systemPassword REPLACE_WITH_PASSWORD \
-createAsContainerDatabase false \
-databaseType MULTIPURPOSE \
-automaticMemoryManagement false \
-totalMemory 2048 \
-storageType FS \
-datafileDestination "/opt/oracle/oradata/" \
-redoLogFileSize 500 \
-emConfiguration NONE \
-ignorePreReqs
like image 188
fjalvingh Avatar answered Oct 31 '22 09:10

fjalvingh