Tuesday, 20 October 2015

Install OEM on a virtualBox using Oracle Linux 6

Steps:
1.install Oracle VirtualBox
2.Setup a virtual machine with 4-6 GB
3.Install Linux Software - ISO
4.Update kernel
#  yum install oracle-rdbms-server-11gR2-preinstall
5.Prepare the environment to install OEM repository Database
a).Check for updates (this will take a while to refresh):
# yum update
b).Create group and user
groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 503 oper
useradd -u 1100 -g oinstall -G dba,oper oracle
c).Create Passwd for oracle user
passwd oracle
d).Create Directories
mkdir -p /u01/app/oracle
mkdir -p /u01/tmp
chown -R oracle:oinstall /u01/
chmod -R 755 /u01/
e).Change the /etc/security/limits.conf file and add;
oracle   soft   nofile    4096
f).Change the  /etc/security/limits.d/90-nproc.conf
  -- Change this line
                *           soft    nproc    1024
--add this instead  this
                *          -       nproc    16384
g).Disable secure linux by editing the "/etc/selinux/config
vim /etc/selinux/config
--change line
              SELINUX=enforcing
--to this
              SELINUX=disabled
h).Disable Firewall
# service iptables save
# service iptables stop
# chkconfig iptables off
i).Add IP's to the hosts file
vim /etc/hosts
192.168.136.131     db.db.com      db          --the db repostory
192.168.136.138     upgrade         upgrade  --the OEM
j).Add the following lines to the “vim /etc/security/limits.conf” file.
oracle              soft     nproc   2047
oracle              hard    nproc   16384
oracle              soft     nofile   4096
oracle              hard    nofile   65536
oracle              soft     stack    10240
k).Add or amend the following lines to the “/etc/sysctl.conf” file
fs.aio-max-nr = 1048576
fs.file-max = 6815744
 kernel.shmall = 2097152
#kernel.shmmax = 1054504960
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
l).Run the following command to change the current kernel parameters
 /sbin/sysctl –p
m).Add this to the vim /etc/pam.d/login
 session    required     pam_limits.so
n).Login as Oracle User and update .bash_profile variables
$ vim .bash_profile
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/sqldeveloper/sqldeveloper  /bin:$ORACLE_HOME/jdk/bin
export PATH
ORACLE_SID=dblab
ORACLE_BASE=/u01/app/oracle
export ORACLE_BASE ORACLE_SID TMPDIR TMP
LD_LIBRARY_PATH=$ORACLE_HOME/bin:$ORACLE_HOME/lib:$ORACLE_HOME/jdbc/lib
export LD_LIBRARY_PATH
NLS_DATE_FORMAT='DD-MON-YY HH24:MI:SS'
export NLS_DATE_FORMAT
set -o vi
EDITOR=vim
export EDITOR
ORAENV_ASK=NO
#. oraenv
o).Copy  binaries ,unzip and run the Installer to create the OMR - Oracle Management Repostory
               ./runInstaller

Run NETCA and make listener static after its complete
$netca

SID_LIST_LISTENER =
           (SID_LIST =
             (SID_DESC =
               (GLOBAL_DBNAME = dblab.world)
               (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
               (SID_NAME = dblab)
             )
           )
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = LISTENER))
      (ADDRESS = (PROTOCOL = TCP)(HOST =192.168.56.4)(PORT = 1521))
    )
  )
#ADR_BASE_LISTENER = /u01/app/oracle

Run DBCA to create database
$dbca 

Check if the Listener is UP (MUST be up and the database as well)
$lsnrctl status
$snrctl start

On the Repository-OMR
 sqlplus / AS SYSDBA
ALTER SYSTEM SET processes=300 SCOPE=SPFILE;
ALTER SYSTEM SET session_cached_cursors=200 SCOPE=SPFILE;
ALTER SYSTEM SET sga_target=2G SCOPE=SPFILE;
ALTER SYSTEM SET shared_pool_size=600M SCOPE=SPFILE;
ALTER SYSTEM SET pga_aggregate_target=1G SCOPE=SPFILE;
ALTER SYSTEM SET job_queue_processes=20 SCOPE=SPFILE;

 
Restart the instance
shu imediate
startup 

INSTALL OMS -Oracle Management Service
6.Install Linux software,update Kernel and set up the files as required for a standard installation---As above
7.Create groups and user
groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 503 oper
useradd -u 1100 -g oinstall -G dba,oper oracle
8. Create Passwd for oracle user
passwd oracle
9.set .bash_profile variables for user Oracle
vim .bash_profile

