Configure Oracle Enterprise Manager 12c on CentOS 6

Share on Social Media

This article is the first part of Oracle Enterprise Manager 12c Cloud Control or OEM12c installation. Here, we will configure an Oracle Database 11g server that will serve as the Oracle Management Repository for Oracle Enterprise Manager Cloud Control 12c on CentOS 6. 

What is Oracle Enterprise Manager 12c?

But first, we would like to briefly define a few terms, that you may encounter in this article frequently. The architecture of the Oracle Enterprise Manager 12c has three distinct components:

  1. the collection agent (Oracle Management Agent or OMA)
  2. the aggregation agent (Oracle Management Server or OMS)
  3. the repository agent (Oracle Management Repository or OMR)

The Oracle Management Agent / OMA runs on the target host and collects information on the hardware, operating system, and applications, which are running on that target host.

The Oracle Management Server / OMS runs on a central server and collects the data generated by multiple Oracle Management Agents / OMAs. The OMS also provides a web interface for monitoring & management of services.

The Oracle Management Repository / OMR is an Oracle Database 11g R2. The OMS pulls the information from multiple OMAs and aggregates the data into the OMR.

System Specification:

We have provisioned a KVM virtual machine with following specifications:

CPU:3.4 Ghz (2 Cores)
Memory:2 GB
Storage:50 GB
Operating System:Centos 6.5 x86_64

We are using the CentOS 6 operating system for Oracle Management Repository 12c. However, you can use any certified distribution of Linux operating system. For installation of CentOS 6, you may follow the installation steps available in our previous article Installation of CentOS 6.3 Server.

We are using the following network settings, you may adjust it according to your environment.

Hostname:omr12c.mydomain.com
IP Address:170.172.0.121/16
Gateway:170.172.0.1
DNS Server:170.172.0.3

Installing Oracle Database 11g R2 on CentOS 6:

We are not using a Private DNS server for our network, therefore, we will configure local DNS resolver as follows.

# cat >> /etc/hosts << EOF
> 170.172.0.121 omr12c.mydomain.com omr12c
> 170.172.0.123 oms12c.mydomain.com oms12c
> EOF

Set the reqiured Linux Kernel’s parameters by executing the following commands.

# cat >> /etc/sysctl.conf << EOF
> fs.file-max = 6815744
> kernel.sem = 250 32000 100 128
> kernel.shmmni = 4096
> kernel.shmall = 1073741824
> kernel.shmmax = 4398046511104
> net.core.rmem_default = 262144
> net.core.rmem_max = 4194304
> net.core.wmem_default = 262144
> net.core.wmem_max = 1048576
> fs.aio-max-nr = 1048576
> net.ipv4.ip_local_port_range = 9000 65500
> EOF
# sysctl –p

Execute following command to set limits for oracle user.

# cat >> /etc/security/limits.conf << EOF
> oracle soft nofile 1024
> oracle hard nofile 65536
> oracle soft nproc 16384
> oracle hard nproc 16384
> oracle soft stack 10240
> oracle hard stack 32768
> EOF

There are some packages required by Oracle Database 11g R2. You can use yum command to install online from Internet, or setup a local yum repository.

Our Linux server is not connected to Internet, neither we have configured any local yum repository, therefore, we are using rpm to install packages from the CentOS 6 installation DVD / ISO.

# rpm -Uvh binutils-2.20.51.0.2-5.36.el6.x86_64.rpm
# rpm -Uvh compat-libcap1-1.10-1.x86_64.rpm
# rpm -Uvh compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm
# rpm -Uvh gcc-4.4.7-4.el6.x86_64.rpm
# rpm -Uvh gcc-c++-4.4.7-4.el6.x86_64.rpm
# rpm -Uvh glibc-2.12-1.132.el6.x86_64.rpm
# rpm -Uvh glibc-devel-2.12-1.132.el6.x86_64.rpm
# rpm -Uvh ksh-20120801-10.el6.x86_64.rpm
# rpm -Uvh libgcc-4.4.7-4.el6.x86_64.rpm
# rpm -Uvh libstdc++-4.4.7-4.el6.x86_64.rpm
# rpm -Uvh libstdc++-devel-4.4.7-4.el6.x86_64.rpm
# rpm -Uvh libaio-0.3.107-10.el6.x86_64.rpm
# rpm -Uvh libaio-devel-0.3.107-10.el6.x86_64.rpm
# rpm -Uvh libXext-1.3.1-2.el6.x86_64.rpm
# rpm -Uvh libXtst-1.2.1-2.el6.x86_64.rpm
# rpm -Uvh libX11-1.5.0-4.el6.x86_64.rpm
# rpm -Uvh libXau-1.0.6-4.el6.x86_64.rpm
# rpm -Uvh libxcb-1.8.1-1.el6.x86_64.rpm
# rpm -Uvh libXi-1.6.1-3.el6.x86_64.rpm
# rpm -Uvh make-3.81-20.el6.x86_64.rpm
# rpm -Uvh sysstat-9.0.4-22.el6.x86_64.rpm
# rpm -Uvh unixODBC-2.2.14-12.el6_3.x86_64.rpm
# rpm -Uvh unixODBC-devel-2.2.14-12.el6_3.x86_64.rpm
# rpm -Uvh elfutils-devel-0.152-1.el6.x86_64.rpm

