DB-hub Technology Oracle Lab – OEM Installation 13.2

Oracle Lab – OEM Installation 13.2

1.系统设置

1.1.内核参数

vi /etc/sysctl.conf

kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128

fs.aio-max-nr = 1048576
fs.file-max = 6815744

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 = 1048576
net.ipv4.ip_local_port_range = 11000 65000

sysctl -p

然后重启网络服务:

service network restart

If you are installing OMS and Management Repository (database) on the same host, which is running on a Linux operating system (32-bit or 64-bit), then set the kernel.shmmax parameter to a value prescribed in the Oracle Database Installation Guide that is published for the intended database release and platform.

If you are installing OMS and Management Repository (database) on different hosts, which are running on Linux operating systems (32-bit or 64-bit), then on the OMS host, set the kernel.shmmax parameter to a value 1 byte less than 4 GB or 4294967295.

如果OMS 和 Management Repository(database) 在不同的主机上,那么OMS的主机kernel.shmmax 参数设置为小于4G或者4294967295。 直接修改/etc/sysctl.conf 文件修改,然后运行sysctl –p 生效即可。

如果OMS和Management Repository(database) 在同一个主机上,那么kernel.shmmax 参数以Oracle 数据库文档要求的为准。

To verify the value assigned to the kernel.shmmax parameter, run the following command:

    cat /proc/sys/kernel/shmmax
To set the value for kernel.shmmax parameter, do the following:
  1. Log in as root.

  2. Open the /etc/sysctl.conf file.

  3. Set the kernel.shmmax parameter to 4294967295.

By setting the value in the /etc/sysctl.conf file, the value persists even when you restart the system. On SUSE Linux Enterprise Server systems, run the following command to ensure that the system reads the /etc/sysctl.conf file when it restarts:

#/sbin/chkconfig boot.sysctl on

  1. Run the following command to change the current values of the kernel parameters. Review the output and verify that the values are correct. If the values are incorrect, edit the /etc/sysctl.conf file, then run this command again.

# /sbin/sysctl -p

  1. Enter the command /sbin/sysctl -a to confirm that the values are set correctly.

  2. After updating the values of the kernel parameters in the /etc/sysctl.conf file, either restart the host, or run the command sysctl -p to make the changes in the /etc/sysctl.conf file available in the active kernel memory.

1.2.UDP和TCP内核参数

[root@oem rlwrap-0.43]# cat /proc/sys/net/ipv4/ip_local_port_range
32768   61000
[root@oem rlwrap-0.43]# echo 11000 65000 > /proc/sys/net/ipv4/ip_local_port_range
[root@oem rlwrap-0.43]# cat /proc/sys/net/ipv4/ip_local_port_range
11000   65000

If necessary, update the UDP and TCP ephemeral port range to a range high enough for anticipated system workloads, and to ensure that the ephemeral port range starts at 11,000 and above.

1.3./etc/security/limits.conf

vi /etc/security/limits.conf

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768

1.4./etc/profile

vi /etc/profile

