Azure - Oracle Database Manually Installation on Linux

> Azure

1 - About

The installation of the Oracle database on bare-bone Linux.

For a quick an dirty installation, see Azure - Quick Oracle Database Installation from MarketPlace

This installation after reboot of the machine will prevent the login service to restart. You can't then login with ssh :(

The boot diagnostic gives the below message:

[FAILED] Failed to start Login Service.
See 'systemctl status systemd-logind.service' for details.

I had not time to investigate. For a quick installation, use the marketplace. See Azure - Quick Oracle Database Installation from MarketPlace

Advertising

3 - VM

3.1 - Create

Creation of a VM with Oracle Linux 7 Update 4 and a Standard_DS1_v2 size.

az.cmd vm create ^
    --resource-group GROUP_NAME ^
    --name VM_NAME ^
    --image Oracle:Oracle-Linux:7.4:7.4.20170908 ^
    --size Standard_DS1_v2 ^
    --authentication-type password ^
    --admin-username admuser ^
    --admin-password thepwd ^
    --location westeurope
{\ Finished ..
  "fqdns": "",
  "id": "/subscriptions/a3c34890-da7a-51ac-88fa-090f6b96d44d/resourceGroups/GROUP_NAME/providers/Microsoft.Compute/virtualMachines/VM_NAME",
  "location": "westeurope",
  "macAddress": "01-5D-4A-29-79-H6",
  "powerState": "VM running",
  "privateIpAddress": "10.0.0.0",
  "publicIpAddress": "55.666.444.88",
  "resourceGroup": "GROUP_NAME",
  "zones": ""
}

3.2 - Swap space

Usually only EnableSwap and SwapSizeMB will not come configured by default. Windows Azure Linux Agent (waagent) - (on Linux VM)

Edit the “/etc/waagent.conf” Add or uncomment these lines:

# Format if unformatted. If 'n', resource disk will not be mounted.
ResourceDisk.Format=y
 
# File system on the resource disk
# Typically ext3 or ext4. FreeBSD images should use 'ufs2' here.
ResourceDisk.Filesystem=ext4
 
# Mount point for the resource disk
ResourceDisk.MountPoint=/mnt/resource
 
# Create and use swapfile on resource disk.
ResourceDisk.EnableSwap=y
 
# Size of the swapfile.
ResourceDisk.SwapSizeMB=3175

Save and restart the agent to apply if any changes are made

systemctl stop waagent
systemctl start waagent

3.3 - IP

Private IP Address must be static.

In Azure, Network Interface > Configuration > Ip Configuration > Click > Static

Advertising

3.4 - Firewall

Restrict the inbound rules to your public IP if you don't want to see others trying to get in.

4 - As root

As root

sudo su -

4.1 - Utility Software

  • Utility
yum update -y
yum install wget zip unzip tmux -y
yum install xauth -y
cat /etc/ssh/sshd_config | grep -i X11
# Must be yes
X11Forwarding yes
  • Test it
yum install xclock -y
# Start your local X11 Server
# Not as root, start the clock
xclock

Advertising

4.2 - Processor architecture

uname -m
x86_64

4.3 - Memory

4.3.1 - Total Memory

  • 2 GB RAM recommended.
grep MemTotal /proc/meminfo
MemTotal:        3248960 kB
free # free ram
              total        used        free      shared  buff/cache   available
Mem:        3248960      137932     2947872        8532      163156     2926636
Swap:       2097148           0     2097148

4.3.2 - Shared memory

Linux - Shared Memory (SHM) (/dev/shm)

Ensure that the /dev/shm mount area is of type tmpfs and is mounted with the following options:

  • rw and exec permissions set on it
  • Without noexec or nosuid set on it
df -h /dev/shm
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           1.6G     0  1.6G   0% /dev/shm
ls -l /dev | grep shm
drwxrwxrwt. 2 root root          40 Dec 21 09:02 shm

4.4 - File System Storage

  • At least 1 GB of space in the /tmp directory.\
df -h /tmp
  • At least 7.5 GB for Oracle Database Enterprise and standard Edition. (RCU for OBIEE needs a minimum of 500 MB)