Following users and groups are required by Oracle Database 11g R2. You can create these users and groups by using following commands.

# groupadd -g 601 oinstall
# groupadd -g 602 dba
# groupadd -g 603 oper
# useradd -u 601 -g oinstall -G dba,oper oracle
# echo "oracle" | passwd oracle –-stdin

I am creating another user for myself to perform DBA tasks.

# useradd -u 603 -g oinstall -G dba,oper ahmer
# echo “123” | passwd ahmer –-stdin

To change SELinux mode to permissive, please execute the following commands.

# sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/sysconfig/selinux
# setenforce permissive

Allow Oracle Listener Port 1521/tcp in Linux Firewall.

# iptables -I INPUT 5 -p tcp --dport 1521 -m state --state NEW,ESTABLISHED -j ACCEPT
# service iptables save

Execute the following command to add PAM configuration.

# cat >> /etc/pam.d/login << EOF 
>session required pam_limits.so
>EOF

Create the ORACLE_BASE directory and change owner to oracle user.

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

Although, CentOS 6 will automatically synchronize time with its NTP Servers, if connected to Internet. But, as we mentioned earlier that our machine is not connected to the Internet. Therefore, we must use our Internal NTP servers for time synchronization. Execute the following commands.

# sed -i 's/^server*/#server/g' /etc/ntp.conf
# cat >> /etc/ntp.conf << EOF
> server 170.172.0.3
> server 170.172.0.2
> EOF
# chkconfig ntpd on
# service ntpd start

Set environment parameters as required by Oracle Database 11g R2.

# su - oracle
$ cat >> ~/.bash_profile << EOF
> ORACLE_BASE=/u01/app/oracle
> ORACLE_SID=omr12c
> export ORACLE_BASE ORACLE_SID
> unset ORACLE_HOME
> unset TNS_ADMIN
> EOF

Execute the ~/.bash_profile to apply the changes to environment.

$ . ~/.bash_profile

Run Installer from the Oracle Database 11g R2 Setup directory. Install the Oracle RDBMS with default options and create a database with name omr12c.

$ ./runInstaller

After installation update the ~/.bash_profile.

$ cat >> ~/.bash_profile << EOF
> if [ $USER = "oracle" ]; then
>  if [ $SHELL = "/bin/ksh" ]; then
>     ulimit -p 16384
>     ulimit -n 65536
>  else
>     ulimit -u 16384 -n 65536
>  fi
> fi
> ORACLE_HOSTNAME=omr12c.mydomain.com
> ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
> export ORACLE_HOSTNAME ORACLE_HOME
> TNS_ADMIN=$ORACLE_HOME/network/admin
> LD_LIBRARY_PATH=$ORACLE_HOME/dbhome_1/lib
> PATH=$PATH:$ORACLE_HOME/bin
> export TNS_ADMIN LD_LIBRARY_PATH PATH
> EOF

Setup auto-start of Oracle Database & Listener:

By default, Oracle Installer do not configure autostart of Database and Listener during system startup. Therefore, we have to create a service script for this purpose.

