oracle 无法启动dbconsole .

当安装oracle10g 前后 网络情况发生变化、IP发生变化,机器名发生变化时,再次启动emctl都会发生错误,
OC4J Configuration issue. /u01/app/oracle/product/10.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_localhost.localdomain(也可能是机器名字)_SID not found.

解决方案如下:

$ export ORACLE_SID=zzlhy
注意SID的大小写
$ emctl status dbconsole
TZ set to PRC
OC4J Configuration issue. /u01/app/oracle/product/10.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_localhost.localdomain_ORCL not found.
$ ls /u01/app/oracle/product/10.2.0/db_1/oc4j/j2ee/
deploy_db.ini  home  isqlplus  oc4j_applications  OC4J_DBConsole  OC4J_DBConsole_localhost.localdomain_orcl  
发现没有OC4J_DBConsole_localhost.localdomain_zzlhy目录,也没有OC4J_DBConsole_机器名_zzlhy目录。
重新创建一个repository
$ emca -config dbcontrol db
STARTED EMCA at May 15, 2012 6:34:46 AM
EM Configuration Assistant, Version 10.2.0.1.0 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:
Database SID: zzlhy
Listener port number: 1521
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 ................ /u01/app/oracle/product/10.2.0/db_1

Database hostname ................ localhost.localdomain
Listener port number ................ 1521
Database SID ................ zzlhy
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............

-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: y
May 15, 2012 6:35:41 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/emca/zzlhy/emca_2012-05-15_06-34-46-AM.log                            .
May 15, 2012 6:35:56 AM oracle.sysman.emcp.util.FileUtil backupFile
WARNING: Could not backup file /u01/app/oracle/product/10.2.0/db_1/install/portlist.ini
May 15, 2012 6:35:56 AM oracle.sysman.emcp.util.FileUtil backupFile
WARNING: Could not backup file /u01/app/oracle/product/10.2.0/db_1/install/portlist.ini
May 15, 2012 6:35:56 AM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
May 15, 2012 6:37:37 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
May 15, 2012 6:37:37 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is http://localhost.localdomain:5500/em <<<<<<<<<<<
Enterprise Manager configuration completed successfully
FINISHED EMCA at May 15, 2012 6:37:37 AM
创建完成后再次查看,生成了OC4J_DBConsole_localhost.localdomain_zzlhy目录
$ ls /u01/app/oracle/product/10.2.0/db_1/oc4j/j2ee/
deploy_db.ini  home  isqlplus  oc4j_applications  OC4J_DBConsole  OC4J_DBConsole_localhost.localdomain_orcl  OC4J_DBConsole_localhost.localdomain_zzlhy
再次查看状态
$ emctl status dbconsole
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
http://localhost.localdomain:5500/em/console/aboutApplication
Oracle Enterprise Manager 10g is running.
------------------------------------------------------------------

Logs are generated in directory /u01/app/oracle/product/10.2.0/db_1/localhost.localdomain_zzlhy/sysman/log

二、基础知识

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

1、emca 的命令参数 

d:\oracle\product\10.2.0\db_1\bin\emca.bat [操作] [模式] [数据库类型] [标记] [参数] 
-h | --h | -help | --help: 打印此帮助消息 
-version: 打印版本 
-config dbcontrol db [-repos (create | recreate)] [-cluster] [-silent] [-backup][参数]: 配置数据库的 Database Control 
-config centralAgent (db | asm) [-cluster] [-silent] [参数]: 配置中心代理管理 
-config all db [-repos (create | recreate)] [-cluster] [-silent] [-backup] [参数]: 配置 Database Control 和中心代理管理


-deconfig dbcontrol db [-repos drop] [-cluster] [-silent] [参数]: 取消配置 Database Control 
-deconfig centralAgent (db | asm) [-cluster] [ -silent] [参数]: 取消配置中心代理管理 
-deconfig all db [-repos drop] [-cluster] [-silent] [参数]: 取消配置 Database Control 和中心代理管理

