重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛

标题: Windows 环境 Oracle EM13C Agent 静默部署+数据库纳管 [打印本页]

作者: ZhangQi    时间: 2026-6-26 22:15
标题: Windows 环境 Oracle EM13C Agent 静默部署+数据库纳管
本帖最后由 ZhangQi 于 2026-6-4 13:43 编辑

一、前置准备(Windows+EMCC 两台机器必做)

1、主机名 & hosts 解析

1)新机器(windows客户端)
C:\Windows\System32\drivers\etc\hosts   #写入:EMCC_IP  EMCC主机名

2)EMCC Linux 服务器

vi /etc/hosts #写入:WindowsIP  Windows主机名

2、防火墙放行端口

Windows 防火墙放行入站:3872 (Agent)、1521 (Oracle 监听)
EMCC 放行出站:4903/4900(Agent 注册上传端口)

#这里均将防火墙关闭

3、Windows 库解锁 dbsnmp(Oracle 管理员 CMD,登录 sqlplus)

sqlplus / as sysdba

SELECT username,account_status,lock_date,expiry_date,profile FROM dba_users WHERE username='DBSNMP';
SELECT resource_name,limit FROM dba_profiles WHERE profile='MONITORING_PROFILE' AND resource_name='PASSWORD_LIFE_TIME';
SELECT resource_name,limit FROM dba_profiles WHERE profile='DEFAULT' AND resource_name='PASSWORD_LIFE_TIME';



DBSNMP:EXPIRED & LOCKED 过期锁定,PROFILE=MONITORING_PROFILE
MONITORING_PROFILE 密码有效期 = DEFAULT,而 DEFAULT 已是UNLIMITED(永不过期)
后续新建密码不会再过期,只需要解锁重置密码即可,不用改 PROFILE

alter user dbsnmp account unlock identified by dbsnmp;
SELECT username,account_status,expiry_date,profile FROM dba_users WHERE username='DBSNMP';

二、离线手动安装 Agent(Windows 最稳,推荐,网页推送 Windows 容易报错)

1、EMCC (linux) 下载 Windows x64 Agent 安装包

#切换oms的oracle用户
cd $OMS_HOME/bin
./emcli login -username=sysman -password=你的sysman密码
./emcli sync  ##如果没同步就执行这个

#查看当前oms支持的平台,确认有windows介质
./emcli get_supported_platforms


                               
登录/注册后可看大图


#下载Windows64位agent压缩包到/tmp
export UNZIP_LOC=/usr/bin/unzip ##跨平台拉取 Windows Agent 镜像,需要用 Linux 原生 unzip,配置环境变量UNZIP_LOC指向 Linux 系统 unzip
./emcli get_agentimage -platform="Microsoft Windows x64 (64-bit)" -destination=/home/oracle/agent_download -version=13.5.0.0.0

注意:路径需要有权限,并且是空目录,否则会报错


                               
登录/注册后可看大图


此时生成了一个名为13.5.0.0.0_AgentCore_233.zip的文件


                               
登录/注册后可看大图


#设置Agent一次性注册密码(后面安装必填)


                               
登录/注册后可看大图



                               
登录/注册后可看大图


密码可以设置为oracle_4U

2、传到 Windows 服务器,管理员 CMD 操作,解压到一个干净的目录,例如 E:\agent_media


                               
登录/注册后可看大图


3、开始安装

填写响应文件 agent.rsp

####################################################################
## copyright (c) 1999, 2012 Oracle. All rights reserved.          ##
##                                                                ##
## Specify values for the variables listed below to customize     ##
## your installation.                                             ##
##                                                                ##
## Each variable is associated with a comment. The comment        ##
## identifies the variable type.                                  ##
##                                                                ##
## Please specify the values in the following format:             ##
##                                                                ##
##         Type         Example                                   ##
##         String       "Sample Value"                            ##
##         Boolean      True or False                             ##
##         Number       1000                                      ##
##         StringList   {"String value 1","String Value 2"}       ##
##                                                                ##
## The values that are given as <Value Required> need to be       ##
## specified for a silent installation to be successful.          ##
##                                                                ##
##                                                                ##
## This response file is generated by Oracle Software             ##
## Packager.                                                      ##
###################################################################


