Sunday, July 15, 2018

Installing Oracle 12c R2 Database Software on Linux 6 and Linux 7


In this article I would explain how to install Oracle 12c R2 database software on Linux 6 and Linux 7. If you want to use ASM as storage and/or Oracle Restart feature, you would need to install 12c R2 Grid Infrastructure before proceeding to install RDBMS software. You must be using at least Linux 6.4 for installation on Linux 6.

There are only a couple of differences between the installation procedure on Linux 6 and Linux 7, which I will explain along the way.

Download the software 
Download 12cR2 Database software.
Release 2 (12.2) can be downloaded from 
www.oracle.com. For this installation I have downloaded latest release available at this time for which downloadable zip file name is linuxx64_12201_database.zip. After downloading, I have copied it under /home/oracle directory.

1)
Make sure you have entries in the /etc/host file for the name resolution.
127.0.0.1   localhost localhost.localdomain localhost
192.231.231.40 salman11.salman.com salman11


2)
Edit /etc/selinux/config and set value for SELINUX to either “permissive” or “disabled”
           SELINUX=permissive


3)
As root user, configure Shared Memory File System. Add following line in /etc/fstab file for shared memory file system. Modify the value of “size” based on the amount of memory you will be using for your SGA
tmpfs                                   /dev/shm                tmpfs   rw,exec,size=8g        0 0


4)
Disable the firewall.
Use following steps for Linux 6
[root@salman11 ~]# service iptables stop
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]

[root@salman1 ~]# chkconfig iptables off

Use following steps for Linux 7
[root@salman11 ~]# systemctl start firewalld.service
[root@salman11 ~]# systemctl stop firewalld.service
[root@salman11~]# systemctl disable firewalld.service
rm '/etc/systemd/system/basic.target.wants/firewalld.service'
rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service' 


5)
Reboot the host (optional)



6)
We can perform automatic configuration of the server using “yum” command. If you want to do manual configuration, skip this step and directly go to next step (step 7).
Automatic configuration would perform following tasks
- Installation of required RPM packages
- Setup kernel parameters in /etc/sysctl.conf file
- Creation of OS groups (oinstall, dba) and OS user (oracle)
- Setting limits for installation user “oracle”

For Oracle Linux, follow the steps mentioned in the following documents to access the online yum repository.
http://public-yum.oracle.com/
[root@salman11 ~]# yum install oracle-database-server-12cR2-preinstall.x86_64 preinstall -y
As already mentioned, above command will install all required packages which are needed for grid infrastructure and/or RDBMS software installation.
I have noticed that even if we do automatic configuration, 32 bit RPM packages still don’t get installed. Check if following 32-bit packages have been installed, and install manually if they are not.
For Linux 6, install following RPMs manually if not already installed.

compat-libstdc++-33-3.2.3-69.el6 (i686)
glibc-2.12-1.7.el6 (i686)
glibc-devel-2.12-1.7.el6 (i686)
libgcc-4.4.4-13.el6 (i686)
libstdc++-4.4.4-13.el6 (i686)
libstdc++-devel-4.4.4-13.el6 (i686)
libaio-0.3.107-10.el6 (i686)
libaio-devel-0.3.107-10.el6 (i686)
libXtst-1.0.99.2 (i686)
libX11-1.5.0-4.el6 (i686)
libXau-1.0.6-4.el6 (i686)
libxcb-1.8.1-1.el6 (i686)
libXi-1.3 (i686)

Example (Checking 32-bit version of glibc-devel). 32-bit version is not installed
[root@salman11 ~]# rpm -q glibc-devel
glibc-devel-2.17-157.el7_3.1.x86_64 (only 64 bit RPM is listed here, it means 32-bit is not installed)

Example (installing 32-bit version of glibc-devel using yum)
[root@salman11 ~]# yum install glibc-devel.i686


For Linux 7, install following RPMs manually if not already installed.
compat-libstdc++-33-3.2.3-71.el7 (i686)
glibc-2.17-36.el7 (i686)
glibc-devel-2.17-36.el7 (i686)
libaio-0.3.109-9.el7 (i686)
libaio-devel-0.3.109-9.el7 (i686)
libX11-1.6.0-2.1.el7 (i686)
libXau-1.0.8-2.1.el7 (i686)
libXi-1.7.2-1.el7 (i686)
libXtst-1.2.2-1.el7 (i686)
libgcc-4.8.2-3.el7 (i686)
libstdc++-4.8.2-3.el7 (i686)
libstdc++-devel-4.8.2-3.el7 (i686)
libxcb-1.9-5.el7 (i686)

Example (Checking 32-bit version of glibc-devel). 32-bit version is not installed
[root@salman11 ~]# rpm -q glibc-devel
glibc-devel-2.17-157.el7_3.1.x86_64

Example (installing 32-bit version of glibc-devel using yum)
[root@salman11 ~]# yum install glibc-devel.i686



If you have performed this step, skip next 3 steps (7, 8, 9) and go to step 10


