EMCA和EMCTL的简单用法 IT技术网Www.ofAdmin.Com
10G的EM采用了web方式,并且分成了2个产品,database control和grid control。这里主要介绍如何创建单数据的dbcontrol。Grid control需要单独的光盘安装。
在用DBCA建库的时候,可以选择是否启用dbcontrol,启用的话需要在数据库中建立一个sysman的schema,用于保存EM的一些数据,这个就是EM的资料库(repository)。
使用命令行工具emca可以创建,修改,重建或者删除dbcontrol的配置。而使用命令行工具emctl可以启动/停止EM console服务,察看服务状态等。
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环境变量
配置dbconsole的步骤
emca -repos create
emca -config dbcontrol db
emctl start dbconsole
重新配置dbconsole的步骤
emca -repos drop
emca -repos create
emca -config dbcontrol db
emctl start dbconsole
注:通过查看$ORACLE_HOME/install/portlist.ini文件可以知道当前dbcontrol正在使用的端口
Ultra Search HTTP 端口:5620
Enterprise Manager Console HTTP 端口:1158
Enterprise Manager 代理(Agent)端口:3938
如果要重新配置端口,可以使用如下命令:
emca -reconfig ports -dbcontrol_http_port 1159
emca -reconfig ports -agent_port 3939
[oracle@devdb ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-DEC-2011 11:49:00
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=devdb.css.gt3)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 05-DEC-2011 16:20:44
Uptime 15 days 19 hr. 28 min. 16 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/dbdir/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /home/oracle/dbdir/diag/tnslsnr/devdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=devdb.css.gt3)(PORT=1521)))
Services Summary...
Service "HXBZZSJ" has 1 instance(s).
Instance "HXBZZSJ", status READY, has 1 handler(s) for this service...
Service "HXBZZSJXDB" has 1 instance(s).
Instance "HXBZZSJ", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@devdb ~]$ emca -repos drop
STARTED EMCA at Dec 21, 2011 11:49:50 AM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Enter the following information:
Database SID: HXBZZSJ
Listener port number: 1521
Password for SYS user:
Password for SYSMAN user:
Do you wish to continue? [yes(Y)/no(N)]: Y
Dec 21, 2011 11:50:31 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /home/oracle/dbdir/cfgtoollogs/emca/HXBZZSJ/emca_2011_12_21_11_49_50.log.
Dec 21, 2011 11:50:31 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...