df -H /
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        32G  5.8G   24G  20% /

4.5 - Network

4.5.1 - Host name

If the ORACLE_HOSTNAME environment variable is not set and you are installing on a computer that has multiple network cards, then Oracle Universal Installer determines the host name from the hosts file.

Example of /etc/hosts file with di-rep-db.hotitem.local as hostname

vi /etc/hosts 
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1	localhost localhost.localdomain 
10.0.0.4   vm_name vm_name.localdomain
  • Set/verify the correct hostname in the “/etc/hostname” file.
  • Set the ORACLE_HOSTNAME environment variable for the oracle user.
ping hostname

4.5.2 - Disable secure linux

Disable secure linux by editing the /etc/selinux/config file, making sure the SELINUX flag is set as follows:

SELINUX=disabled

4.6 - Process

Resources Limitations: Linux - Resource Manager - Processes limitations (/etc/security/limits.conf)

Add the following lines to the /etc/security/limits.conf file that limits the resource for the oracle user.

oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536
oracle              soft    stack   10240
oracle              hard    stack   32768

4.7 - Installation user and group

4.7.1 - Group

groupadd -g 500 oinstall
groupadd -g 501 dba
groupadd -g 502 oper

4.7.2 - Installation User

  • Create the installation user. The OINSTALL group must be the primary group of all Oracle software installation owners on the server.
useradd -u 501 -g oinstall -G dba,oper oracle
passwd oracle # Set the password
Changing password for user oracle.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

4.8 - Kernel

See Automatically Configuring Oracle Linux with Oracle Preinstallation RPM

# As root
yum install oracle-rdbms-server-12cR1-preinstall
sysctl -p
yum update

Equivalent to the following ?

4.8.1 - Package

yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install smartmontools -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y
yum install zlib-devel -y
yum install zlib-devel.i686 -y

4.8.2 - Kernel Parameters

vi /etc/sysctl.conf 
# Add the following kernel parameters
kernel.sem = 250 32000 100 142
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 1663467520
kernel.shmmni = 4096
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 = 1048586
net.ipv4.tcp_wmem = 262144 262144 262144
net.ipv4.tcp_rmem = 4194304 4194304 4194304
  • Apply the new parameters
/sbin/sysctl -p

4.9 - Installation Software

mkdir -p /u01/tmp
cd /u01/tmp
# Transfer the file linuxx64_12201_database.zip to /tmp
# Copy it below u01
mv /tmp/linuxx64_12201_database.zip /u01/tmp
unzip linuxx64_12201_database.zip
# Changes the owner to oracle
chown -R oracle.oinstall /u01

5 - Pre-install As Oracle

5.1 - Character set

locale settings must enable Unicode support

locale # To check your current locale settings, use the locale command on your system. 
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

If not good

setenv LANG en_US.UTF-8 # Sets the installation default locale. 
setenv LC_ALL en_US.UTF-8 # overrides the value of the LANG environment variable and the values of any other LC_* environment variables.

5.2 - Environment

Only if any other Oracle software is present. os: Bash - (Environment) Variable

unset ORACLE_HOME
unset ORACLE_BASE
unset ORACLE_SID
unset TNS_ADMIN 

5.3 - Default file Mode creation

Linux - Umask (user mask)

On the command line and in the bash profile

umask 022

5.4 - Start installation

5.4.1 - From the GUI

cd /u01/tmp/database/
./runInstaller
# -ignoreSysPrereqs

The installation may seems to be not finished but this is not the case.

5.4.2 - From the console (Silent)

The following response file create:

  • a general purpose EE database
  • called ORCL
  • without container
  • with the sample schema
  • in UTF8

db.zip

Steps:

  • Transfer it to /tmp/
  • Changes its content. The password properties for respectively SYS and SYSTEM must be set:
    • oracle.install.db.config.starterdb.password.SYS
    • oracle.install.db.config.starterdb.password.SYSTEM
