Tuesday, July 23, 2013

Installing Oracle Enterprise 11g R2

Tested with: Fedora 18 / 19


Based on:


http://www.oracle-base.com/articles/11g/oracle-db-11gr2-installation-on-fedora-17.php

http://www.habitualcoder.com/?p=248


A. Get the files:


http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

B. Install required packages:


#---
yum -y install \
ksh \
xterm \
unzip \
binutils \
compat-libstdc++-33 \
compat-libstdc++-33.i686 \
elfutils-libelf \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc \
glibc.i686 \
glibc-common \
glibc-devel \
glibc-headers \
glibc-devel.i686 \
ksh \
libaio \
libaio.i686 \
libaio-devel \
libaio-devel.i686 \
libgcc \
libgcc.i686 \
libstdc++ \
libstdc++.i686 \
libstdc++-devel \
make \
numactl \
numactl-devel \
sysstat \
unixODBC \
unixODBC.i686 \
unixODBC-devel \
unixODBC-devel.i686 \
glibc-static.x86_64 \
glibc-static.i686
#---

C. Prepare environment:


1. Create user and groups:

#---
groupadd oinstall
groupadd dba
groupadd oper
groupadd asmadmin

useradd -g oinstall -G dba,oper,asmadmin oracle
#---

2. Create directories:

#---
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01
#---

3. Mimic a Red Hat box:


#---
cp /etc/redhat-release /etc/redhat-release.orig.`date +"%Y-%m-%d"`
#---

#---
cat > /etc/redhat-release << __END__
redhat release 5
__END__
#---

4. Set up kernel parameters:


#---
cat >> /etc/sysctl.conf << __END__
########################################
# Oracle setup
########################################
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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
########################################
__END__
#---

5. Add security resource limits for oracle user:


#---
cat >> /etc/security/limits.conf << __END__
########################################
# Oracle setup
########################################
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
########################################
__END__
#---

6. Add limits to PAM:


#---
cat >> /etc/pam.d/login << __END__
########################################
# Oracle setup
########################################
session required pam_limits.so
########################################
__END__
#---

7. Disable SELinux


Edit /etc/selinux/config and set it to (you need to reboot to take effect):

SELINUX=disabled

D. Preprare remote access to your X11 session:


http://gka-linux.blogspot.com.br/2013/07/enabling-remote-x11-access.html

E. Setup the oracle user:


1. Become oracle:

#---
su - oracle
#---

2. Setup the environment variables:

#---
cat >> ${HOME}/.bash_profile << __END__
########################################
# Oracle setup
########################################
export TMP=/tmp
export TMPDIR=/tmp

export ORACLE_HOSTNAME=localhost
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\${ORACLE_BASE}/product/11.2.0/db_1
export ORACLE_SID=orcl
export ORACLE_TERM=xterm
export ORACLE_INSTANT_CLIENT=/usr/lib/oracle/11.2/client64
export PATH=\${ORACLE_HOME}/bin:\${PATH}:/usr/sbin:\${HOME}/.local/bin:\${HOME}/bin:\${ORACLE_INSTANT_CLIENT}/bin

export LD_LIBRARY_PATH=\${ORACLE_HOME}/lib:/lib:/usr/lib:\${LD_LIBRARY_PATH}:\${ORACLE_INSTANT_CLIENT}/lib
export CLASSPATH=\${ORACLE_HOME}/JRE:\${ORACLE_HOME}/jlib:\${ORACLE_HOME}/rdbms/jlib:\${ORACLE_INSTANT_CLIENT}/lib

if [ oracle = "oracle" ]; then
if [ /bin/bash = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
########################################
 
__END__
#---

2.1. For any developer user you might need to add the following to their environment:

#---
cat >> ${HOME}/.bash_profile << __END__
########################################
# Oracle setup
########################################
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\${ORACLE_BASE}/product/11.2.0/db_1
export ORACLE_SID=orcl
export ORACLE_INSTANT_CLIENT=/usr/lib/oracle/11.2/client64
export PATH=\${ORACLE_HOME}/bin:\${PATH}:/usr/sbin:\${HOME}/.local/bin:\${HOME}/bin:\${ORACLE_INSTANT_CLIENT}/bin

export LD_LIBRARY_PATH=\${ORACLE_HOME}/lib:/lib:/usr/lib:\${LD_LIBRARY_PATH}:\${ORACLE_INSTANT_CLIENT}/lib
export CLASSPATH=\${ORACLE_HOME}/JRE:\${ORACLE_HOME}/jlib:\${ORACLE_HOME}/rdbms/jlib:\${ORACLE_INSTANT_CLIENT}/lib
########################################
 
__END__
#---

3. Make profile effective:


#---
source $HOME/.bash_profile
#---

3.1. Check it, if not effective, logout and in again


#---
echo $ORACLE_SID
#---

Expected:
orcl

F. Install:


1. Unzip packages, which I assume are in the $HOME from oracle user:


#---
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
#---

2. Run install script:


2.1. Do NOT forget to allow the oracle host to connect remotely to your X11

xhost +<oracle host>

2.2. Do NOT forget to export the DISPLAY variable:

export DISPLAY=<Host running X11>:0.0

2.3. If it is the same host:

On your REGULAR account:
#---
xhost +localhost
#---

On the ORACLE user shell:
#---
export DISPLAY=localhost:0.0
#---

2.4. Install

#---
cd database
./runInstaller
#---

3. It will fail in 2 situations, follow instructions at:


http://www.habitualcoder.com/?p=248

G. Post install:


1. Restore /etc/redhat-release to the original value: 

#---
# It only works if you did C.3. on the same date as the restore
cp /etc/redhat-release.orig.`date +"%Y-%m-%d"` /etc/redhat-release
#---


2. Execute the post install scripts:

#---
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/db_1/root.sh
#---


3. Edit /etc/oratab to the following:

orcl:/u01/app/oracle/product/11.2.0/db_1:Y

4. Start Oracle (as oracle):

Listeners:
#---
lsnrctl start
#---


Database:
#---
sqlplus / as sysdba << EOF
STARTUP;
EXIT;
EOF
#---





Enabling remote X11 access


Tested with: Fedora 18 and 19

A. Enable overall access (Fedora 19 only)

Edit file:




/lib/systemd/system/initial-setup-graphical.service

Remove or comment out the daemon blocking argument, it should look like:

ExecStart=/bin/xinit /bin/firstboot-windowmanager /bin/initial-setup -- /bin/Xorg :9 -ac #-nolisten tcp

B. Enable at the display manager, in my case LightDM:


/etc/lightdm/lightdm.conf

Must include the following parameters under the following sessions:

...
[SeatDefaults]
xserver-allow-tcp=true
...
[security]
DisallowTCP=false
...

C. Restart the DM:


#---
systemctl restart lightdm.service
#---

D. Verify if it is up:


#---
netstat -nl | grep :6000
#---

Expected:
tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN
tcp6 0 0 :::6000 :::* LISTEN

E. Open up firewalld:


https://fedoraproject.org/wiki/FirewallD?rd=FirewallD/#Permanent_and_Temporary_Configuration

F. Add to connecting host:


#---
xhost +<remote host trying to use your X11>
#---


G. (On the remote host) Inform where the X11 is:


#---
export DISPLAY=<your running X11 hostname>:0.0
#---


H. (On the remote host) Test it:

#---
zenity --info --text="OK: `hostname`"
#---