想启动Oracle的OEM服务,运行emctl start dbconsole,结果出现如下报错信息:
/u01/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_wjq.comsys.com_OraDB11gnot found。要想打开OEM的web管理程序,必须先启动Database listener,再启动Datebase Control端口监控程序,但是碰到下面的问题:


[oracle@wjq ~]$ emctl startdbconsole

OC4J Configuration issue./u01/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_wjq.comsys.com_OraDB11gnot found.


其实产生的这样的情况,可能是em资料库配置不正确或者是dbcotrol没有配置好。


解决方法:

①重建em资料

[oracle@wjq ~]$ emca -reposrecreate


STARTED EMCA at Nov 3, 20174:35:17 PM

EM Configuration Assistant,Version 11.2.0.3.0 Production

Copyright (c) 2003, 2011,Oracle. All rights reserved.


Enter the followinginformation:

Database SID: seiang11g

Listener port number: 1521

Password for SYS user:

Password for SYSMANuser:


----------------------------------------------------------------------

WARNING : While repository isdropped the database will be put in quiesce mode.

----------------------------------------------------------------------

Do you wish to continue?[yes(Y)/no(N)]: Y

Nov 3, 2017 4:35:34 PMoracle.sysman.emcp.EMConfig perform

INFO: This operation is beinglogged at/u01/app/oracle/cfgtoollogs/emca/OraDB11g/emca_2017_11_03_16_35_16.log.

Nov 3, 2017 4:35:34 PMoracle.sysman.emcp.EMReposConfig invoke

INFO: Dropping the EMrepository (this may take a while) ...

Nov 3, 2017 4:36:47 PMoracle.sysman.emcp.EMReposConfig invoke

INFO: Repository successfullydropped

Nov 3, 2017 4:36:47 PMoracle.sysman.emcp.EMReposConfig createRepository

INFO: Creating the EMrepository (this may take a while) ...

Nov 3, 2017 4:40:32 PMoracle.sysman.emcp.EMReposConfig invoke

INFO: Repository successfullycreated

Enterprise Manager configuration completed successfully

FINISHED EMCA at Nov 3, 20174:40:32 PM


②配置dbcontrol

[oracle@wjq ~]$ emca -configdbcontrol db


STARTED EMCA at Nov 3, 20172:29:41 PM

EM Configuration Assistant,Version 11.2.0.3.0 Production

Copyright (c) 2003, 2011,Oracle. All rights reserved.


Enter the followinginformation:

Database SID: seiang11g

Listener port number: 1521

Listener ORACLE_HOME [/u01/app/oracle/product/11.2.0/dbhome_1 ]:

Password for SYS user:

Password for DBSNMPuser:

Password for SYSMANuser:

Email address fornotifications (optional):

Outgoing Mail (SMTP) serverfor notifications (optional):

-----------------------------------------------------------------


You have specified thefollowing settings


Database ORACLE_HOME................ /u01/app/oracle/product/11.2.0/dbhome_1


Local hostname................ wjq.comsys.com

Listener ORACLE_HOME................ /u01/app/oracle/product/11.2.0/dbhome_1

Listener port number................ 1521

Database SID ................seiang11g

Email address fornotifications ...............

Outgoing Mail (SMTP) serverfor notifications ...............


-----------------------------------------------------------------

Do you wish to continue?[yes(Y)/no(N)]: y^H

Nov 3, 2017 2:30:36 PMoracle.sysman.emcp.EMConfig perform

INFO: This operation is beinglogged at/u01/app/oracle/cfgtoollogs/emca/OraDB11g/emca_2017_11_03_14_29_40.log.

Nov 3, 2017 2:30:39 PMoracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository

INFO: Uploading configurationdata to EM repository (this may take a while) ...

Nov 3, 2017 2:32:36 PMoracle.sysman.emcp.EMReposConfig invoke

INFO: Uploaded configurationdata successfully

Nov 3, 2017 2:32:38 PMoracle.sysman.emcp.util.DBControlUtil secureDBConsole

INFO: Securing DatabaseControl (this may take a while) ...

Nov 3, 2017 2:32:53 PMoracle.sysman.emcp.util.PlatformInterface executeCommand