OMS_HOME=/u01/app/oracle/oms12cr4; export OMS_HOME
AGENT_BASE=/u01/app/oracle/agent_base; export AGENT_BASE
export PATH
set -o vi
EDITOR=vim
export EDITOR
ORAENV_ASK=NO
#. oraenv
10.Create Directories
$ mkdir -p /u01/app/oracle/oms12cr4
$ mkdir -p /u01/app/oracle/agent_base

11.Download the OEM binaries from oracle: em12104_linux64_disk1, em12104_linux64_disk2, em12104_linux64_disk3, copy the binaries and unzip to install
$ mkdir em12cr4
$ unzip -d em12cr4 em12104_linux64_disk1.zip
$ unzip -d em12cr4 em12104_linux64_disk2.zip
$ unzip -d em12cr4 em12104_linux64_disk3.zip
$ cd em12cr4

12.Run the installer
$ ./runInstaller
13.a) Deconfigure/Drop  the EM from the repostory-- for single instance  ON THE DATABASE
cd $ORACLE_HOME/bin
$./emca -deconfig dbcontrol db -repos drop -SYS_PWD  xxxxxx  -SYSMAN_PWD  xxxxxx
 b)Deconfigure/Drop  the EM from the repostory-- for RAC database
cd $ORACLE_HOME/bin
$./emca -deconfig dbcontrol db -repos drop -cluster -SYS_PWD xxxxxx -SYSMAN_PWD xxxxxx
 
 14.Redirect Management Agent to another host
--View OEM version
Setup menu, select Manage Cloud Control, then select Management Services.
Setup menu, select Extensibility, then select Plug-ins.
15.Add TARGET  & Discover