-addInst (db | asm) [-silent] [参数]: 为新的 RAC 实例配置 EM 
-deleteInst (db | asm) [-silent] [参数]: 取消为指定的 RAC 实例配置 EM

-reconfig ports [-cluster] [参数]: 重新明确分配 Database Control 端口 
-reconfig dbcontrol -cluster [-silent] [参数]: 重新配置 RAC Database Control 部署

-displayConfig dbcontrol -cluster [-silent] [参数]: 显示有关 RAC Database Control 配置的信息

-upgrade (db | asm | db_asm) [-cluster] [-silent] [参数]: 将较低版本的 EM 配置升级到当前版本

-restore (db | asm | db_asm) [-cluster] [-silent] [参数]: 将当前版本的 EM 配置复原到较低版本

参数和选项: 
[参数]: [ -respFile 文件名 ] [ -paramName paramValue ]* 
db: 对数据库 (包括使用 ASM 的数据库) 执行配置操作 
asm: 仅对 ASM 实例执行配置操作 
db_asm: 对数据库和 ASM 实例执行升级/复原操作 
-repos create: 创建新的 Database Control 资料档案库 
-repos drop: 删除当前的 Database Control 资料档案库 
-repos recreate: 删除当前的 Database Control 资料档案库并重新创建一个 
-cluster: 对 RAC 数据库执行配置操作 
-silent: 在不提示参数的情况下执行配置操作 
-backup: 配置数据库的自动备份

单实例数据库的参数 
        HOST: 数据库主机名 
        SID: 数据库 SID 
        PORT: 监听程序端口号 
        ORACLE_HOME: 数据库 ORACLE_HOME 
        HOST_USER: 自动备份的主机用户名 
        HOST_USER_PWD: 自动备份的主机用户口令 
        BACKUP_SCHEDULE: 自动备份调度 (HH:MM) 
        EMAIL_ADDRESS: 通知的电子邮件地址 
        MAIL_SERVER_NAME: 通知的发件 (SMTP) 服务器 
        ASM_OH: ASM ORACLE_HOME 
        ASM_SID: ASM SID 
        ASM_PORT: ASM 端口 
        ASM_USER_ROLE: ASM 用户角色 
        ASM_USER_NAME: ASM 用户名 
        ASM_USER_PWD: ASM 用户口令 
        SRC_OH: 要升级的数据库的 ORACLE_HOME 
        DBSNMP_PWD: DBSNMP 用户的口令 
        SYSMAN_PWD: SYSMAN 用户的口令 
        SYS_PWD: SYS 用户的口令 
        DBCONTROL_HTTP_PORT: Database Control HTTP 端口 
        AGENT_PORT: EM 代理端口 
        RMI_PORT: Database Control 的 RMI 端口 
        JMS_PORT: Database Control 的 JMS 端口

集群数据库的其它参数 
        CLUSTER_NAME: 集群名 
        DB_UNIQUE_NAME: 数据库的唯一名称 
        SERVICE_NAME: 服务名 
        EM_NODE: Database Control 节点名 
        EM_SID_LIST: 代理 SID 列表 [以逗号分隔]

emca 的一些常用命令 
ps:先设置ORACLE_SID环境变量 
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的端口,默认端口在1158 
emca -reconfig ports -dbcontrol_http_port 1160 
emca -reconfig ports -agent_port 3940

2、emctl 的命令参数 

Usage::
   Oracle Enterprise Manager 10g Database Control commands:
       emctl start| stop| status| setpasswd dbconsole
       emctl secure

       emctl set ssl test|off|on em
       emctl set ldap
emctl blackout options can be listed by typing "emctl blackout"
emctl config options can be listed by typing "emctl config"
emctl secure options can be listed by typing "emctl secure"
emctl ilint  options can be listed by typing "emctl ilint"
emctl deploy  options can be listed by typing "emctl deploy"
emctl start dbconsole 启动EM console服务 
emctl stop dbconsole 停止EM console服务 
emctl status dbconsole 查看EM console服务的状态
3 、 常用命令
配置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 无法启动dbconsole .)