一
啓動電腦,到登陸界面,電腦報有個服務啓動失敗,電腦沒有新裝軟件,週六還沒有問題,怎麼突然報這個錯誤?於是到事件查看器中看看什麼問題,顯示是OracleDBConsoleorcl啓動失敗,到服務裏一看,確實沒有啓動。手動啓動一下,報錯誤碼2
我裝的是10g,於是到ORACLEproduct10.2.0db_1test_orclsysmanlog目錄看一下log裏寫了什麼,打開OracleDBConsoleorclsrvc.log.
log最後記錄的是:
————– [OracleDBConsoleorcl] ————
EMDROOT=c:oracleproduct10.2.0db_1
ORACLE_HOME=c:oracleproduct10.2.0db_1
EMDSTATE=c:oracleproduct10.2.0db_1wangzh_orcl
CONSOLE_CFG=dbconsole
TRACE_LEVEL=16
TIMEOUT=15
12/10/07 10:56:03 Start pending…
12/10/07 10:56:03 Verifying dbconsole is not started already. Command line "c:oracleproduct10.2.0db_1binemctl.bat" istatus dbconsole
12/10/07 10:56:04 dbconsole launch commandline is "c:oracleproduct10.2.0db_1binemctl.bat" istart dbconsole
12/10/07 10:56:04 Tracking process launch…
12/10/07 10:56:34 dbconsole exited with retCode 2.
12/10/07 10:56:34 Check c:oracleproduct10.2.0db_1test_orclsysmanlogemdbconsole.nohup for details
日誌讓看emdbconsole.nohup文件,目錄裏沒有這個文件呀。
手動執行一下emctl.bat,於是啓動控制檯,執行emctl.bat istart dbconsole,報錯,ORACLE_SID沒有定義,打開emctl.bat看看,這裏是定義環境變量的地方,其中已經設置了這些:
if not defined REMOTE_EMDROOT (set ORACLE_HOME=Ec:oracleproduct10.2.0db_1)
if not defined REMOTE_EMDROOT (set EMDROOT=%ORACLE_HOME%)
if defined REMOTE_EMDROOT (set ORACLE_HOME=%REMOTE_EMDROOT%)
if defined REMOTE_EMDROOT (set EMDROOT=%ORACLE_HOME%)
if defined REMOTE_EMDROOT (set LOCAL_EMDROOT=c:oracleproduct10.2.0db_1)
……
後邊還有一條設置:
if not defined DBCONSOLE_SERVICE_NAME (set DBCONSOLE_SERVICE_NAME=OracleDBConsole%ORACLE_SID%),用到了ORACLE_SID,但沒有看到前面設置,只能手動設置ORACLE_SID試試,於是加了一條設置:
if defined REMOTE_EMDROOT (set ORACLE_SID=orcl) orcl是我的數據庫實例名
到服務中啓動OracleDBConsoleorcl,ok,沒有報錯;
重新啓動計算機,也沒有報錯,OracleDBConsoleorcl服務也啓動了。
二
今天機器死機了,然後OracleDBConsoleORCL服務就起不來了,在一陣瞎搞後,還終於被我找到了解決辦法,方法如下: 運行Database Configuration Assistant程序,選擇“配置數據庫選項”重新配置Database Control 配置工具,配置完後端口號會變(我原來是1158,後來被改爲5500),可以在.\oracle\product\10.2.0\db_1\cfgtoollogs\emca\orcl\文件夾下,最後生成的一個日誌文件下找到新的Database Control 的URL;運行即可。 ******************************************************************************************************** (原來經常改IP會導致OracleDBConsoleORCL無法啓動,)一下是正規的解決方案: 修改你的主機參數文件 修改一下:
C:\WINDOWS\system32\drivers\etc下的host文件. 如果沒有的話就自己加一個IP和你的計算機名對應,如果已有了就把你的IP地址和你的計算機名對應起來. 如: # copyright (c) 1993-1999 microsoft corp. # # this is a sample hosts file used by microsoft tcp/ip for windows. # # this file contains the mappings of ip addresses to host names. each # entry should be kept on an individual line. the ip address should # be placed in the first column followed by the corresponding host name. # the ip address and the host name should be separated by at least one # space. # # additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # for example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host 127.0.0.1 localhost 192.168.1.104 wang-decjedi4h9 |
三
手工從cmd命令行啓動:C:\Documents and Settings\wangnc>emctl start dbconsole
Environment variable ORACLE_SID not defined. Please define it.
設置Oracle_sid環境變量:
C:\Documents and Settings\wangnc>set oracle_sid=orcl
C:\Documents and Settings\wangnc>emctl start dbconsole
OC4J Configuration issue. C:\oracle\product\10.2.0\db_1/oc4j/j2ee/OC4J_DBConsole_WWW-D79AC60CC61_orcl_orcl not found.
還是不行,到目錄 C:\oracle\product\10.2.0\db_1\oc4j\j2ee 下發現只有OC4J_DBConsole_localhost_orcl目錄,並沒有OC4J_DBConsole_sz-wangncD.cn.linecom.com_orcl這樣的目錄
複製目錄改成系統提示的文件夾名,再運行emctl start dbconsole
又會報一個類似的錯誤提示,另一個目錄,同樣處理。重啓後服務終於可以正常啓動了。
訪問 http://127.0.0.1:1158/em/ ok!
四
OracleDBConsoleorcl 服務無法啓動
C:>set oracle_sid=orcl
C:>emctl start dbconsole
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://JX02:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control ...OracleDBConsoleorcl
服務正在啓動 .
OracleDBConsoleorcl 服務無法啓動。
系統出錯。
系統發生 3 錯誤。
系統找不到指定的路徑。
////以上是啓動時的錯誤 ,我的數據庫是oracle10.2.0.1.0 的版本
解決方法:
在命令行輸入
$ emca –config dbcontrol db
輸入以下信息:
SID:XXXX
Listener port number: 1521
Sys 口令:******
……
好了,再次emctl start dbconsole EM就可以正常運行了!