#-------------------------------------------------------------------------------
#OMS_HOST:<String> OMS host info required to connect to OMS
#EM_UPLOAD_PORT:<String> OMS port info required to connect to OMS
#AGENT_REGISTRATION_PASSWORD:<String> Agent Registration Password needed to
#     establish a secure connection to the OMS.
#b_startAgent:<boolean> Agent will not be started after configuration if the value specified is false.
#AGENT_BASE_DIR=<String> Base directory of agent.
#AGENT_INSTANCE_HOME:<String> Agent instance home is the location of agent state directory.
#AGENT_PORT:<String> Agent port on which the agent process should be started.
#ORACLE_HOSTNAME:<String> Fully qualified domain name of host where is the agent is deployed.
#s_agentHomeName:<String>Customized Oracle home name for the agent home. Example: s_agentHomeName="agent12gR1"
#--------------------------------------------------------------------------------
#Following are mandatory parameters
#--------------------------------------------------------------------------------
OMS_HOST=omsserver.xnyy.com
EM_UPLOAD_PORT=4903
AGENT_REGISTRATION_PASSWORD=oracle_4U

#--------------------------------------------------------------------------------
#Following are optional parameters
#--------------------------------------------------------------------------------
b_startAgent=true
AGENT_BASE_DIR=E:\agent

#AGENT_INSTANCE_HOME=<Value Unspecified>
AGENT_PORT=3872
ORACLE_HOSTNAME=WIN-BGOIJK6HFQU
s_agentHomeName="agent13c"

#-------------------------------------------------------------------------------
#s_agentSrvcName:<String> Sets the agent Service Name and this variable can be
#      used to overrite the agent service name calculated by the install. This is
#      required for only Windows.
#      Example:
#      s_agentSrvcName = "GridAgent"                   ;  User specified value
#-------------------------------------------------------------------------------
s_agentSrvcName="OracleAgent13c"
####################################################################################
#Please Don't change the values of these variables
####################################################################################
#-------------------------------------------------------------------------------
#EM_INSTALL_TYPE:<STRING> install type
#-------------------------------------------------------------------------------
EM_INSTALL_TYPE="AGENT"


注意:
        - OMS_HOST为emcc服务器主机名
        - EM_UPLOAD_PORT可以去emcc服务器 输入 ./emctl status oms -details 查看 HTTPS Upload Port 一栏得到
        - AGENT_REGISTRATION_PASSWORD 为Agent注册口令
        - AGENT_BASE_DIR 为安装目录
        - AGENT_PORT 默认3872
        - ORACLE_HOSTNAME 为本机完整主机名(如果有域名要加上)
        

cmd进入安装文件目录中,运行命令:

set JAVA_HOME=
set CLASSPATH=

##JAVA_HOME 路径含空格【Program Files (x86)】,OPatch 调用系统 JDK 时路径空格解析报错 此时不应有 \jdk1.8.0_66\lib,所以临时取消

agentDeploy.bat -responseFile E:\agent_media\agent.rsp AGENT_BASE_DIR=E:\agent OMS_HOST=omsserver.xnyy.com  EM_UPLOAD_PORT=4903 AGENT_REGISTRATION_PASSWORD=oracle_4U ORACLE_HOSTNAME=WIN-BGOIJK6HFQU -ignorePrereqs


此时他会自动安装


                               
登录/注册后可看大图


4、安装完成后,管理员 CMD 验证 Agent 状态
cd E:\agent\agent_inst\bin
emctl status agent
#正常:Agent is Running and Ready


                               
登录/注册后可看大图



查看服务


                               
登录/注册后可看大图


三、前往emcc控制台添加数据库

1、登录 EMCC 网页
选择【目标→主机】,等待 5~10 分钟自动发现本 Windows 主机;


                               
登录/注册后可看大图


2、顶部菜单【设置】→【添加目标】→【手动添加目标】→ 选择指导模式添加数据库


                               
登录/注册后可看大图



                               
登录/注册后可看大图


选择已添加主机的数据库


                               
登录/注册后可看大图


点击下一步,开始搜索


                               
登录/注册后可看大图


选择数据库和监听程序,填写监视口令后,点击配置数据库


                               
登录/注册后可看大图


检查配置无误后,点击测试


                               
登录/注册后可看大图


测试成功后,点击保存即可


                               
登录/注册后可看大图


同样的方法检查监听配置,检查无误后点击保存


                               
登录/注册后可看大图


点击下一步


                               
登录/注册后可看大图


点击保存


                               
登录/注册后可看大图


四、查看添加的目标

        - 主机


                               
登录/注册后可看大图


        - 数据库


                               
登录/注册后可看大图


配置完成







欢迎光临 重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2