Add target
setup>add target manually>add host>+add>enter ipadd or domain for the host-eg 192.168.136.134> select platform/os
the host run-if not available download>click next>enter the agent_base directory-/u01/app/oracle/agent_base >+add user
credentials- use OS user eg: user:oracle,pass:oracle123(go to the db:/etc/sudoers & add oracle ALL=(ALL) ALL> next>click deploy

--Discover targets
setup>add target manually>select agent type>oracle database,listener,automatic storage management>click add using guided process>discover
the target>click search and select the host to discover from the list>click next>select target,enter password for user DBSNMP-if the user
is locked,go to the db and unlock>next to discover


Installation snapshots at a glance

Installation Details








UPGRADE Enterprise Manager 12c Cloud Control from 12.1.0.3 to 12.1.0.5

NB: Kindly note that the Repository DB  and OEM is ready installed and running

Environments: Repos db                  OEM  
 Repo_host: db.db.com                       Hostname:upgrade.db.com
 Repos_sid: DBLAB                        

--check if SYSMAN and DBSNMP has execute privilege to DBMS_RANDOM package and
--PUBLIC role has NO access to DBMS_RANDOM


SQL> GRANT EXECUTE ON dbms_random TO dbsnmp;
SQL> GRANT EXECUTE ON dbms_random TO sysman;
SQL> REVOKE EXECUTE ON dbms_random FROM public;

--Run emctl to copy EMKey from emkey.ora file to the management repository database

./emctl config emkey -copy_to_repos_from_file -repos_host db.db.com -repos_port 1521 -repos_sid DBLAB -repos_user sysman -emkey_file $OMS_HOME/sysman/config/emkey.ora

--check for invalid packages on repository database

SELECT owner, object_name, object_type,status FROM   dba_objects WHERE  status = 'INVALID' AND owner IN ('SYS', 'SYSTEM', 'SYSMAN', 'MGMT_VIEW', 'DBSNMP', 'SYSMAN_MDS');

--Compile invalid objects

SQL> EXEC UTL_RECOMP.recomp_serial('SYS');
SQL> EXEC UTL_RECOMP.recomp_serial('DBSNMP');
SQL> EXEC UTL_RECOMP.recomp_serial('SYSMAN');

--Stop the OMS

cd $OMS_HOME/oms/bin
./emctl stop oms -all

----INCASE of ERROR : Insufficient privileges to access Database Vault features

1.SQL> GRANT SELECT_CATALOG_ROLE to sys;
2.--Stop the database, Database Control console process, and listener
                               $ sqlplus sys as sysdba
                               SQL> shu immediate                       
                               $ emctl stop dbconsole
                               $ lsnrctl stop
3.--For Oracle RAC installations, shut down each database instance as follows:
                              $ srvctl stop database -d db_name
4.--Disable the Oracle Database Vault option --on the repostory DB
                             cd $ORACLE_HOME/rdbms/lib
                             $ make -f ins_rdbms.mk dv_off
                             $ cd $ORACLE_HOME/bin
                             relink all
5.--After the above is completed run;
                             $ chopt disable dv
6.--Stop the  listener ,database and the Database Control console process
                             $ lsnrctl start
                             $ sqlplus sys as sysdba
                             SQL> startup
                             $ emctl start dbconsole
---INCASE of  processes ERROR: run the alter statements and proceed
  sqlplus / as sysdba
  ALTER SYSTEM SET processes=300 SCOPE=SPFILE;
  ALTER SYSTEM SET session_cached_cursors=200 SCOPE=SPFILE;
  ALTER SYSTEM SET sga_target=2G SCOPE=SPFILE;
  ALTER SYSTEM SET shared_pool_size=600M SCOPE=SPFILE;
  ALTER SYSTEM SET pga_aggregate_target=1G SCOPE=SPFILE;
  ALTER SYSTEM SET job_queue_processes=20 SCOPE=SPFILE;

--UPGRADE AGENT after a sucessiful upgrade --on the Console

Setup>cloud control>agent upgade task> select the agents you want to upgrade>next>......>click done
Setup>cloud control>post >agent upgade task>select the agents from the list>click submit

--Before upgrade

[oracle@upgrade bin]$ ./emctl status agent
Oracle Enterprise Manager Cloud Control 12c Release 3
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
Agent Version     : 12.1.0.3.0
OMS Version       : 12.1.0.3.0
Protocol Version  : 12.1.0.1.0

Agent Home        : /u01/app/oracle/agent_base/agent_inst
Agent Binaries    : /u01/app/oracle/agent_base/core/12.1.0.3.0
Agent Process ID  : 3187
Parent Process ID : 3140
Agent URL         : https://upgrade.db.com:3872/emd/main/
Repository URL    : https://upgrade.db.com:4904/empbs/upload
Started at        : 2015-10-15 17:25:59
Started by user   : oracle
Last Reload       : (none)
Last successful upload                       : 2015-10-15 21:48:21
Last attempted upload                        : 2015-10-15 21:48:21
Total Megabytes of XML files uploaded so far : 0.43
Number of XML files pending upload           : 0
Size of XML files pending upload(MB)         : 0
Available disk space on upload filesystem    : 45.06%
Collection Status                            : Collections enabled
Heartbeat Status                             : Ok
Last attempted heartbeat to OMS              : 2015-10-15 21:54:25
Last successful heartbeat to OMS             : 2015-10-15 21:54:25
Next scheduled heartbeat to OMS              : 2015-10-15 21:55:25

---------------------------------------------------------------

--After upgrade

[oracle@upgrade bin]$ ./emctl status agent
Oracle Enterprise Manager Cloud Control 12c Release 5
Copyright (c) 1996, 2015 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
Agent Version          : 12.1.0.5.0
OMS Version            : 12.1.0.5.0
Protocol Version       : 12.1.0.1.0

Agent Home             : /u01/app/oracle/agent_base/agent_inst
Agent Log Directory    : /u01/app/oracle/agent_base/agent_inst/sysman/log
Agent Binaries         : /u01/app/oracle/agent_base/core/12.1.0.5.0
Agent Process ID       : 18623
Parent Process ID      : 18579
Agent URL              : https://upgrade.db.com:3872/emd/main/
Local Agent URL in NAT : https://upgrade.db.com:3872/emd/main/
Repository URL         : https://upgrade.db.com:4904/empbs/upload
Started at             : 2015-10-16 08:04:03
Started by user        : oracle
Operating System       : Linux version 3.8.13-16.2.1.el6uek.x86_64 (amd64)
Last Reload            : 2015-10-16 08:06:49
Last successful upload                       : 2015-10-16 08:49:38
Last attempted upload                        : 2015-10-16 08:49:38
Total Megabytes of XML files uploaded so far : 0.29
Number of XML files pending upload           : 0
Size of XML files pending upload(MB)         : 0
Available disk space on upload filesystem    : 47.48%
Collection Status                            : Collections enabled
Heartbeat Status                             : Ok
Last attempted heartbeat to OMS              : 2015-10-16 08:53:20
Last successful heartbeat to OMS             : 2015-10-16 08:53:20
Next scheduled heartbeat to OMS              : 2015-10-16 08:54:20

---------------------------------------------------------------
Agent is Running and Ready
Have fun and learn more !!!