# su - root
# cat >> /etc/init.d/dbora << EOF
> #!/bin/sh
> # chkconfig: 345 99 10
> # description: Oracle auto start-stop script.
> #
> # Change the value of ORACLE_HOME to specify the correct Oracle home
> # directory for your installation.
> ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
> #
> # Change the value of ORACLE to the login name of the
> # oracle owner at your site.
> # 
> ORACLE_USER=oracle
> PATH=${PATH}:$ORACLE_HOME/bin
> export ORACLE_HOME ORACLE_USER PATH
> #
> case $1 in
> 'start')
>      runuser -l $ORACLE_USER -c '$ORACLE_HOME/bin/dbstart $ORACLE_HOME &' 
>      touch /var/lock/subsys/dbora
>      ;;
> 'stop')
>      runuser -l $ORACLE_USER -c '$ORACLE_HOME/bin/dbshut $ORACLE_HOME' 
>      rm -f /var/lock/subsys/dbora
>      ;;
> *)
>      echo "usage: $0 {start|stop}"
>      exit
>      ;;
> esac
> #
> exit
> EOF
# chmod 750 /etc/init.d/dbora
# chkconfig dbora on
# sed -i 's/:Y/:N/g' /etc/oratab
# reboot

We have successfully installed Oracle Database 11g R2 on CentOS 6.

Configure Oracle Management Repository 12c:

Connect to omr12c database and adjust following system parameters.

$ sqlplus / AS SYSDBA
SQL> ALTER SYSTEM SET processes=300 SCOPE=SPFILE;
SQL> ALTER SYSTEM SET session_cached_cursors=200 SCOPE=SPFILE;
SQL> ALTER SYSTEM SET sga_target=1200M SCOPE=SPFILE;
SQL> ALTER SYSTEM SET shared_pool_size=600M SCOPE=SPFILE;
SQL> ALTER SYSTEM SET pga_aggregate_target=300M SCOPE=SPFILE;
SQL> ALTER SYSTEM SET job_queue_processes=20 SCOPE=SPFILE;
SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP

If you select the option to configure EM during database creation, then you have to remove it now.

SQL>  shutdown immediate;
SQL>  startup restrict;
SQL>  EXEC sysman.emd_maintenance.remove_em_dbms_jobs;
SQL>  EXEC sysman.setEMUserContext('',5);
SQL>  REVOKE dba FROM sysman;
SQL>  DECLARE
SQL>     CURSOR c1 IS
SQL>        SELECT owner, synonym_name name
SQL>        FROM dba_synonyms
SQL>        WHERE table_owner = 'SYSMAN' ;
SQL>  BEGIN
SQL>     FOR r1 IN c1 LOOP
SQL>        IF r1.owner = 'PUBLIC' THEN
SQL>           EXECUTE IMMEDIATE 'DROP PUBLIC SYNONYM '||r1.name;
SQL>        ELSE
SQL>           EXECUTE IMMEDIATE 'DROP SYNONYM '||r1.owner||'.'||r1.name;
SQL>        END IF;
SQL>     END LOOP;
SQL>  END;
SQL>  /
SQL>  DROP USER mgmt_view CASCADE;
SQL>  DROP ROLE mgmt_user;
SQL>  DROP USER sysman CASCADE;
SQL>  ALTER SYSTEM DISABLE RESTRICTED SESSION;
SQL>  exit
$ emca -deconfig dbcontrol db -repos drop

Oracle recommends Redo logfile size for Oracle Management Repository / OMR  to be 300GB.

SQL> ALTER DATABASE ADD LOGFILE ('/u01/app/oracle/oradata/omr12c/redo04a.log','/u01/app/oracle/oradata/omr12c/redo04b.log') size 300M;
SQL> ALTER DATABASE ADD LOGFILE ('/u01/app/oracle/oradata/omr12c/redo05a.log','/u01/app/oracle/oradata/omr12c/redo05b.log') size 300M;
SQL> ALTER DATABASE ADD LOGFILE ('/u01/app/oracle/oradata/omr12c/redo06a.log','/u01/app/oracle/oradata/omr12c/redo06b.log') size 300M;
SQL> ALTER DATABASE DROP LOGFILE GROUP 1;
SQL> ALTER DATABASE DROP LOGFILE GROUP 2;
SQL> ALTER DATABASE DROP LOGFILE GROUP 3;
SQL> ALTER SYSTEM SWITCH LOGFILE;

Conclusion – Oracle Enterprise Manager 12c:

We have successfully configured Oracle Enterprise Manager 12c Repository on CentOS 6 server. Continue reading our next article Configure Oracle Management Server / OMS on CentOS 6.

Scroll to Top