if [ #USER = "oracle" ] ; then
    if [ $SHELL = "/bin/ksh" ] ; then
        ulimit -p 16384
        ulimit -n 65536
    else
        ulimit -u 16384 -n 65536
    fi
    umask 022
fi

1.5.Prepare directory

mkdir -p /oracle/app/oracle/oem/middleware
mkdir -p /oracle/app/oracle/oem/agent

1.6.AGENT_HOME and OMS_HOME

export OMS_HOME=/oracle/app/oracle/oem/middleware
export AGENT_HOME=/oracle/app/oracle/oem/agent/agent_13.2.0.0.0

2.创建数据库

2.1.dbca-GUI (OPTION 1)

选择Advanced configuration
Global database name and SID: OEMREPO
不要选择Specify_Fast Recovery Area
不要选择Enable archiving
不要选择Configure Enterprise Manager(EM) database express

2.2.dbca-GUI (OPTION 2)

dbca -silent -createDatabase \
  -templateName General_Purpose.dbc \
  -responseFile NO_VALUE \
  -gdbname OEMREPO \
  -sid OEMREPO \
  -databaseConfigType SINGLE \
  -sysPassword oracle \
  -systemPassword oracle \
  -emConfiguration NONE \
  -storageType FS \
     -datafileDestination /oradata/data \
  -enableArchive false \
  -characterSet AL32UTF8 \
  -nationalCharacterSet AL16UTF16 \
  -sampleSchema false \
  -automaticMemoryManagement false \
  -totalMemory 1024 \
  -dbOptions 'JSERVER:true,ORACLE_TEXT:true,IMEDIA:false,SPATIAL:false,CWMLITE:false,APEX:false,OMS:false,DV:false,SAMPLE_SCHEMA:false' \
  -ignorePrereqFailure \
  -variables 'DB_NAME=OEMREPO,DB_UNIQUE_NAME=OEMREPO,ORACLE_BASE=/oracle/app/oracle,ORACLE_HOME=/oracle/app/oracle/product/19.3' \
  -initParams 'DB_NAME=OEMREPO,DB_UNIQUE_NAME=OEMREPO,nls_language=AMERICAN,nls_territory=AMERICA,processes=150,open_cursors=150'

-- If you want to re-do, delete the database with this command
dbca -silent -deleteDatabase -sourceDB OTTER -sysDBAUserName sys -sysDBAPassword oracle

2.3.修改数据库参数

#alter system set optimizer_adaptive_features=false scope=both sid='*';
alter system set processes=600 scope=spfile;
alter system set session_cached_cursors=300 scope=spfile;
alter system set sga_max_size=5G scope=spfile;
alter system set sga_target=5G scope=spfile;
alter system set shared_pool_size=600M scope=spfile;
alter system set pga_aggregate_target=2g scope=spfile;
alter system set shared_pool_size=1G scope=spfile;
alter system set "_allow_insert_with_update_check"=TRUE;

alter system set "_optimizer_nlj_hj_adaptive_join"= FALSE scope=both;
alter system set "_optimizer_strans_adaptive_pruning" = FALSE scope=both;
alter system set "_px_adaptive_dist_method" = OFF scope=both;
alter system set "_sql_plan_directive_mgmt_control" = 0 scope=both;
alter system set "_optimizer_dsdir_usage_control" = 0 scope=both;
alter system set "_optimizer_use_feedback" = FALSE scope=both;
alter system set "_optimizer_gather_feedback" = FALSE scope=both;
alter system set "_optimizer_performance_feedback" = OFF scope=both;

optimizer_adaptive_features参数在OLAP数据仓库环境中可以获得较好的效果,实际在OLTP系统上,可以关闭这项新功能。
其主要功能是为了在语句执行过程中实时收集表的统计信息,方便Oracle选择更准确的执行计划。
但是,这个功能在RAC非常损耗性能,因为它需要查找全局视图gv$sql的数据,在多个实例的情况下会进行并发执行。
optimizer_adaptive_features这个参数在版本12.2已经过期。

memory_target至少4G
session_cached_cursors 200到500之间
shared_pool_size 600M, 或者1/3 sga_target

2.4.修改Online redo log

需要至少4组redo log:

col member for a35
SQL> select group#,type,member from  v$logfile;

    GROUP# TYPE    MEMBER
---------- ------- -----------------------------------
         3 ONLINE  /oradata/data/OEMREPO/redo03.log
         2 ONLINE  /oradata/data/OEMREPO/redo02.log
         1 ONLINE  /oradata/data/OEMREPO/redo01.log
SQL> select group#,thread#,sequence#,status,bytes/1024/1024 from v$log;

    GROUP#    THREAD#  SEQUENCE# STATUS           BYTES/1024/1024
---------- ---------- ---------- ---------------- ---------------
         1          1          4 INACTIVE                     200
         2          1          5 CURRENT                      200
         3          1          3 INACTIVE                     200

常用命令:

alter database drop logfile group 2;
alter system switch logfile;
alter database clear unarchived logfile group 3;
alter database add logfile group 4('/oradata/data/OEMREPO/redo04.log') size 512M;

select group#,type,member from  vlogfile;
select group#,thread#,sequence#,status,bytes/1024/1024 from vlog;

重启数据库

shutdown immediate
startup
SQL> select group#,thread#,sequence#,status,bytes/1024/1024 from v$log;

    GROUP#    THREAD#  SEQUENCE# STATUS           BYTES/1024/1024
---------- ---------- ---------- ---------------- ---------------
         1          1         15 CURRENT                      512
         2          1         13 ACTIVE                       512
         3          1         14 ACTIVE                       512
         4          1         12 ACTIVE                       512

3.安装Enterprise Manager

3.1.启动安装程序

[oracle@oem:/home/oracle/OEM]ls -l

[oracle@oLinux189:/home/oracle/OEM]ls -l
total 7727644
-rw-r--r--. 1 oracle oinstall 2118110455 Apr 23 14:04 em13200_linux64-2.zip
-rw-r--r--. 1 oracle oinstall  553563556 Apr 23 13:57 em13200_linux64-3.zip
-rw-r--r--. 1 oracle oinstall 2084299941 Apr 23 14:07 em13200_linux64-4.zip
-rw-r--r--. 1 oracle oinstall 2128070240 Apr 23 14:10 em13200_linux64-5.zip
-rw-r--r--. 1 oracle oinstall  474441637 Apr 23 14:08 em13200_linux64-6.zip
-rw-r--r--. 1 oracle oinstall  554607894 Apr 23 14:10 em13200_linux64.bin
[oracle@oLinux189:/home/oracle/OEM]chmod u+x em13200_linux64.bin
[oracle@oLinux189:/home/oracle/OEM]ls -l
total 7727644
-rw-r--r--. 1 oracle oinstall 2118110455 Apr 23 14:04 em13200_linux64-2.zip
-rw-r--r--. 1 oracle oinstall  553563556 Apr 23 13:57 em13200_linux64-3.zip
-rw-r--r--. 1 oracle oinstall 2084299941 Apr 23 14:07 em13200_linux64-4.zip
-rw-r--r--. 1 oracle oinstall 2128070240 Apr 23 14:10 em13200_linux64-5.zip
-rw-r--r--. 1 oracle oinstall  474441637 Apr 23 14:08 em13200_linux64-6.zip
-rwxr--r--. 1 oracle oinstall  554607894 Apr 23 14:10 em13200_linux64.bin

[oracle@oLinux189:/home/oracle/OEM]./em13200_linux64.bin &
[1] 17671
[oracle@oLinux189:/home/oracle/OEM]

3.2.Software Updates

Select “Skip”:

3.3.Prerequisite Checks

vi /etc/sysctl.conf
net.ipv4.ip_local_port_range = 11000 65000

sysctl -p

3.4.Installation Types

Select “Advanced”

3.5.Installation Details

Middleware Home Location: /oracle/app/oracle/oem/middleware
Agent Base directory: /oracle/app/oracle/oem/agent
Host Name: oem.dba.com

3.6.Select Plug-ins

3.7.WebLogic Server Configuration Details

Password: oracle123

3.8.Database Connection Details

3.9.Enterprise Manager Configuration Details

SYSMAN Password: oracle123

3.10.Shared Location Details

3.11.Port configuration Details

3.12.Review

3.13.Install Progress

3.14.Finished

3.15.启动OEM的顺序

1.启动OMS服务器的数据库,启动LISTENER
2.启动中间件控制台(WebLogic)

[oracle@oem:/oracle/app/oracle/oem/gc_inst/user_projects/domains/GCDomain]$./startWebLogic.sh noderby
./startWebLogic.sh

停止命令:

./stopWebLogic.sh

3.最后启动OMS

$OMS_HOME/bin/emctl start oms -all

4.启动客户端

$AGENT_HOME/bin/emctl start agent

NOTE:

By default, the Oracle Service Bus JMS reporting provider is deployed in an Oracle Service Bus domain. The reporting provider uses a database to persist reporting data. If you do not want to use the JMS reporting provider in your development domain, you can disable or untarget it during the domain creation process.

Disabling the reporting provider prevents benign JMS reporting provider errors at server startup.

The reporting provider is the only Oracle Service Bus feature that persists data in a database. If you disable the reporting provider, you can prevent Derby from running by starting your server with the following command:

startWebLogic.sh noderby

Disable the embedded Derby database, which is a file-based database, packaged with Oracle WebLogic Server. The Derby database is used primarily for development environments. As a result, you must disable it when you are configuring a production-ready enterprise deployment environment; otherwise, the Derby database process starts automatically when you start the Managed Servers.

Derby数据库是随着Weblogic Adminserver启动时一起启动的,一般不用。

禁止启动Derby:

vi setDomainEnv.sh

修改前:

# Set DERBY_FLAG, if derby is available.

if [ "${DERBY_FLAG}" = "" ] ; then
        if [ -f #{WL_HOME}/common/derby/lib/derby.jar ] ; then
                DERBY_FLAG="true"
                export DERBY_FLAG
        fi
fi

修改后:

if [ "${DERBY_FLAG}" = "" ] ; then
        if [ -f #{WL_HOME}/common/derby/lib/derby.jar ] ; then
                DERBY_FLAG="false"
                export DERBY_FLAG
        fi

4.测试

4.1.查看oms 和agent状态

agent emctl 和 oms emctl 在不同的目录下:

[oracle@oem:/oracle/app/oracle/oem/agent/agent_13.4.0.0.0/bin]#./emctl status agent
[oracle@oLinux189:/oracle/app/oracle/oem/agent/agent_13.2.0.0.0/bin]#./emctl status agent
Oracle Enterprise Manager Cloud Control 13c Release 2
Copyright (c) 1996, 2016 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
Agent Version          : 13.2.0.0.0
OMS Version            : 13.2.0.0.0
Protocol Version       : 12.1.0.1.0
Agent Home             : /oracle/app/oracle/oem/agent/agent_inst
Agent Log Directory    : /oracle/app/oracle/oem/agent/agent_inst/sysman/log
Agent Binaries         : /oracle/app/oracle/oem/agent/agent_13.2.0.0.0
Core JAR Location      : /oracle/app/oracle/oem/agent/agent_13.2.0.0.0/jlib
Agent Process ID       : 11470
Parent Process ID      : 11398
Agent URL              : https://oem.dba.com:3872/emd/main/
Local Agent URL in NAT : https://oem.dba.com:3872/emd/main/
Repository URL         : https://oem.dba.com:4903/empbs/upload
Started at             : 2021-04-23 19:02:57
Started by user        : oracle
Operating System       : Linux version 5.4.17-2011.6.2.el7uek.x86_64 (amd64)
Number of Targets      : 27
Last Reload            : (none)
Last successful upload                       : 2021-04-23 20:54:21
Last attempted upload                        : 2021-04-23 20:54:21
Total Megabytes of XML files uploaded so far : 1.72
Number of XML files pending upload           : 0
Size of XML files pending upload(MB)         : 0
Available disk space on upload filesystem    : 67.06%
Collection Status                            : Collections enabled
Heartbeat Status                             : Ok
Last attempted heartbeat to OMS              : 2021-04-23 20:55:08
Last successful heartbeat to OMS             : 2021-04-23 20:55:08
Next scheduled heartbeat to OMS              : 2021-04-23 20:56:08

---------------------------------------------------------------
Agent is Running and Ready


[oracle@oem:/oracle/app/oracle/oem/middleware/bin]#./emctl status oms
Oracle Enterprise Manager Cloud Control 13c Release 4
Copyright (c) 1996, 2020 Oracle Corporation.  All rights reserved.
WebTier is Up
Oracle Management Server is Up
JVMD Engine is Up
BI Publisher Server is Down
BI Publisher is disabled, to enable BI Publisher on this host, use the 'emctl config oms -enable_bip' command

4.2.登录Cloud Control

C:\Users\Ted>ping oem.dba.com

Pinging oem.dba.com [192.168.1.189] with 32 bytes of data:
Reply from 192.168.1.189: bytes=32 time=12ms TTL=64
Reply from 192.168.1.189: bytes=32 time=6ms TTL=64
Reply from 192.168.1.189: bytes=32 time=8ms TTL=64
Reply from 192.168.1.189: bytes=32 time=3ms TTL=64

Ping statistics for 192.168.1.189:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 3ms, Maximum = 12ms, Average = 7ms
https://oem.dba.com:7803/em
sysman/oracle123

4.3.配置OMS_HOME

export OMS_HOME=/oracle/app/oracle/oem/agent/agent_13.2.0.0.0
export PATH=ORACLE_HOME/bin:OMS_HOME/bin:$PATH

4.4.Weblogic控制台

https://oem.dba.com:7102/console
weblogic/oracle123

4.5.BI Publisher地址

https://oem.dba.com:9803/xmlpserver/servlet/home
https://oem.dba.com:9851/xmlpserver/servlet/home
sysman/oracle123

4.6.OMS常用命令

查看版本

[oracle@oem:/oracle/app/oracle/oem/middleware/bin]$./emctl getversion oms
Oracle Enterprise Manager Cloud Control 13c Release 4
Copyright (c) 1996, 2020 Oracle Corporation.  All rights reserved.
       Oracle Enterprise Manager Cloud Control OMS 13c Release 4

查看状态

[oracle@oem:/oracle/app/oracle/oem/middleware/bin]$./emctl status oms
Oracle Enterprise Manager Cloud Control 13c Release 4
Copyright (c) 1996, 2020 Oracle Corporation.  All rights reserved.
WebTier is Up
Oracle Management Server is Up
JVMD Engine is Up
BI Publisher Server is Down
BI Publisher is disabled, to enable BI Publisher on this host, use the 'emctl config oms -enable_bip' command

查看详细信息

[oracle@oem:/oracle/app/oracle/oem/middleware/bin]$./emctl status oms -details
Oracle Enterprise Manager Cloud Control 13c Release 4
Copyright (c) 1996, 2020 Oracle Corporation.  All rights reserved.
Enter Enterprise Manager Root (SYSMAN) Password :
Console Server Host        : oem
HTTP Console Port          : 7788
HTTPS Console Port         : 7803
HTTP Upload Port           : 4889
HTTPS Upload Port          : 4903
EM Instance Home           : /oracle/app/oracle/oem/gc_inst/em/EMGC_OMS1
OMS Log Directory Location : /oracle/app/oracle/oem/gc_inst/em/EMGC_OMS1/sysman/log
OMS is not configured with SLB or virtual hostname
Agent Upload is locked.
OMS Console is locked.
Active CA ID: 1
Console URL: https://oem:7803/em
Upload URL: https://oem:4903/empbs/upload

WLS Domain Information
Domain Name            : GCDomain
Admin Server Host      : oem
Admin Server HTTPS Port: 7102
Admin Server is RUNNING

Oracle Management Server Information
Managed Server Instance Name: EMGC_OMS1
Oracle Management Server Instance Host: oem
WebTier is Up
Oracle Management Server is Up
JVMD Engine is Up

BI Publisher Server Information
BI Publisher Managed Server Name: BIP
BI Publisher Server is Down
BI Publisher is disabled, to enable BI Publisher on this host, use the 'emctl config oms -enable_bip' command

查看属性

[oracle@oem:/oracle/app/oracle/oem/middleware/bin]$./emctl list properties
Oracle Enterprise Manager Cloud Control 13c Release 4
Copyright (c) 1996, 2020 Oracle Corporation.  All rights reserved.
SYSMAN password:
Property Details
    Management Server : oem:4889_Management_Service
        Module = EMOMS
            JAVA_EM_ARGS=<Not Set>
            JAVA_EM_MEM_ARGS=<Not Set>
            JBO_LAZY_LOAD=true
            JBO_MAX_CURSORS=5
            JBO_MAX_POOL_SIZE=50
            JBO_MIN_POOL_SIZE=1
            JBO_POOL_TTL=-1
            JBO_RECYC_THRESHOLD=50
            OMS_HEAP_MAX=1740M
            OMS_HEAP_MIN=256M
            OMS_PERMGEN_MAX=768M
            OMS_PERMGEN_MIN=128M
            em.targetauth.db.pki.KeyStore=null

停止OMS

$OMS_HOME/bin/emctl stop oms

启动OMS

$OMS_HOME/bin/emctl start oms

停止cloud control和所有组件

$OMS_HOME/bin/emctl stop oms -all

OMS配置文件

[oracle@oem:/oracle/app/oracle/oem/gc_inst/em/EMGC_OMS1]$cat emgc.properties
#
#Tue Mar 31 19:53:44 EDT 2020
COMMON_ORACLE_HOME=/oracle/app/oracle/oem/middleware/oracle_common
oracle.sysman.emSDK.svlt.ConsoleServerName=oem\:4889_Management_Service
JBO_POOL_TTL=-1
AS_PORT=0
EM_UPLOAD_HTTP_PORT=4889
EM_NODEMGR_HOME=/oracle/app/oracle/oem/gc_inst/user_projects/domains/GCDomain/nodemanager
MSPORT=7202
ADMIN_SERVER_NAME=EMGC_ADMINSERVER
AS_HTTPS_PORT=7102
EM_REPOS_CONNECTDESCRIPTOR=(DESCRIPTION\=(ADDRESS_LIST\=(ADDRESS\=(PROTOCOL\=TCP)(HOST\=oem)(PORT\=1521)))(CONNECT_DATA\=(SID\=OEMREPO)))
OHS_ADMIN_PORT=10006

4.7.Agent常用命令

查看版本

[oracle@oem:/oracle/app/oracle/oem/agent/agent_13.4.0.0.0/bin]$./emctl getversion agent
Oracle Enterprise Manager Cloud Control 13c Release 4
Copyright (c) 1996, 2020 Oracle Corporation.  All rights reserved.
       Oracle Enterprise Manager Cloud Control Agent 13c Release 4

查看状态

[oracle@oem:/oracle/app/oracle/oem/agent/agent_13.4.0.0.0/bin]$./emctl status agent
Oracle Enterprise Manager Cloud Control 13c Release 4
Copyright (c) 1996, 2020 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
Agent Version          : 13.4.0.0.0
OMS Version            : 13.4.0.0.0
Protocol Version       : 12.1.0.1.0
Agent Home             : /oracle/app/oracle/oem/agent/agent_inst
Agent Log Directory    : /oracle/app/oracle/oem/agent/agent_inst/sysman/log
Agent Binaries         : /oracle/app/oracle/oem/agent/agent_13.4.0.0.0
Core JAR Location      : /oracle/app/oracle/oem/agent/agent_13.4.0.0.0/jlib
Agent Process ID       : 25371
Parent Process ID      : 25285
Agent URL              : https://oem:3872/emd/main/
Local Agent URL in NAT : https://oem:3872/emd/main/
Repository URL         : https://oem:4903/empbs/upload
Started at             : 2020-03-31 19:57:15
Started by user        : oracle
Operating System       : Linux version 4.1.12-94.3.9.el7uek.x86_64 (amd64)
Number of Targets      : 39
Last Reload            : (none)
Last successful upload                       : 2020-03-31 20:58:51
Last attempted upload                        : 2020-03-31 20:58:51
Total Megabytes of XML files uploaded so far : 1.85
Number of XML files pending upload           : 0
Size of XML files pending upload(MB)         : 0
Available disk space on upload filesystem    : 28.11%
Collection Status                            : Collections enabled
Heartbeat Status                             : Ok
Last attempted heartbeat to OMS              : 2020-03-31 20:59:27
Last successful heartbeat to OMS             : 2020-03-31 20:59:27
Next scheduled heartbeat to OMS              : 2020-03-31 21:00:27

---------------------------------------------------------------
Agent is Running and Ready

停止agent

$AGENT_HOME/bin/emctl stop agent

启动agent

$AGENT_HOME/bin/emctl start agent

Agent ping OMS

$AGENT_HOME/bin/emctl ping OMS

Upload agent to server

$AGENG_HOME/bi/emctl upload agent

5.OEM添加监控主机和数据

先添加主机,后添加数据库
oracle用户OEM Server 和agent 端至少需要sudo, ping, ssh, 创建目录权限。

5.1.配置OEM主机

如果没有配置DNS, 可以配置hosts文件

/etc/hosts
192.168.138.2 oem oem.lab.com
192.168.138.200 columbus columbus.lab.com

配置sudo链接

[root@oem:/oracle/app/oracle/oem/agent]ln -s /usr/bin/sudo /usr/local/bin/sudo
[root@oem:/oracle/app/oracle/oem/agent]ls -lh /usr/local/bin/sudo
lrwxrwxrwx 1 root root 13 Mar 31 22:19 /usr/local/bin/sudo -> /usr/bin/sudo
[root@oem:/oracle/app/oracle/oem/agent]$ls -lh /usr/bin/sudo
---s--x--x. 1 root root 140K Aug  2  2017 /usr/bin/sudo

配置sudoer

chmod +w /etc/sudoers

vi /etc/sudoers
Defaults   visiblepw
oracle  ALL=(ALL)       ALL
[oracle@oem:/home/oracle]ls -lh /root/
ls: cannot open directory /root/: Permission denied
[oracle@oem:/home/oracle]sudo ls -l /root

5.2.配置被监控主机

配置hosts文件,如果配置DNS不需要配置hosts文件

vi /etc/hosts
192.168.1.190 oem oem.dba.com
192.168.1.97 olinux97 olinux97.dba.com

ping oem.dba.com
mkdir /oracle/em

配置sudo链接

ln -s /usr/bin/sudo /usr/local/bin/sudo

配置sudoer

chmod +w /etc/sudoers

vi /etc/sudoers
Defaults   visiblepw
oracle  ALL=(ALL)       ALL

切换到oracle用户:

sudo ls -l /root
第一次需要输入密码。

5.3.添加主机

[oracle@o97db bin]pwd
/u01/app/em/agent_13.2.0.0.0/bin
[oracle@o97db bin]
[oracle@o97db bin]$ ./emctl status agent
Oracle Enterprise Manager Cloud Control 13c Release 2
Copyright (c) 1996, 2016 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
Agent Version          : 13.2.0.0.0
OMS Version            : 13.2.0.0.0
Protocol Version       : 12.1.0.1.0
Agent Home             : /u01/app/em/agent_inst
Agent Log Directory    : /u01/app/em/agent_inst/sysman/log
Agent Binaries         : /u01/app/em/agent_13.2.0.0.0
Core JAR Location      : /u01/app/em/agent_13.2.0.0.0/jlib
Agent Process ID       : 30986
Parent Process ID      : 30951
Agent URL              : https://olinux97.dba.com:3872/emd/main/
Local Agent URL in NAT : https://olinux97.dba.com:3872/emd/main/
Repository URL         : https://oem.dba.com:4903/empbs/upload
Started at             : 2021-04-24 00:02:41
Started by user        : oracle
Operating System       : Linux version 4.14.35-1902.300.11.el7uek.x86_64 (amd64)
Number of Targets      : 5
Last Reload            : (none)
Last successful upload                       : 2021-04-24 00:06:35
Last attempted upload                        : 2021-04-24 00:06:35
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    : 79.84%
Collection Status                            : Collections enabled
Heartbeat Status                             : Ok
Last attempted heartbeat to OMS              : 2021-04-24 00:05:49
Last successful heartbeat to OMS             : 2021-04-24 00:05:49
Next scheduled heartbeat to OMS              : 2021-04-24 00:06:49

---------------------------------------------------------------
Agent is Running and Ready

5.4.添加数据库

点击“Targets->Database->Add”

6.Adding Additional OMS

7.Configure Software Library

8.Reference

Enterprise Manager Cloud Control Getting Started Guide 13.3

Adding Additional OMS