cd /u01/tmp/database/
# Start a tmux session
tmux
# Run the installer
./runInstaller -silent -responseFile /tmp/db.rsp
#./runInstaller -silent -ignoreSysPrereqs -responseFile /tmp/db.rsp
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 18828 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 3174 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-01-08_05-23-00PM. Please wait ...

You can find the log of this install session at:
 /u01/app/oraInventory/logs/installActions2018-01-08_05-23-00PM.log

The installation of Oracle Database 12c was successful.
Please check '/u01/app/oraInventory/logs/silentInstall2018-01-08_05-23-00PM.log' for more details.

As a root user, execute the following script(s):
        1. /u01/app/oraInventory/orainstRoot.sh
        2. /u01/app/oracle/product/12.2.0/dbhome_1/root.sh



Successfully Setup Software.
As install user, execute the following command to complete the configuration.
        /u01/tmp/database/runInstaller -executeConfigTools -responseFile /tmp/db.rsp [-silent]

5.5 - Post Installation

5.5.1 - As root

When asked during the GUI installation or after a silent install.

set -o xtrace
. /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
# to know where is this script, ask the trace
set -o xtrace
. /u01/app/oracle/product/12.2.0/dbhome_1/root.sh
    ORACLE_HOME=  /u01/app/oracle/product/12.2.0/dbhome_1
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
/u01/app/oracle/product/12.2.0/dbhome_1/install/root_HI-ORACLE-DB-01_2018-01-08_19-34-03-404231473.log

5.5.2 - Post-install As Oracle

After a silent installation: long operation

execute dbca silently (database configuration tool)

/u01/tmp/database/runInstaller -executeConfigTools -responseFile /tmp/db.rsp -silent

Follow it:

tail -f /u01/app/oraInventory/logs/installActions2018-01-08_07-47-43PM.log

Output:

Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 11707 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 3166 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-01-08_07-47-43PM. Please wait ...

You can find the logs of this session at:
/u01/app/oraInventory/logs

Successfully Configured Software.
  • File /u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log
[ 2018-01-08 19:49:07.747 UTC ] Copying database files
DBCA_PROGRESS : 1%
DBCA_PROGRESS : 2%
DBCA_PROGRESS : 18%
DBCA_PROGRESS : 33%
[ 2018-01-08 19:53:43.530 UTC ] Creating and starting Oracle instance
DBCA_PROGRESS : 35%
DBCA_PROGRESS : 40%
DBCA_PROGRESS : 44%
DBCA_PROGRESS : 49%
DBCA_PROGRESS : 53%
DBCA_PROGRESS : 54%
DBCA_PROGRESS : 55%
DBCA_PROGRESS : 58%
[ 2018-01-08 19:57:51.162 UTC ] Completing Database Creation
DBCA_PROGRESS : 59%
DBCA_PROGRESS : 60%
DBCA_PROGRESS : 61%
DBCA_PROGRESS : 64%
DBCA_PROGRESS : 65%
DBCA_PROGRESS : 69%
[ 2018-01-08 20:08:57.580 UTC ] Executing Post Configuration Actions
DBCA_PROGRESS : 100%
[ 2018-01-08 20:08:57.581 UTC ] 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

5.6 - Oracle bash start script

.bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=orcl

5.7 - Test

export ORACLE_SID=orcl
sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Mon Jan 8 21:24:38 2018

Copyright (c) 1982, 2016, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> exit
  • Listener
lsnrctl status
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 08-JAN-2018 21:24:12

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=HI-ORACLE-DB-01)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                08-JAN-2018 19:48:51
Uptime                    0 days 1 hr. 35 min. 26 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/HI-ORACLE-DB-01/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HI-ORACLE-DB-01)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=HI-ORACLE-DB-01)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/orcl/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

6 - Note for self

6.1 - Database Parameters

Parameter Minimum Required Value
SHARED_POOL_SIZE 147,456 KB
SGA_MAX_SIZE 147,456 KB
DB_BLOCK_SIZE 8 KB
session_cached_cursors 100
processes 500
open_cursors 800
db_files 600

7 - Documentation / Reference

azure/oracle_manually.txt · Last modified: 2018/09/16 12:42 by gerardnico