在oracle 11g之前,管理集羣一般都是用GC,但是到了 12c,爲了適應“雲”架構,oracle推出了新的集羣管理軟件EMCC,相比之前的GC而言,功能強大。
EMCC的部署方式跟oracle 11g GC的部署方式很類似,服務端安裝OMS服務,客戶端安裝agent代理服務,OMS收集客戶端的統計信息都是通過代理來完成的。
EMCC的部署同樣也需要一個資料庫來存儲信息,資料庫可以使用11g庫,也可以使用12c庫。
資料庫部署:
這裏選擇使用12c(12.1.0.2)版本作爲EMCC資料庫。
安裝oracle12C
系統要求:
磁盤至少6.4G
內存至少2G
配置yum源
安裝軟件包:
yum -y install binutils compat-libcap1 compat-libstdc++ gcc gcc-c++ glibc glibc-devel ksh libgcc libstdc++ libstdc++-devel libaio libaio-devel libXext libXtst libX11 libXau libxcb libXi make sysstat
設置內核參數:
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
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
Enter the following command to change the current values of the kernel parameters:
/sbin/sysctl -p
安裝目錄級權限:
# mkdir -p /u01/app/
# chown -R oracle:oinstall /u01/app/
# chmod -R 775 /u01/app/
用戶及用戶組設置:
id oracle
uid=440(oracle) gid=200(oinstall) groups=201(dba),202(oper)
環境變量設置:
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1; export ORACLE_HOME
ORACLE_SID=jhdb; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
開始安裝:
xhost +
su - oracle
./runInstaller
創建實例:
./dbca
選擇高級安裝(Advanced Mode)
Golbal database name:imdb
SID:imdb
創建pdbs ,當然也可以手工創建,手工創建請參考我另外一個文章:
http://mp.blog.csdn.net/mdeditor/79400588
EMCC部署:
1、系統預設:
系統內核參數調整
在/etc/sysctl.conf中添如下內核參數:
kernel.shmmax = 4294967296
刪除EM配置:
$ORACLE_HOME/bin/emca -deconfig dbcontrol db -repos drop
安裝編譯依賴軟件包
yum -y install glibc-devel-2.17-55.el7.i686.rpm
修改數據庫配置參數,不然會報錯誤:
alter system set processes= 500 scope=spfile;
alter system set session_cached_cursors=500 scope=spfile;
alter system set shared_pool_size=650M scope=spfile;
alter system set job_queue_processes=22 scope=spfile;
alter database add logfile size 320M;
alter system set open_cursors=350 scope=spfile;
alter system set sga_target=2g scope=spfile;
ALTER SYSTEM SET pga_aggregate_target=1G SCOPE=SPFILE;
alter system set parallel_max_servers = 20 scope=both;
2、選擇高級安裝模式
3、選擇安裝路徑
4、選擇安裝插件
5、web服務配置
6、EMCC資料庫配置,如果選擇CDB作爲資料庫,需要使用pdb來作爲資料庫。
pdb在創建完成默認是關閉狀態,需要打開。
alter pluggable database emrep open;
EMCC添加目標:
在11g之前的庫安裝代理,一般都是通過在客戶端登陸服務端發佈的網址來下載安裝包,然後在客戶端安裝代理。但是在12c的時候,安裝代理要方便很多,直接在服務端推送代理到客戶端,在推送之前需要設置客戶端和服務端之間的互信,需要注意的是需要配置彼此的主機名。
1 .
2 .
client中增加server的/etc/hosts配置,server中增加client的/etc/hosts。
10.37.2.254 jhim
10.37.2.33 emcc
10.37.2.111 ams
2 . 服務端推送代理的時候需要輸入客戶端登錄名,爲了安全起見,需要設置sudo,在客戶端設置sudo權限:
[root@localhost ~]# ls /usr/local/bin/sudo
ls: cannot access /usr/local/bin/sudo: No such file or directory
[root@localhost ~]# whereis sudo
sudo: /usr/bin/sudo /etc/sudo.conf /usr/share/man/man8/sudo.8.gz
[root@localhost ~]# ln -s /usr/bin/sudo /usr/local/bin/sudo
[root@localhost ~]# cp -p /etc/sudoers /etc/sudoers.bak
修改Defaults:oracle !requiretty
新增oracle ALL=(ALL) ALL
修改Defaults visiblepw
[root@localhost ~]# vi /etc/sudoers
#
# Refuse to run if unable to disable echo on the tty. This setting should also be
# changed in order to be able to use sudo without a tty. See requiretty above.
#
Defaults visiblepw
#
# Disable "ssh hostname sudo <cmd>", because it will show the password in clear.
# You have to run "ssh -t hostname sudo <cmd>".
#
Defaults:oracle !requirettyll
oracle ALL=(ALL) ALL
在服務端運行如下腳本,配置互信,爲後面推送代理程序做準備:
[oracle@EMCC ~]$ /u01/app/oms/oms/oui/prov/resources/scripts/sshUserSetup.sh -setup -user oracle -hosts jhim
輸入兩次‘yes’,ssh 互信直接空格下一步,最後需要輸入客戶端oracle密碼。
3 . 填寫客戶端主機信息
4 . 部署代理
5 . 服務端監控推送日誌:
[oracle@EMCC ~]$ tail -f /u01/app/gc_inst/em/EMGC_OMS1/sysman/agentpush/2018-02-26_15-28-56-PM/applogs/jhim_deploy.log
2018-02-26_15-42-31:INFO:done executing the action: CollectLog on node: jhim
2018-02-26_15-42-31:INFO:action: CollectLog is SUCCESS
2018-02-26_15-42-31:INFO:updating status SUCCESS for action name CollectLog with key: CollectLog
2018-02-26_15-42-31:INFO:sudo exists value true
2018-02-26_15-42-31:INFO:sudo privilege value true
2018-02-26_15-42-31:INFO:==SUDO EXISTS true SUDO PRIV true
2018-02-26_15-42-31:INFO:====CALLING ACTIONdoCleanup
2018-02-26_15-42-31:INFO:updating status IN_PROGRESS for action name Cleanup with key: Cleanup
2018-02-26_15-42-31:INFO:Removing staging directory /home/oracle/AgentBase/ADATMP_2018-02-26_15-28-56-PM
2018-02-26_15-42-31:INFO:locked account and shellout enabled. So cd /tmp and remove directory
2018-02-26_15-42-31:INFO:Using root utl given by user /usr/bin/sudo -u %RUNAS% %COMMAND%
2018-02-26_15-42-31:INFO:Action description 在主機 jhim 上執行命令 /usr/bin/sudo -K
2018-02-26_15-42-31:INFO:Attempt :1 pty required false with no inputs
2018-02-26_15-42-32:INFO:/usr/bin/sudo -K execution was successful on host jhim
2018-02-26_15-42-32:INFO:output:
2018-02-26_15-42-32:INFO:error-stream:
2018-02-26_15-42-32:INFO:exit-code: 0
2018-02-26_15-42-32:INFO:pdp command with shell out /usr/bin/sudo -u oracle /bin/sh -c 'cd /tmp && /bin/rm -rf /home/oracle/AgentBase/ADATMP_2018-02-26_15-28-56-PM'
2018-02-26_15-42-32:INFO:Action description 在主機 jhim 上執行命令 /usr/bin/sudo -u oracle /bin/sh -c 'cd /tmp && /bin/rm -rf /home/oracle/AgentBase/ADATMP_2018-02-26_15-28-56-PM'
2018-02-26_15-42-32:INFO:Attempt :1 pty required false with inputs
2018-02-26_15-42-34:INFO:/usr/bin/sudo -u oracle /bin/sh -c 'cd /tmp && /bin/rm -rf /home/oracle/AgentBase/ADATMP_2018-02-26_15-28-56-PM' execution was successful on host jhim
2018-02-26_15-42-34:INFO:output:
2018-02-26_15-42-34:INFO:error-stream:
2018-02-26_15-42-34:INFO:exit-code: 0
2018-02-26_15-42-34:INFO:Action description 在主機 jhim 上執行命令 /usr/bin/sudo -K
2018-02-26_15-42-34:INFO:Attempt :1 pty required false with no inputs
2018-02-26_15-42-35:INFO:/usr/bin/sudo -K execution was successful on host jhim
2018-02-26_15-42-35:INFO:output:
2018-02-26_15-42-35:INFO:error-stream:
2018-02-26_15-42-35:INFO:exit-code: 0
2018-02-26_15-42-35:INFO:done executing the action: Cleanup on node: jhim
2018-02-26_15-42-35:INFO:action: Cleanup is SUCCESS
2018-02-26_15-42-35:INFO:updating status SUCCESS for action name Cleanup with key: Cleanup
2018-02-26_15-42-35:INFO:TIME TAKEN by NewAgentDeployer on host jhim is 0: hrs 3: mins 5 sec
2018-02-26_15-42-35:INFO:PERF:HOSTNAME:jhim:NewAgentDeployer_EXECUTION_TIME:185634
2018-02-26_15-42-35:INFO:HOST:jhim
2018-02-26_15-42-35:INFO:Destroying Logger
2018-02-26_15-42-35:INFO:======================================New Agent Deployer END ====================================
2018-02-26_15-42-35:INFO:Clearing EMSecurityContext EMExecutionContext in BaseDeployerOps
錯誤1 :
頁面推送安裝agent報錯:
2018-02-27_07-45-27:INFO:/usr/bin/sudo -u oracle /bin/sh -c '/u01/app/AgentBase/ADATMP_2018-02-27_07-31-40-AM/agentDeploy.sh -ignorePrereqs ORACLE_HOSTNAME=ams AGENT_BASE_DIR=/u01/app/AgentBase OMS_HOST=emcc EM_UPLOAD_PORT=4904 AGENT_INSTANCE_HOME=/u01/app/AgentBase/agent_inst b_doDiscovery=false b_startAgent=false b_forceInstCheck=true AGENT_PORT=3872' execution failed on host ams
2018-02-27_07-45-27:INFO:Pattern ERROR: found in file /u01/app/gc_inst/em/EMGC_OMS1/sysman/agentpush/2018-02-27_07-31-40-AM/logs/ams/install.log Line ERROR: Agent Configuration Failed
2018-02-27_07-45-27:INFO:Error Message found Agent Configuration Failed
2018-02-27_07-45-27:INFO: ACTION 在主機 ams 上執行命令 /u01/app/AgentBase/ADATMP_2018-02-27_07-31-40-AM/agentDeploy.sh -ignorePrereqs ORACLE_HOSTNAME=ams AGENT_BASE_DIR=/u01/app/AgentBase OMS_HOST=emcc EM_UPLOAD_PORT=4904 AGENT_INSTANCE_HOME=/u01/app/AgentBase/agent_inst b_doDiscovery=false b_startAgent=false b_forceInstCheck=true AGENT_PORT=3872
2018-02-27_07-45-27:INFO: OUT null
2018-02-27_07-45-27:INFO: ERR Agent Configuration Failed
2018-02-27_07-45-27:INFO: EXIT CODE1
2018-02-27_07-45-27:INFO:InvocationTargetException Exception
2018-02-27_07-45-27:INFO:Printing Exception :java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at oracle.sysman.core.agentpush.ui.deployer.BaseDeployerOps.executeActions(BaseDeployerOps.java:2111)
at oracle.sysman.core.agentpush.ui.deployer.NewAgentDeployer.deploy(NewAgentDeployer.java:48)
at oracle.sysman.core.agentpush.ui.deployfwk.DeploymentWorker.run(DeploymentWorker.java:26)
at oracle.sysman.util.threadPoolManager.WorkerThread.run(Worker.java:311)
Caused by: CommandException: err: Agent Configuration Failed out: null exitcode: 1
stacktrace:
null
at oracle.sysman.core.agentpush.ui.deployer.DeployerOps.executeCommandOnNodeInteractive(DeployerOps.java:1227)
at oracle.sysman.core.agentpush.ui.deployer.DeployerOps.executeCommandOnNodeInteractiveUsingRunAs(DeployerOps.java:1047)
at oracle.sysman.core.agentpush.ui.deployer.DeployerOps.executeCommandOnNodeInteractiveUsingRunAs(DeployerOps.java:945)
at oracle.sysman.core.agentpush.ui.deployer.DeployerOps.executeCmdOnNode(DeployerOps.java:652)
at oracle.sysman.core.agentpush.ui.deployer.DeployerOps.executeCmdOnNode(DeployerOps.java:609)
at oracle.sysman.core.agentpush.ui.deployer.BaseDeployerOps.doInstall(BaseDeployerOps.java:656)
... 8 more
2018-02-27_07-45-27:INFO:=========Command Exception :錯誤消息: Agent Configuration Failed <br><br> 退出代碼 :1
2018-02-27_07-45-27:INFO:Updating Action Installwith Status FAILED and error Message :錯誤消息: Agent Configuration Failed <br><br> 退出代碼 :1 and problem 在主機 ams 上執行命令 /u01/app/AgentBase/ADATMP_2018-02-27_07-31-40-AM/agentDeploy.sh -ignorePrereqs ORACLE_HOSTNAME=ams AGENT_BASE_DIR=/u01/app/AgentBase OMS_HOST=emcc EM_UPLOAD_PORT=4904 AGENT_INSTANCE_HOME=/u01/app/AgentBase/agent_inst b_doDiscovery=false b_startAgent=false b_forceInstCheck=true AGENT_PORT=3872 失敗 and recommendation 修復錯誤的原因並重試此操作
2018-02-27_07-45-27:INFO:=================action status is not empty FAILED
EMCC 通過頁面推送代理有bug,建議使用手動安裝方式來避免。
問題2:
oms 資料庫部署在linux 6.6上,想監控windows 主機,發現代理不兼容。
看到這裏,需要升級代理程序,由於沒有mos賬號,所以不能聯機升級,只能脫機升級,
脫機打補丁需要首先下載em資料庫,先升級em然後通過em去連接升級oms補丁。
按照提示升級。
把下載的補丁包上傳到OMS服務器,登錄到OMS服務器執行 :
oracle@EMCC bin]$ ./emcli login -username=sysman
Enter password
Login successful
[oracle@EMCC bin]$ ./emcli import_update_catalog -file=/home/p9348486_112000_Generic.zip -omslocal
然後就可以下載代理補丁了: