本文建立于相关的数据库已经配置完毕的环境中。各平台的Oracle数据库软件的安装及数据库的建立请参照:
1、emca配置oracle的EM – Enterprise Manager
如若安装配置数据库之时,未选择OEM的配置。此处为第一次配置。
连接数据库,查看现有用户,并给DBSNMP用户设置密码并解锁。
SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 7 19:35:06 2011Copyright (c) 1982, 2009, Oracle. All rights reserved.Connected to:
[oracle@rac03 ~]$ sqlplus / as sysdba
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select username,account_status from dba_users;
USERNAME ACCOUNT_STATUS
—————————— ——————————–
SYS OPEN
SYSTEM OPEN
OUTLN EXPIRED & LOCKED
APPQOSSYS EXPIRED & LOCKED
DBSNMP EXPIRED & LOCKED
WMSYS EXPIRED & LOCKED
DIP EXPIRED & LOCKED
ORACLE_OCM EXPIRED & LOCKED
8 rows selected.
SQL> alter user DBSNMP account unlock;
User altered.
SQL> alter user dbsnmp identified by password;
User altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@rac03 ~]$
使用emca工具首次配置oracle的EM。
-config dbcontrol db 参数选项表示为数据库配置Database Control(EM)
-repos create 参数选项表示为dbcontrol配置repository. recreate表示在需要重新创建repository时指定。此时我们选择create
配置开始,会要求输入相关变量,如SID,监听端口,ORACLE_HOME,SYS、DBSNMP、SYSMAN三个用户的密码。可选项可以留空。
STARTED EMCA at Sep 7, 2011 7:37:33 PMEM Configuration Assistant, Version 11.2.0.0.2 ProductionCopyright (c) 2003, 2005, Oracle. All rights reserved.
[oracle@rac03 ~]$ emca -config dbcontrol db -repos create
Enter the following information:
Database SID: ACE
Listener port number: 1521
Listener ORACLE_HOME [ /oracle/product/11g/db ]:
Password for SYS user:
Password for DBSNMP user:
Password for SYSMAN user:
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
—————————————————————–
You have specified the following settings
Database ORACLE_HOME ……………. /oracle/product/11g/db
Local hostname ……………. rac03
Listener ORACLE_HOME ……………. /oracle/product/11g/db
Listener port number ……………. 1521
Database SID ……………. ACE
Email address for notifications ……………
Outgoing Mail (SMTP) server for notifications ……………
—————————————————————–
Do you wish to continue? [yes(Y)/no(N)]: yes
Sep 7, 2011 7:38:24 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /oracle/cfgtoollogs/emca/ACE/emca_2011_09_07_19_37_32.log.
Sep 7, 2011 7:38:25 PM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) …
Sep 7, 2011 7:44:19 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Sep 7, 2011 7:44:28 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) …
Sep 7, 2011 7:45:49 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Sep 7, 2011 7:45:54 PM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib
INFO: Software library configured successfully.
Sep 7, 2011 7:45:54 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Deploying Provisioning archives …
Sep 7, 2011 7:46:47 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Provisioning archives deployed successfully.
Sep 7, 2011 7:46:47 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) …
Sep 7, 2011 7:47:01 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Sep 7, 2011 7:47:01 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) …
Sep 7, 2011 7:48:30 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Sep 7, 2011 7:48:30 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://rac03:1158/em <<<<<<<<<<<
Sep 7, 2011 7:48:35 PM oracle.sysman.emcp.EMDBPostConfig invoke
WARNING:
************************ WARNING ************************
Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted. The encryption key has been placed in the file: /oracle/product/11g/db/rac03_ACE/sysman/config/emkey.ora. Please ensure this file is backed up as the encrypted data will become unusable if this file is lost.
***********************************************************
Enterprise Manager configuration completed successfully
FINISHED EMCA at Sep 7, 2011 7:48:35 PM
[oracle@rac03 ~]$
经过上述步骤,见到Enterprise Manager configuration completed successfully,则已表明我们成功配置了EM.此时我们可以用提示的地址访问OEM了
此处需要注意一点是访问所用协议是https
2、emca删除已配置的EM
-deconfig dbcontrol db 参数选项表示为取消数据库Database Control(EM)的配置
-repos drop 可选参数选项表示为取消配置时,是否repository. 此处我们选择drop
命令开始,会要求输入相关变量,如SID,监听端口,SYS、DYSMAN三两个用户的密码。
STARTED EMCA at Sep 7, 2011 9:00:47 PMEM Configuration Assistant, Version 11.2.0.0.2 ProductionCopyright (c) 2003, 2005, Oracle. All rights reserved.Enter the following information:
[oracle@rac03 ~]$ emca -deconfig dbcontrol db -repos drop
Database SID: ACE
Listener port number: 1521
Password for SYS user:
Password for SYSMAN user:
Do you wish to continue? [yes(Y)/no(N)]: yes
Sep 7, 2011 9:01:05 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /oracle/cfgtoollogs/emca/ACE/emca_2011_09_07_21_00_47.log.
Sep 7, 2011 9:01:06 PM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) …
Sep 7, 2011 9:01:31 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) …
Sep 7, 2011 9:03:23 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Enterprise Manager configuration completed successfully
FINISHED EMCA at Sep 7, 2011 9:03:28 PM
[oracle@rac03 ~]$
经过上述步骤,见到Enterprise Manager configuration completed successfully,则已表明我们成功取消了OEM的配置.
3、OEM的一些常用管理命令
1)Unix/Linux类系统
启动OEM的dbconsole进程
[oracle@rac03 ~]$ $ORACLE_HOME/bin/emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
https://rac03:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control ……….. started.
——————————————————————
Logs are generated in directory /oracle/product/11g/db/rac03_ACE/sysman/log
[oracle@rac03 ~]$
查看OEM的dbconsole进程状态
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.https://rac03:1158/em/console/aboutApplicationOracle Enterprise Manager 11g is running.
[oracle@rac03 ~]$ $ORACLE_HOME/bin/emctl status dbconsole
——————————————————————
Logs are generated in directory /oracle/product/11g/db/rac03_ACE/sysman/log
[oracle@rac03 ~]$
停止OEM的dbconsole进程状态
[oracle@rac03 ~]$ $ORACLE_HOME/bin/emctl stop dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
https://rac03:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 11g Database Control …
… Stopped.
[oracle@rac03 ~]$
2)Windows系统
windows系统可以通过服务来控制DBConsole的启停。服务名一般为OracleDBConsolesid