注意事项
OMR: Oracle Management Repository
OEM 13c
后台DB
只支持从版本 12.1.0.2.0
开始的 OMR
数据库,这里使用 19c
的数据库。
注意:不能安装 EM
,即 DC
。
1. 什么是EMCC
Oracle enterprise manager cloud control(emcc)
是用于oracle
数据库性能管理,实现数据库运营自动化的平台。
2. EMCC 能干什么
主要使用场景包括:
发现、修复和验证数据库性能问题:一体化的诊断、调优和验证并实现了自动化,可加速故障排除和纠正措施。
自动进行数据库生命周期运营:数据库运营全面自动化可减少手动工作,消除人为错误,并及时更新最新补丁。
在用户受到影响之前解决问题:主动管理警报模板,自动发送通知,加强团队协作,以快速排除问题,避免客户 IT 运营受到影响。
3. EMCC 安装部署
3.1 安装依赖包
yum install -y binutils compat-libcap1 compat-libstdc compat-libstdc gcc gcc-c glibc glibc glibc-devel libaio libaio-devel libgcc libgcc libstdc libstdc libstdc++-devel dejavu-serif-fonts ksh make sysstat numactl numactl-devel motif for x86_643 motif-devel redhat-lsb redhat-lsb-core OpenSSL
3.2 修改系统参数
3.2.1 ip_local_port_range
# 避免端口被占用
echo 11000 65000 > /proc/sys/net/ipv4/ip_local_port_range
3.2.2 sysctl.conf
vi /etc/sysctl.conf
net.ipv4.ip_local_port_range = 11000 65000
sysctl -p
3.3 创建目录
mkdir -p /u02/app/oracle/middleware/oms
mkdir -p /u02/app/oracle/middleware/agent
chown -R oracle.oinstall /u02
注意:请确保/u01目录的剩余空间足以安装EMCC。EMCC 13.3软件安装完成后,大约需要26G的空间;而agent大约需要2G的空间。
在安装过程中,/tmp目录至少需要12G的空间,或者至少有一个目录的空闲空间有12G,需要存放临时解压文件,安装完成后会释放该空间。
3.4 修改参数
# 安装好数据库之后,要对相应的参数做一定的修改,否则会在安装的时候报错。
alter system set session_cached_cursors=400 scope=spfile;
alter system set open_cursors=600 scope=spfile;
alter system set processes=800 scope=spfile;
alter system set memory_max_target=6G scope=spfile;
alter system set memory_target=6G scope=spfile;
alter system set sga_max_size=4G scope=spfile;
alter system set sga_target=4G scope=spfile;
alter system set pga_aggregate_target=2G scope=spfile;
alter system set shared_pool_size=1G scope=spfile;
alter system set log_buffer=8M scope=spfile;
alter system set "_allow_insert_with_update_check"=true;
alter system set parallel_min_servers=0;
alter system set parallel_max_servers=8;
EXEC DBMS_AUTO_TASK_ADMIN.DISABLE();
EXEC DBMS_AUTO_TASK_ADMIN.DISABLE(client_name => 'auto optimizer stats collection',operation => NULL,window_name => NULL);
# 调整 redo 大小
alter database add logfile group 4 '/u01/app/oracle/oradata/EMCC/redo04.log' size 400m;
alter database add logfile group 5 '/u01/app/oracle/oradata/EMCC/redo05.log' size 400m;
alter database add logfile group 6 '/u01/app/oracle/oradata/EMCC/redo06.log' size 400m;
alter system switch logfile;
alter system switch logfile;
alter system switch logfile;
alter database drop logfile group 1;
alter database drop logfile group 2;
alter database drop logfile group 3;
# 修改了参数最好能重启下数据库
# pdb 默认是不启动的,重启数据库后需手动启动
show pdbs
alter session set conainer=emccpdb1
startup
3.5 安装 EMCC
export DISPLAY=192.168.10.50:0.0
chmod +x em13500_linux64.bin
./em13500_linux64.bin
[oracle@emcc01 emcc]$ ./em13500_linux64.bin
Launcher log file is /tmp/OraInstall2023-01-16_01-49-12PM/launcher2023-01-16_01-49-12PM.log.
Extracting the installer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Done
Checking monitor: must be configured to display at least 256 colors. DISPLAY environment variable not set. Failed <<<<
Checking swap space: must be greater than 512 MB. Actual 23935 MB Passed
Checking if this platform requires a 64-bit JVM. Actual 64 Passed (64-bit not required)
Some system prerequisite checks failed.
You must fulfill these requirements before continuing.
Continue? (yes [y] / no [n]) [n]
y
Yes
/u02/app/oracle/middleware/oms
/u02/app/oracle/middleware/agent
Yes
如果出现:
Oracle strongly recommends that you disable the password verification function in your database before proceeding any further.
则表示所指定的 pdb 数据库没有启动,按照如下操作
alter session set container=emccpdb1;
startup
然后在UI上返回上一步,再点下一步即可
这里有几个警告,可以进行相关修改后重新 check,这里是测试环境,就不改了
这里设置的是登陆 EMCC web 的账号密码
安装时间比较长,耐心等待
[root@emcc01 agent]# /u02/app/oracle/middleware/oms/allroot.sh
Starting to execute allroot.sh .........
Starting to execute /u02/app/oracle/middleware/oms/root.sh ......
Check /u02/app/oracle/middleware/oms/install/root_emcc01_2023-01-17_08-56-04.log for the output of root script
Finished product-specific root actions.
/etc exist
Finished execution of /u02/app/oracle/middleware/oms/root.sh ......
Starting to execute /u02/app/oracle/middleware/agent/agent_13.5.0.0.0/root.sh ......
Finished product-specific root actions.
/etc exist
Finished execution of /u02/app/oracle/middleware/agent/agent_13.5.0.0.0/root.sh ......
EMCC 访问地址 : https://192.168.10.50:7803/em
账号:sysman
密码:刚才设置的
选择一个主页
4. 设置开机自动启动
4.1 设置 oracle 开启自启
1.修改 /etc/oratab
# vim /etc/oratab
将 “emcc:/u01/app/oracle/product/19.3.0/dbhome_1:N”,
改为“emcc:/u01/app/oracle/product/19.3.0/dbhome_1:Y”
第一个字段为数据库的系统标识符(实例名);
第二个字段为数据库的主目录;
第三个字段为 dbstart 实用程序。
参考自己的目录,修改完后保存退出。
设置完后 oracle 自带的 dbstart 和 dbshut 才能够发挥作用。
2.修改 /etc/rc.d/rc.local
# vim /etc/rc.d/rc.local
su oracle -lc "/u01/app/oracle/product/19.3.0/dbhome_1/bin/lsnrctl start"
su oracle -lc /u01/app/oracle/product/19.3.0/dbhome_1/bin/dbstart
3.修改权限
chmod +x /etc/rc.d/rc.local
4.2 设置 PDB 开机自启
参考: https://blog.51cto.com/baoyw/5608164
alter pluggable database all save state;
alter pluggable database pdb1 save state;
4.3 设置 oms 开机自启
1.修改 /etc/oratab
# 添加如下信息:
OMS:/u02/app/oracle/middleware/oms:Y
AGENT:/u02/app/oracle/middleware/agent/agent_13.5.0.0.0:Y
2.修改 /etc/rc.d/rc.local
# 添加如下信息:
su oracle -lc "/u02/app/oracle/middleware/oms/bin/emctl start oms"
#su oracle -lc "/u02/app/oracle/middleware/agent/agent_13.5.0.0.0/bin/emctl start agent"
如果是 agent,则用这个 emctl start agent
3.修改权限
chmod +x /etc/rc.d/rc.local
验证的时候需要等一段时间 oms 服务才会起来,因为 oms 启动比较慢,最少等 5~10 分钟左右
5. 使用方法
5.1 添加主机信息
vi /etc/hosts ,在EMCC server 、被添加主机上编辑 hosts 文件,添加双方信息
这里的账号是DB服务器的OS账号,及数据库服务运行的账号 Oracle
这是因为没在 /etc/hosts 中加入双方的信息,加上后重试即可
添加成功后再主机信息中即可看到状态,后面的值需要等运行一段时间后才会有
5.2 添加数据库信息
添加数据库信息前,一定要添加所在主机的信息,否则失败
选择刚添加的主机
填上 dbsnmp 的账号的免密,然后测试连接
这里一般dbsnmp 用户是禁用状态,这里需要启用,且取消密码过期限制
# 找到用的是那个profile
select username,user_id,account_status,lock_date,expiry_date,profile from dba_users where username='DBSNMP'
# 检查该 profile 密码是否有限制,默认180 天
SELECT * FROM dba_profiles WHERE profile='DEFAULT' AND resource_name='PASSWORD_LIFE_TIME';
# 取消密码过期限制
ALTER PROFILE MONITORING_PROFILE LIMIT PASSWORD_LIFE_TIME UNLIMITED;
# 修改 DBSNMP 用户密码
alter user DBSNMP identified by "oracle"
# 解锁账号
alter user dbsnmp account unlock
等待状态正常即可
这里状态变正常
6. 常用命令
6.1 oms 相关
6.1.1 查看 OMS 版本
[oracle@emcc01 bin]$ cd /u02/app/oracle/middleware/oms/bin
[oracle@emcc01 bin]$ ./emctl getversion oms
Oracle Enterprise Manager Cloud Control 13c Release 5
Copyright (c) 1996, 2021 Oracle Corporation. All rights reserved.
Oracle Enterprise Manager Cloud Control OMS 13c Release 5
6.1.2 查看 OMS 状态
[oracle@emcc01 bin]$ cd /u02/app/oracle/middleware/oms/bin
[oracle@emcc01 bin]$ ./emctl status oms
Oracle Enterprise Manager Cloud Control 13c Release 5
Copyright (c) 1996, 2021 Oracle Corporation. All rights reserved.
WebTier is Up
Oracle Management Server is Up
JVMD Engine is Up
6.1.3 查看OMS详细信息
[oracle@emcc01 bin]$ cd /u02/app/oracle/middleware/oms/bin
[oracle@emcc01 bin]$ ./emctl status oms -details
Oracle Enterprise Manager Cloud Control 13c Release 5
Copyright (c) 1996, 2021 Oracle Corporation. All rights reserved.
Enter Enterprise Manager Root (SYSMAN) Password :
SYSMAN password provided is invalid
[oracle@emcc01 bin]$ ./emctl status oms -details
Oracle Enterprise Manager Cloud Control 13c Release 5
Copyright (c) 1996, 2021 Oracle Corporation. All rights reserved.
Enter Enterprise Manager Root (SYSMAN) Password :
Console Server Host : emcc01
HTTP Console Port : 7788
HTTPS Console Port : 7803
HTTP Upload Port : 4889
HTTPS Upload Port : 4903
EM Instance Home : /u02/app/oracle/middleware/gc_inst/em/EMGC_OMS1
OMS Log Directory Location : /u02/app/oracle/middleware/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://emcc01:7803/em
Upload URL: https://emcc01:4903/empbs/upload
WLS Domain Information
Domain Name : GCDomain
Admin Server Host : emcc01
Admin Server HTTPS Port: 7102
Admin Server is RUNNING
Oracle Management Server Information
Managed Server Instance Name: EMGC_OMS1
Oracle Management Server Instance Host: emcc01
WebTier is Up
Oracle Management Server is Up
JVMD Engine is Up
6.1.4 OMS 启、停
[oracle@emcc01 bin]$ cd /u02/app/oracle/middleware/oms/bin
[oracle@emcc01 bin]$ ./emctl stop oms
[oracle@emcc01 bin]$ cd /u02/app/oracle/middleware/oms/bin
[oracle@emcc01 bin]$ ./emctl start oms
6.1.5 OMS 配置文件
[oracle@emcc01 bin]$ cd /u02/app/oracle/middleware/oms/bin
[oracle@emcc01 bin]$ cat /u02/app/oracle/middleware/gc_inst/em/EMGC_OMS1/emgc.properties
#
#Mon Jan 16 18:36:52 CST 2023
COMMON_ORACLE_HOME=/u02/app/oracle/middleware/oms/oracle_common
oracle.sysman.emSDK.svlt.ConsoleServerName=emcc01\:4889_Management_Service
JBO_POOL_TTL=-1
AS_PORT=0
EM_UPLOAD_HTTP_PORT=4889
EM_NODEMGR_HOME=/u02/app/oracle/middleware/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\=127.0.0.1)(PORT\=1521)))(CONNECT_DATA\=(SERVICE_NAME\=emccpdb1)))
OHS_ADMIN_PORT=10006
OMS_HEAP_MAX=1740M
EM_CONSOLE_HTTP_PORT=7788
JAVA_EM_ARGS=-XX\:+HeapDumpOnOutOfMemoryError -XX\:HeapDumpPath\=/tmp/OraInstall2023-01-16_03-08-50PM/null/sysman/log/oms_heap_dump -XX\:OnOutOfMemoryError\=/u02/app/oracle/middleware/oms/bin/heap_dump_rolling.sh
WLS_HOME=/u02/app/oracle/middleware/oms/wlserver
JBO_LAZY_LOAD=true
EM_UPLOAD_HTTPS_PORT=4903
oracle.sysman.emRep.repositoryMode=repository
AS_HOST=emcc01
OMS_PERMGEN_MAX=768M
EM_DOMAIN_HOME=/u02/app/oracle/middleware/gc_inst/user_projects/domains/GCDomain
EM_CONSOLE_HTTPS_PORT=7803
CURRENT_OMS_MODE=default
EM_NODEMGR_PORT=7403
EM_DOMAIN_NAME=GCDomain
MS_HTTPS_PORT=7301
EM_INSTANCE_HOST=emcc01
AS_COHERENCE_PORT=9101
WEBTIER_ORACLE_HOME=/u02/app/oracle/middleware/oms/ohs
MW_HOME=/u02/app/oracle/middleware/oms/wlserver/..
JBO_MIN_POOL_SIZE=1
EM_INSTANCE_HOME=/u02/app/oracle/middleware/gc_inst/em/EMGC_OMS1
JBO_MAX_POOL_SIZE=50
IS_ADMIN_HOST=true
AS_USERNAME=weblogic
OMS_HEAP_MIN=256M
ORACLE_HOME=/u02/app/oracle/middleware/oms
NM_USER=nodemanager
OPSS_USER=SYSMAN122140_OPSS
OMSNAME=EMGC_OMS1
JBO_MAX_CURSORS=5
EM_REPOS_USER=SYSMAN
JBO_RECYC_THRESHOLD=50
OMS_PERMGEN_MIN=128M
OHS_COMP_NAME=ohs1
6.2 agent
6.2.1查看agent版本
[oracle@emcc01 bin]$ cd /u02/app/oracle/middleware/agent/agent_13.5.0.0.0/bin
[oracle@emcc01 bin]$ ./emctl getversion agent
Oracle Enterprise Manager Cloud Control 13c Release 5
Copyright (c) 1996, 2021 Oracle Corporation. All rights reserved.
Oracle Enterprise Manager Cloud Control Agent 13c Release 5
6.2.2 查看agent状态
[oracle@emcc01 bin]$ cd /u02/app/oracle/middleware/agent/agent_13.5.0.0.0/bin
[oracle@emcc01 bin]$ ./emctl status agent
Oracle Enterprise Manager Cloud Control 13c Release 5
Copyright (c) 1996, 2021 Oracle Corporation. All rights reserved.
---------------------------------------------------------------
Agent Version : 13.5.0.0.0
OMS Version : 13.5.0.0.0
Protocol Version : 12.1.0.1.0
Agent Home : /u02/app/oracle/middleware/agent/agent_inst
Agent Log Directory : /u02/app/oracle/middleware/agent/agent_inst/sysman/log
Agent Binaries : /u02/app/oracle/middleware/agent/agent_13.5.0.0.0
Core JAR Location : /u02/app/oracle/middleware/agent/agent_13.5.0.0.0/jlib
Agent Process ID : 2108
Parent Process ID : 2045
Agent URL : https://emcc01:3872/emd/main/
Local Agent URL in NAT : https://emcc01:3872/emd/main/
Repository URL : https://emcc01:4903/empbs/upload
Started at : 2023-01-16 18:42:25
Started by user : oracle
Operating System : Linux version 5.4.17-2102.201.3.el7uek.x86_64 (amd64)
Number of Targets : 37
Last Reload : (none)
Last successful upload : 2023-01-17 17:04:13
Last attempted upload : 2023-01-17 17:04:13
Total Megabytes of XML files uploaded so far : 3.59
Number of XML files pending upload : 0
Size of XML files pending upload(MB) : 0
Available disk space on upload filesystem : 66.77%
Collection Status : Collections enabled
Heartbeat Status : Ok
Last attempted heartbeat to OMS : 2023-01-17 17:07:10
Last successful heartbeat to OMS : 2023-01-17 17:07:10
Next scheduled heartbeat to OMS : 2023-01-17 17:08:10
---------------------------------------------------------------
Agent is Running and Ready
6.2.3 停启agent
[oracle@emcc01 bin]$ cd /u02/app/oracle/middleware/agent/agent_13.5.0.0.0/bin
[oracle@emcc01 bin]$ ./emctl stop agent
[oracle@emcc01 bin]$ cd /u02/app/oracle/middleware/agent/agent_13.5.0.0.0/bin
[oracle@emcc01 bin]$ ./emctl start agent
6.2.3 测试agent和OMS连通性
[oracle@emcc01 bin]$ cd /u02/app/oracle/middleware/agent/agent_13.5.0.0.0/bin
[oracle@emcc01 bin]$ ./emctl pingOMS
Oracle Enterprise Manager Cloud Control 13c Release 5
Copyright (c) 1996, 2021 Oracle Corporation. All rights reserved.
---------------------------------------------------------------
EMD pingOMS completed successfully