配置oracle11g EM db control
创建一个EM资料库
emca -repos create
重建一个EM资料库
emca -repos recreate
删除一个EM资料库
emca -repos drop
配置数据库的 Database Control
emca -config dbcontrol db
删除数据库的 Database Control配置
emca -deconfig dbcontrol db
重新配置db control的端口,默认端口在1158
emca -reconfig ports
emca -reconfig ports -dbcontrol_http_port 1160
emca -reconfig ports -agent_port 3940
先设置ORACLE_SID环境变量后,启动EM console服务
emctl start dbconsole
先设置ORACLE_SID环境变量后,停止EM console服务
emctl stop dbconsole
先设置ORACLE_SID环境变量后,查看EM console服务的状态
emctl status dbconsole
配置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从10g以来一直大力推荐dba通过EM来进行管理,不管个人的喜好如何,都不能否认EM还是具有很强的易用性的。
前阵子装好了11g后,发现oracle11g文档很多快速管理指南的内容都是通过EM来进行的,但我在文档上并没找到EM的安装说明,于是试着通过10g的说明来对其进行配置。
从安装软件上看,我并没找到grid control部分,不知道是不是还没有推出,下面简单描述一下db control的配置过程以及遇到的几个问题。
跟10g的方法相仿,oracle11g也可以通过EMCA来配置db control(在装数据库时候用dbca可以同时创建em)
登陆oracle用户,执行emca -h命令后可以看到emca的各种配置参数及选项,具体参数的说明可以参考10g中的说明(可在Introduction to Enterprise Manager Advanced Configuration中找到)。执行emca -config dbcontrol db -repos create,按提示输入一些配置后,创建过程开始,可惜建到一半后,SYSAUX空间不足,报错退出了。看来自10G以后SYSAUX空间的要求越来越大了,这里要注意,不光是sysaux表空间,system表空间也要有足够的空闲。
扩展表空间后执行emca -config dbcontrol db -repos recreate准备重新开始创建,结果刚一开始就报错退出了,竟然是报没有tns监听,lsnrctl status检查监听是启的,用配置的tnsnames连接数据库也能连上,想了很久后怀疑跟监听没有采用动态注册方式有关,可按道理在一些缺省条件达成的情况的下,动态注册是自动生效的。lsnrctl status命令再看了一下,动态注册果然没有启动,没办法只能试试强制指定了,tnsnames里增加
listener1=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=oratest)(PORT=1521))
)
并指定local_listener=listener1后,动态注册立即生效了。至于为啥,我不知道,新特性还是bug?以后再说吧(10G没怎么玩过,不知道有没这个问题)
重新执行emca -config dbcontrol db -repos recreate,成功,开始drop以前的配置了,之后一切顺利,执行过程及结果消息如下:
$ emca -config dbcontrol db -repos recreate
STARTED EMCA at Aug 29, 2007 8:40:57 AM
EM Configuration Assistant, Version 11.1.0.5.0 Production
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Enter the following information:
Database SID: test11g
Listener port number: 1521
Password for SYS 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 ................ /oracle11g/product/11g
Local hostname ................ oratest
Listener port number ................ 1521
Database SID ................ test11g
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............
-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: Y
Aug 29, 2007 8:41:20 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /oracle11g/cfgtoollogs/emca/test11g/emca_2007_08_29_08_40_56.log.
Aug 29, 2007 8:41:30 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Aug 29, 2007 8:50:26 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Aug 29, 2007 8:50:28 AM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Aug 29, 2007 9:16:21 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Aug 29, 2007 9:17:05 AM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Aug 29, 2007 9:20:57 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfullyAug 29, 2007 9:21:22 AM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib
INFO: Software library configured successfully.
Aug 29, 2007 9:21:22 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Deploying Provisioning archives ...
Aug 29, 2007 9:26:27 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Provisioning archives deployed successfully.
Aug 29, 2007 9:26:27 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Aug 29, 2007 9:27:34 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Aug 29, 2007 9:27:34 AM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Aug 29, 2007 9:36:05 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Aug 29, 2007 9:36:08 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://oratest:1158/em <<<<<<<<<<<
Aug 29, 2007 9:37:50 AM 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: /oracle11g/product/11g/oratest_test11g/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 Aug 29, 2007 9:37:51 AM
emkey.ora是密钥的所在地所以如果在生成系统上还是需要备份好的。
$ more /oracle11g/product/11g/oratest_test11g/sysman/config/emkey.ora
KEY=056790FE22685160158605895E3E62FC06D7C153C224D99BAA82236AD677DD962B974B3BDA0A678E9D8278C75662EFEB5A8EB793695A79C131F79B8F8BDBBD03
80955F67D1BFBE675F5E20B9DC6B710A92
都完成之后,执行emctl status dbconsole可以查看状态,emctl start dbconsole和emctl stop dbconsole可以对Database Control Console Process进行启停。缺省端口依然跟10G一样是1158,不过似乎不在支持http,只能用https登陆。我从远程用ie7登陆的时候会警告证书是错误的(linux本地上没有问题),不用管它,继续就可以看到em的登陆界面了,呵呵。
界面看起来挺友好的,具体功能有待日后研究。