7)
For Linux 6, install following RPM packages (or latest version) from either yum repository or from Linux 6 media
binutils-2.20.51.0.2-5.36.el6 (x86_64)
compat-libcap1-1.10-1 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (i686)
e2fsprogs-1.41.12-14.el6 (x86_64)
e2fsprogs-libs-1.41.12-14.el6 (x86_64)
glibc-2.12-1.7.el6 (i686)
glibc-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (i686)
ksh
libgcc-4.4.4-13.el6 (i686)
libgcc-4.4.4-13.el6 (x86_64)
libs-1.42.8-1.0.2.el6.x86_64
libstdc++-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (i686)
libstdc++-devel-4.4.4-13.el6 (x86_64)
libstdc++-devel-4.4.4-13.el6 (i686)
libaio-0.3.107-10.el6 (x86_64)
libaio-0.3.107-10.el6 (i686)
libaio-devel-0.3.107-10.el6 (x86_64)
libaio-devel-0.3.107-10.el6 (i686)
libXtst-1.0.99.2 (x86_64)
libXtst-1.0.99.2 (i686)
libX11-1.5.0-4.el6 (i686)
libX11-1.5.0-4.el6 (x86_64)
libXau-1.0.6-4.el6 (i686)
libXau-1.0.6-4.el6 (x86_64)
libxcb-1.8.1-1.el6 (i686)
libxcb-1.8.1-1.el6 (x86_64)
libXi-1.3 (x86_64)
libXi-1.3 (i686)
make-3.81-19.el6
net-tools-1.60-110.el6_2.x86_64 (for Oracle RAC and Oracle Clusterware)
nfs-utils-1.2.3-15.0.1 (for Oracle ACFS)
sysstat-9.0.4-11.el6 (x86_64)
smartmontools-5.43-1.el6.x86_64

Example (yum)
[root@salman1 ~]# yum install glibc
Example (Linux Media)
[root@salman1 ~]# rpm -i glibc
Example (Check after install)
[root@salman1 ~]# rpm -q glibc
glibc-2.12-1.7.el6.x86_64

For Linux 7, install following RPM packages (or latest version) from either yum repository or from Linux 7 media
binutils-2.23.52.0.1-12.el7 (x86_64)
compat-libcap1-1.10-3.el7 (x86_64)
compat-libstdc++-33-3.2.3-71.el7 (i686)
compat-libstdc++-33-3.2.3-71.el7 (x86_64)
glibc-2.17-36.el7 (i686)
glibc-2.17-36.el7 (x86_64)
glibc-devel-2.17-36.el7 (i686)
glibc-devel-2.17-36.el7 (x86_64)
ksh
libaio-0.3.109-9.el7 (i686)
libaio-0.3.109-9.el7 (x86_64)
libaio-devel-0.3.109-9.el7 (i686)
libaio-devel-0.3.109-9.el7 (x86_64)
libX11-1.6.0-2.1.el7 (i686)
libX11-1.6.0-2.1.el7 (x86_64)
libXau-1.0.8-2.1.el7 (i686)
libXau-1.0.8-2.1.el7 (x86_64)
libXi-1.7.2-1.el7 (i686)
libXi-1.7.2-1.el7 (x86_64)
libXtst-1.2.2-1.el7 (i686)
libXtst-1.2.2-1.el7 (x86_64)
libgcc-4.8.2-3.el7 (i686)
libgcc-4.8.2-3.el7 (x86_64)
libstdc++-4.8.2-3.el7 (i686)
libstdc++-4.8.2-3.el7 (x86_64)
libstdc++-devel-4.8.2-3.el7 (i686)
libstdc++-devel-4.8.2-3.el7 (x86_64)
libxcb-1.9-5.el7 (i686)
libxcb-1.9-5.el7 (x86_64)
make-3.82-19.el7 (x86_64)
nfs-utils-1.3.0-0.21.el7.x86_64 (for Oracle ACFS)
net-tools-2.0-0.17.20131004git.el7 (x86_64) (for Oracle RAC and Oracle Clusterware)
smartmontools-6.2-4.el7 (x86_64)
sysstat-10.1.5-1.el7 (x86_64)
Example (yum)
[root@salman1 ~]# yum install glibc
Example (Linux Media)
[root@salman1 ~]# rpm -i glibc
Example (Check after install)
[root@salman1 ~]# rpm -q glibc
glibc-2.17-55.el7.x86_64



Edit /etc/sysctl.conf add following entries to set kernel parameters
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
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 = 1048576
net.ipv4.ip_local_port_range = 9000 65500

Execute following command after adding above lines
/sbin/sysctl –p



8)
Add OS groups and “oracle” user
Add groups
[root@salman11 ~]# groupadd -g 54321 oinstall
[root@salman1 1~]# groupadd -g 54322 dba
[root@salman1 1~]# groupadd -g 54323 oper
Add user
[root@salman11 ~]# useradd -u 54321 -g oinstall -G dba,oper oracle
Set passwords for the oracle user
[root@salman11 ~]# passwd oracle


9)
Create a .conf file (file name can be anything) under /etc/security/limits.d directory to set shell limits for oracle user. For example, create a file oracleusers.conf with following entries.
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728
In case of auto configuration (as mentioned in step 6), a file oracle-database-server-12cR2-preinstall.conf is created under /etc/security/limits.d that contains limits set for user “oracle”.


