Install Oracle 11g R2 Database On Oracle Linux 6 with EM (Enterprise Manager)

Just go through these steps, you will have Oracle 11GR2 database up and running on Oracle Linux 6.10 with Enterprise Manager (EM)

Note on Oracle version support: Starting with Oracle Database 11g Release 2 (11.2.0.3), Oracle Linux 6 and Red Hat Enterprise Linux 6 are supported on Linux x86 and Linux x86-64. … Starting with Oracle Database 11g Release 2 (11.2.0.4), Oracle Linux 7 and Red Hat Enterprise Linux 7 are supported on Linux x86-64. (link here)

In this serries:

Step 1: Install basic packages

Please make sure that you set the DNS Servers to 8.8.8.8 or sometimes you will get error like this will executing yum command:

# yum -y update
 Loaded plugins: refresh-packagekit, security, ulninfo
 Setting up Update Process
 https://yum.oracle.com/repo/OracleLinux/OL6/UEKR4/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'yum.oracle.com'"
 Trying other mirror.
 Error: Cannot retrieve repository metadata (repomd.xml) for repository: public_ol6_UEKR4. Please verify its path and try again

To fix [Errno 14] PYCURL ERROR 6 – “Couldn’t resolve host ‘yum.oracle.com’ simply check and set your DNS nameserver to 8.8.8.8 and restart server’s network.

Run below commands as root user:

sudo yum install -y wget net-tools telnet curl wget gcc binutils  compat-libstdc++-33 compat-libstdc++-33.i686 gcc-c++ glibc glibc.i686 glibc-devel glibc-devel.i686 ksh libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel libstdc++-devel.i686 libaio libaio-0.3.105 libaio.i686 libaio-devel libaio-devel.i686 libXext libXext.i686 libXtst libXtst.i686 libX11 libX11.i686 libXau libXau.i686 libxcb libxcb.i686 libXi libXi.i686 unixODBC unixODBC-devel zlib-devel elfutils-libelf-devel sysstat make htop ntpdate 

Then:

yum -y update 

Step 2: Download the Oracle database software

You have 2 options to download:

oraerr.com-install-oracle-database-11gr2-oracle-linux-7-download
oraerr.com-install-oracle-database-11gr2-oracle-linux-7-download

After finish downloading you will have 2 or more ZIP files. Unzip all of them to a single directory called database with unzip command.

unzip linux.x64_11gR2_database_1of2.zip 
unzip linux.x64_11gR2_database_2of2.zip 

Step 3: Edit Host file

Edit /etc/hosts file

172.16.23.41 dg9.localdomain dg9

Edit /etc/hostname

dg9.localdomain

Install Oracle Prerequisites

yum install -y oracle-rdbms-server-11gR2-preinstall && yum update -y

