Author Photo

Ahmer's SysAdmin Recipes is a blog for Linux System Administrators. This blog provides recipes for Installation & Configuration of Linux, Ubuntu, Oracle Database, MySQL, Apache, Nginx, Oracle Cloud Control, FreeIPA, Kerberos & OpenLDAP, Subversion, PXE, DevOps, etc. over Red Hat Enterprise Linux (RHEL), CentOS, Ubuntu and Windows.

Please give me your feedback and help me improve this blog. Please let me know If you want me to write on a specific topic.

Thursday, 18 February 2016

Configure Oracle Managment Repository 12c on CentOS 6

Configure Oracle Managment Repository 12c on CentOS 6This article is the first part of Oracle Enterprise Manager Cloud Control 12c 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. But first, we would like to briefly define a few terms, that you may encounter in this article frequently.

The architecture of the OEM12c 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.

To understand concepts and usage of Oracle Enterprise Manager 12c, we recommend you to have Oracle Enterprise Manager 12c Administration Cookbook.

 

System Specification:

We have provisioned a CentOS 6 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 any DNS server for our network, therefore, we will configure local DNS resolver as follows.

[root@omr12c ~]# cat >> /etc/hosts << EOF >170.172.0.121 omr12c.mydomain.com omr12c >170.172.0.123 oms12c.mydomain.com oms12c >EOF

Adjust the reqiured Kernel’s parameters by executing the following commands.

[root@omr12c ~]# 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 [root@omr12c ~]# sysctl –p

Execute following command to set limits for oracle user.

[root@omr12c ~]# 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 CentOS 6 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.

[root@omr12c Packages]# rpm -Uvh binutils-2.20.51.0.2-5.36.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh compat-libcap1-1.10-1.x86_64.rpm [root@omr12c Packages]# rpm -Uvh compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh gcc-4.4.7-4.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh gcc-c++-4.4.7-4.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh glibc-2.12-1.132.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh glibc-devel-2.12-1.132.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh ksh-20120801-10.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh libgcc-4.4.7-4.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh libstdc++-4.4.7-4.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh libstdc++-devel-4.4.7-4.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh libaio-0.3.107-10.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh libaio-devel-0.3.107-10.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh libXext-1.3.1-2.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh libXtst-1.2.1-2.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh libX11-1.5.0-4.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh libXau-1.0.6-4.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh libxcb-1.8.1-1.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh libXi-1.6.1-3.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh make-3.81-20.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh sysstat-9.0.4-22.el6.x86_64.rpm [root@omr12c Packages]# rpm -Uvh unixODBC-2.2.14-12.el6_3.x86_64.rpm [root@omr12c Packages]# rpm -Uvh unixODBC-devel-2.2.14-12.el6_3.x86_64.rpm [root@omr12c Packages]# 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.

[root@omr12c ~]# groupadd -g 601 oinstall [root@omr12c ~]# groupadd -g 602 dba [root@omr12c ~]# groupadd -g 603 oper [root@omr12c ~]# useradd -u 601 -g oinstall -G dba,oper oracle [root@omr12c ~]# echo “oracle” | passwd oracle –-stdin

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

[root@omr12c ~]# useradd -u 603 -g oinstall -G dba,oper ahmer [root@omr12c ~]# echo “123” | passwd ahmer –-stdin

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

[root@omr12c ~]# sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/sysconfig/selinux [root@omr12c ~]# setenforce permissive

Allow Oracle Listener Port 1521 in Linux Firewall.

[root@omr12c ~]# iptables -I INPUT 5 -p tcp --dport 1521 -m state --state NEW,ESTABLISHED -j ACCEPT [root@omr12c ~]# service iptables save

Execute the following command to add PAM configuration.

[root@omr12c ~]# cat >> /etc/pam.d/login << EOF >session required pam_limits.so >EOF

Create the ORACLE_BASE directory and change owner to oracle user.

[root@omr12c ~]# mkdir -p /u01/app/oracle [root@omr12c ~]# chown -R oracle:oinstall /u01/app [root@omr12c ~]# 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.

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

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

[root@omr12c ~]# su - oracle [oracle@omr12c ~]$ 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.

[oracle@omr12c ~]$ . ~/.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.

[oracle@omr12c ~]$ ./runInstaller

After installation update the ~/.bash_profile.

[oracle@omr12c ~]$ 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

 

Create a service to autostart 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.

[root@omr12c ~]# su - root [root@omr12c ~]# 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 [root@omr12c ~]# chmod 750 /etc/init.d/dbora [root@omr12c ~]# chkconfig dbora on [root@omr12c ~]# sed -i 's/:Y/:N/g' /etc/oratab [root@omr12c ~]# reboot

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

 

Configure Oracle Management Repoistory 12c on CentOS 6:

Connect to omr12c database and adjust following system parameters.

[oracle@omr12c ~]$ 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 [oracle@omr12c ~]$ 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;

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

Configure Oracle Managment Repository 12c on CentOS 6


YOU MIGHT ALSO LIKE:

No comments:

Post a Comment