10)
As per Oracle’s recommendation, we need to
disable Transparent Huge Pages.
Following is official document for this task.
http://docs.oracle.com/database/122/LADBI/disabling-transparent-hugepages.htm#LADBI-GUID-02E9147D-D565-4AF8-B12A-8E6E9F74BEEA


11)
As root user, add following lines in /etc/pam.d/login file if not present already
session required /lib64/security/pam_limits.so
session required pam_limits.so

12)
If you already have configured Deadline IO schedule while Grid Infrastructure installation, you may skip this step.
Oracle recommends using Deadline IO scheduler for optimum performance of ASM disks. Following command will tell if Deadline IO scheduler is already configured or not. Here /sdb/ is the disk (/dev/sdb) I am using for my Oracle database files. You may check for all of your disks that you will be using.
[root@salman11 ~]# cat /sys/block/sdb/queue/scheduler
noop [deadline] cfq

For me, it is already Deadline scheduler configured. If not, following is the procedure to configuring Deadline scheduler as default.
--Create a new rules file
[root@salman11 ~]# vi /etc/udev/rules.d/60-oracle-schedulers.rules

--Add following line into this rules file
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"

--Reload the rules file
[root@salman11 ~]# udevadm control --reload-rules

13)
Add following entry in /home/<username>/.bash_profile file of “oracle” user. At this point, we do no need to set other environment variables i.e. ORACLE_BASE or ORACLE_HOME.
umask 022

14)
As root, create directories and change the ownership to oracle user. If you already have Grid Infrastructure installed, you would already have oracle base directory for GI. Oracle recommends creating separate ORACLE_BASE for GI and RDBMS installations. Hence we need to create a separate ORACLE_BASE for RDBMS installation that will be owned by user “oracle”.  Also create home directory for oracle software.

[root@salman11 ~]# mkdir -p /u01/app/oracle
[root@salman11 ~]# mkdir -p /u01/app/oracle/product/12.2.0/dbhome_1
-- If you have already done Grid Infrastructure installation with “grid” user, then /u01 directory ownership would already be given to “grid”. In that case, change ownership of only /u01/app/oracle directory to “oracle” user.
If you have not already installed GI, then you can change ownership of /u01 directory to oracle.


[root@salman11 ~]# chown -R oracle:oinstall /u01/app/oracle

15)
I have realized that automatic configuration (in step 6 above) did not create SYSOPER group “oper”. This I need to create this group myself and make “oracle” user member of this. Secondly, oracle user should also be member of OS group called “asmdba” (in case you are using ASM).
[root@salman11 ~]# groupadd -g 54323 oper
[root@salman11 ~]# usermod oracle -G dba,oper,asmdba

[root@salman11 ~]# su - oracle
Last login: Wed Mar 22 10:43:14 SGT 2017 on pts/2
[oracle@salman11 ~]$ id
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54325(asmdba) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

Note once again that if you are using ASM, also make sure that oracle user is member of ASMDBA group as this is required to access ASM diskgroups. That’s why you see “asmdba” group in above command.


16)
Now I would start installation by extracting the downloaded zip file. I will extract the zip file under /home/oracle/ directory. After extracting, /home/oracle/database directory would contain extracted software form where I would initiate the installer.
[oracle@salman11 ~]$ cd /home/oracle
[oracle@salman11 ~] unzip linuxx64_12201_database.zip

Now log in as oracle user using Linux desktop, or you may also use any X server software. Start setup by executing runInstaller
$ cd /home/oracle/database
$ ./runInstaller

17)
Uncheck the checkbox and click Next

Installing oracle database 12c r2 on Linux wizard screen 1




























18)
I am selecting second option here as I want to install software only. Creation of database can be done later after the installation.

Installing oracle database 12c r2 on Linux wizard screen 2




























19)
Click Next
Installing oracle database 12c r2 on Linux wizard screen 3





























20)
Select the edition you want to install, click Next

Installing oracle database 12c r2 on Linux wizard screen 4



























21)
Provide oracle base and oracle home directories that we have already created above, click Next.

Installing oracle database 12c r2 on Linux wizard screen 5




























22) 
Click Next

Installing oracle database 12c r2 on Linux wizard screen 6




























23)
Click Install from this screen to begin the installation.

Installing oracle database 12c r2 on Linux wizard screen 7





























24)
Execute root.sh script as root from a separate command line window, when prompted. If this is first ever oracle installation on this server, you may also need to run orainstRoot.sh script as well. Click OK from the dialogue box after execution of the script completes.
Installing oracle database 12c r2 on Linux wizard screen 8





























25)
Click Close to close the installation wizard.

Installing oracle database 12c r2 on Linux wizard screen 9




























Database software has been installed. Now you can procced to the database creation using DBCA.

26)
You can add following environment variables in .bash_profile file.
ORACLE_SID=<your SID name>; export ORACLE_SID
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1; export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH; export PATH

No comments:

Post a Comment

Popular Posts - All Times