Check if the “/etc/sysctl.conf” file is something like this (the number may be differrent because we already run preinstall above. Just a check step:

fs.aio-max-nr = 1048576 
fs.file-max = 6815744 
kernel.shmall = 2097152 
kernel.shmmax = 536870912 
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=1048586 

Step 4: Additional Setup

Edit /etc/selinux/config file:

SELINUX=permissive

Then run the command

setenforce Permissive

Stop and disable FirewallD

service iptables status
service iptables stop
chkconfig iptables off

Create installation directory

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

Add these lines into the end of /home/oracle/.bash_profile file

# Oracle Settings 
TMP=/tmp; 
export TMP TMPDIR=$TMP; 
export TMPDIR ORACLE_HOSTNAME=dg9.localdomain; export ORACLE_HOSTNAME 
ORACLE_UNQNAME=DG9; export ORACLE_UNQNAME 
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE ORACLE_HOME=$ORACLE_BASE/product/11.2.0.1/db_1; export ORACLE_HOME ORACLE_SID=DG9; export ORACLE_SID 
ORACLE_TERM=xterm; export ORACLE_TERM 
PATH=/usr/sbin:$PATH; export PATH 
PATH=$ORACLE_HOME/bin:$PATH; export PATH 
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH 

Step 5: Start the installation

Install XMing and Putty configuration for Windows

If you are using Putty from Windows then first you need to install XMing – an X-Server that starts on top of your desktop. Download Xming and install it. Download PuTTY (if using Windows) and save it on your hard disk.

Start XMing as default.

Start PuTTY. In the PuTTY Configuration section, on the left panel, select Connection → SSH → X11. On the right panel, click on the Enable X11 forwarding checkbox. Set the X display location as :0.0. Enter the hostname or IP address in the Host Name textbox.

oraerr.com-install-oracle-database-11gr2-oracle-linux-7-putty-config
oraerr.com-install-oracle-database-11gr2-oracle-linux-7-putty-config

Now login as oracle user, run the installer. Please remember to run as oracle user and run the install file.

cd database
./runInstaller

You’ll have your X-application runs on your Windows via X11 forwarding configure.

Note: I have a separated post about X11 forwarding configuration here.

Step 6: Some important options while installing

At first step, if you have MOS (My Oracle Support) then fill in. If you don’t, uncheck and press next.

oraerr.com-install-oracle-database-on-ol6.10-setup
oraerr.com-install-oracle-database-on-ol6.10-setup

Next screen

oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-1
oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-1

Choose “Create and configure a database”

oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-2
oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-2

Choose “Server class”

oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-3
oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-3

Then “Single Instance database installation” as we’re not using RAC.

oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-4
oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-4

Choose “Advanced install”

oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-5
oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-5

Choose “Enterprise Edition” depends on your license. No image here means just press NEXT.

oraerr.com-install-oracle-database-on-ol6.10-setup-02
oraerr.com-install-oracle-database-on-ol6.10-setup-02

Leave Oracle Base & Software location default as we set above. Same with Inventory Directory next screen. Choose General Purpose/Transaction Processing on the next screen.

oraerr.com-install-oracle-database-on-ol6.10-setup-03
oraerr.com-install-oracle-database-on-ol6.10-setup-03

Fill db name and SID

It is a very important step. Please remember to use CAPITALIZED words as both 2 names = DG9 (in this case). Because your automatically created spfile will be spfile[SID].ora -> if you stay with uncapitalized words -> file not found at database startup -> need to specify spfile to load manually.

Your EM Configuration file will be:

$ORACLE_HOME/[DB_UNIQUENAME]_[Captialized SID]/

Your spfile will be:

$ORACLE_HOME/dbs/spfile[captitalized SID]

Your OC4J configuration will be:

$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_[DB_UNIQUENAME]_[Capitalized SID]

So, CAPITALIZED both SID & DATABASE NAME + Set both equal to DG9 (same value)

oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-7
oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-7

Configure Memory. Set it to about 70-80% your total Available Memory.

oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-8
oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-8

Character sets

oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-9
oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-9

Set the password

oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-10
oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-10

In the last window, you may need to choose Ignore all checkbox and press Next. In my experience, those library will not affect too much in the operation of the database. Press Finish and wait for Oracle database to be installed on the machine.

oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-11
oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-11

Step 7: Fixing some errors (if any) and finalize installation

Fix invoking “ins_emagent.mk” error

While installing, you will receive some error like error while invoking ins_emagent.mk then edit “$ORACLE_HOME/sysman/lib/ins_emagent.mk” file, change

$(MK_EMAGENT_NMECTL) 

to:

$(MK_EMAGENT_NMECTL) -lnnz11

Fix invoking “ctx/lib/ins_ctx.mk” error

If you get error while invoking “ctx/lib/ins_ctx.mk“, create this fix.sh file as root:

# Fix ctx/lib/ins_ctx.mk
 
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
 
cat << __EOF__ > /tmp/memcpy_wrap.c
#include <stddef.h>
#include <string.h>
 
asm (".symver wrap_memcpy, memcpy@GLIBC_2.14");
void *wrap_memcpy(void *dest, const void *src, size_t n) {
return memcpy(dest, src, n);
}
__EOF__
 
if [[ -e "${ORACLE_HOME}/ctx/lib/ins_ctx.mk" ]]; then
sed -i -e 's/\$(INSO_LINK)/\$(INSO_LINK) -Wl,--wrap=memcpy_wrap \$(ORACLE_HOME)\/ctx\/lib\/memcpy_wrap.o/g' ${ORACLE_HOME}/ctx/lib/ins_ctx.mk
gcc -c /tmp/memcpy_wrap.c -o ${ORACLE_HOME}/ctx/lib/memcpy_wrap.o && rm /tmp/memcpy_wrap.c
fi

Now run this sh file and press RETRY button.

Fix ORA-00845: MEMORY_TARGET not supported on this system

You need to reduce the MEMORY parameter setting.

Fix ORA-19502: write error on file “…” and ORA-27072: File I/O error

You need to free more space on disk. Not enough disk space left for Oracle install. If you don’t see those errors, then congratulation.

Run the script to finalize the install.

oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-12
oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-12

Login to server as root user and run the scripts above. You will have something like this:

[root@dg9 ~]# /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 oracle.
 The execution of the script is complete.
 [root@dg9 ~]# /u01/app/oracle/product/11.2.0.1/db_1/root.sh
 Running Oracle 11g root.sh script…
 The following environment variables are set as:
     ORACLE_OWNER= oracle
     ORACLE_HOME=  /u01/app/oracle/product/11.2.0.1/db_1
 Enter the full pathname of the local bin directory: [/usr/local/bin]:
    Copying dbhome to /usr/local/bin …
    Copying oraenv to /usr/local/bin …
    Copying coraenv to /usr/local/bin …
 Creating /etc/oratab file…
 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.sh script.
 Now product-specific root actions will be performed.
 Finished product-specific root actions.

When the successful dialog appears, press Close button to finish.

oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-13
oraerr.com-install-oracle-database-11gr2-oracle-linux-7-options-13

Now you can access the EM control page from your browser.

https://172.16.23.41:1158/em

You may need to ignore SSL certificate error on your browser. EM will ask you for username/password to login the system. Enter your SYS/Password to login. You will have a webpage like this:

oraerr.com-install-oracle-database-on-ol6.10-setup-05
oraerr.com-install-oracle-database-on-ol6.10-setup-05

You may check/restart/start/stop the EM with those commands:

emctl status dbconsole
emctl start dbconsole
emctl stop dbconsole

Step 8: Schedule Oracle database to start automatically after reboot

Edit the file “/etc/oratab” as follow:

DG9:/u01/app/oracle/product/11.2.0.1/db_1:Y