WARNING: Error executing/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl secure dbconsole -hostwjq.comsys.com -sid OraDB11g

Nov 3, 2017 2:32:53 PMoracle.sysman.emcp.EMDBPostConfig performConfiguration

WARNING: Error securingDatabase control.

Nov 3, 2017 2:32:53 PMoracle.sysman.emcp.EMDBPostConfig setWarnMsg

INFO: Error securing DatabaseControl. Database Control has been brought-up in non-secure mode. To secure theDatabase Control execute the following command(s):


1) Set the environment variable ORACLE_UNQNAMEto Database unique name

2)/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl stop dbconsole

3)/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl config emkey -repos-sysman_pwd < Password for SYSMAN user >

4)/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl secure dbconsole -sysman_pwd< Password for SYSMAN user >

5) /u01/app/oracle/product/11.2.0/dbhome_1/bin/emctlstart dbconsole


To secure Em Key, run/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl config emkey-remove_from_repos -sysman_pwd < Password for SYSMAN user >

Nov 3, 2017 2:32:53 PMoracle.sysman.emcp.util.DBControlUtil startOMS

INFO: Starting DatabaseControl (this may take a while) ...

Nov 3, 2017 2:32:58 PMoracle.sysman.emcp.EMDBPostConfig performConfiguration

INFO: Database Controlstarted successfully

Nov 3, 2017 2:32:58 PMoracle.sysman.emcp.EMDBPostConfig performConfiguration

INFO:>>>>>>>>>>> The Database Control URL is http://wjq.comsys.com:5500/em <<<<<<<<<<<


Error securing DatabaseControl. Database Control has been brought-up in non-secure mode. To secure theDatabase Control execute the following command(s):


1) Set the environment variable ORACLE_UNQNAMEto Database unique name

2) /u01/app/oracle/product/11.2.0/dbhome_1/bin/emctlstop dbconsole

3)/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl config emkey -repos-sysman_pwd < Password for SYSMAN user >

4)/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl secure dbconsole -sysman_pwd< Password for SYSMAN user >

5)/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl start dbconsole


To secure Em Key, run/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl config emkey-remove_from_repos -sysman_pwd < Password for SYSMAN user >


然后直接进入http://wjq.comsys.com:5500/em/,输入账户sys和密码******,选择sysdba权限,就能正常看到基于WEB的EM了。

Oracle11G的EM采用了web方式,并且分成了2个产品,database control和grid control。Grid control需要下载单独的光盘安装。在用DBCA建库的时候,可以选择是否启用dbcontrol,启用的话需要在数据库中建立一个sysman的 schema,用于保存EM的一些数据,这个就是EM的资料库(repository)。使用命令行工具emca可以创建,修改,重建或者删除 dbcontrol的配置。


emca-repos create: 创建新的 Database Control 资料档案库
emca -repos drop: 删除当前的 Database Control 资料档案库
emca -repos recreate: 删除当前的 Database Control 资料档案库并重新创建一个
emca -config dbcontrol db:配置数据库的 Database Control

emca-deconfig dbcontrol db:取消数据库的 Database Control


特别注意:

(1)如果服务器上存在多个数据库,必须在启动Database control之前设置ORACLE_SID环境变量
(2)最好使用静态IP地址来配置服务器



常用的命令语法:

emca -repos create创建一个EM资料库

emca -repos recreate重建一个EM资料库

emca -repos drop删除一个EM资料库

emca -config dbcontrol db配置数据库的 Database Control

emca -deconfig dbcontrol db删除数据库的 Database Control配置

emca -reconfig ports 重新配置db control和agent的端口

emctl start console启动EM console服务,使用前需要先设置ORACLE_SID环境变量

emctl stop console停止EM console服务,使用前需要先设置ORACLE_SID环境变量

注:通过查看$ORACLE_HOME/install/portlist.ini 文件可以知道当前dbcontrol正在使用的端口,默认dbcontrolhttp端口1158,agent端口3938。如果要重新配置端口,可以使用如下命令:

emca -reconfig ports -dbcontrol_http_port 1159

emca -reconfig ports -agent_port 3939

使用命令行工具emctl可以启动/停止console服务,察看服务状态等。



作者:SEian.G(苦练七十二变,笑对八十一难)