之前在自己的测试环境上做了个异机恢复,原来的库上是配置过EM的,但是在恢复的库上去启动EM就报错了,下面看具体解决过程:
PS:原主机名为zlm,恢复出来的主机名为bak
[root@bak ~]# su - Oracle
[oracle@bak ~]$ emctl status dbconsole
TZ set to PRC
OC4J Configuration issue. /u01/app/oracle/product/10.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_bak_ora10g not found.
[oracle@bak ~]$ cd /u01/app/oracle/product/10.2.0/db_1/oc4j/j2ee/
[oracle@bak j2ee]$ ll
total 24
-rw-r--r-- 1 oracle oinstall 256 Aug 22 16:42 deploy_db.ini
drwxr-x--- 15 oracle oinstall 4096 Aug 22 16:29 home
drwxr-x--- 9 oracle oinstall 4096 Aug 22 16:24 isqlplus
drwxr-x--- 3 oracle oinstall 4096 Aug 22 16:24 oc4j_applications
drwxr-x--- 5 oracle oinstall 4096 Aug 22 16:24 OC4J_DBConsole
drwxr-x--- 7 oracle oinstall 4096 Aug 25 11:25 OC4J_DBConsole_zlm_ora10g
既然提示文件找不到,很显然是因为主机名变更的缘故,那么把名字变一下,用mv命令
[oracle@bak j2ee]$ mv -r OC4J_DBConsole_zlm_ora10g/ OC4J_DBConsole_bak_ora10g/
[oracle@bak j2ee]$ ll
total 24
-rw-r--r-- 1 oracle oinstall 256 Aug 22 16:42 deploy_db.ini
drwxr-x--- 15 oracle oinstall 4096 Aug 22 16:29 home
drwxr-x--- 9 oracle oinstall 4096 Aug 22 16:24 isqlplus
drwxr-x--- 3 oracle oinstall 4096 Aug 22 16:24 oc4j_applications
drwxr-x--- 5 oracle oinstall 4096 Aug 22 16:24 OC4J_DBConsole
drwxr-x--- 7 oracle oinstall 4096 Oct 20 10:58 OC4J_DBConsole_bak_ora10g
[oracle@bak j2ee]$ emctl status dbconsole
TZ set to PRC
EM Configuration issue. /u01/app/oracle/product/10.2.0/db_1/bak_ora10g not found.
[oracle@bak j2ee]$ cd /u01/app/oracle/product/10.2.0/db_1/
[oracle@bak db_1]$ ll
total 260
drwxr-x--- 7 oracle oinstall 4096 Aug 22 16:24 assistants
drwxr-xr-x 2 oracle oinstall 12288 Aug 22 16:42 bin
drwxr-x--- 3 oracle oinstall 4096 Aug 22 16:33 cdata
drwxr-x--- 6 oracle oinstall 4096 Aug 25 11:08 cfgtoollogs
drwxr-x--- 4 oracle oinstall 4096 Aug 22 16:24 clone
drwxr-x--- 2 oracle oinstall 4096 Aug 22 16:33 config
drwxr-x--- 6 oracle oinstall 4096 Aug 22 16:24 crs
drwxr-x--- 7 oracle oinstall 4096 Aug 22 16:33 css
drwxr-x--- 10 oracle oinstall 4096 Aug 22 16:33 ctx
drwxr-x--- 2 oracle oinstall 4096 Oct 20 09:17 dbs
drwxr-x--- 3 oracle oinstall 4096 Aug 22 16:24 demo
drwxr-x--- 3 oracle oinstall 4096 Aug 22 16:24 diagnostics
drwxr-x--- 3 oracle oinstall 4096 Aug 22 16:24 has
drwxr-x--- 6 oracle oinstall 4096 Aug 22 16:42 hs
drwxr-x--- 5 oracle oinstall 4096 Aug 25 11:27 install
-rw-r----- 1 oracle oinstall 37 Aug 22 16:24 install.platform
drwxr-x--- 12 oracle oinstall 4096 Aug 22 16:42 inventory
drwxr-x--- 7 oracle oinstall 4096 Aug 22 16:24 javavm
drwxr-x--- 4 oracle oinstall 4096 Aug 22 16:31 jdbc
drwxr-x--- 7 oracle oinstall 4096 Aug 22 16:32 jdk
drwxr-x--- 2 oracle oinstall 4096 Aug 22 16:32 jlib
drwxr-x--- 3 oracle oinstall 4096 Aug 22 16:24 jre
drwxr-x--- 13 oracle oinstall 4096 Aug 22 16:33 ldap
drwxr-x--- 3 oracle oinstall 12288 Aug 22 16:42 lib
drwxr-x--T 3 oracle oinstall 4096 Aug 25 11:24 log
drwxr-x--- 6 oracle oinstall 4096 Aug 22 16:24 md
drwxr-x--- 2 oracle oinstall 4096 Aug 22 16:25 mesg
drwxr-x--- 7 oracle oinstall 4096 Aug 22 16:32 mgw
drwxr-x--- 11 oracle oinstall 4096 Aug 22 16:42 network
drwxr-x--- 6 oracle oinstall 4096 Aug 22 16:24 nls
drwxr-x--- 15 oracle oinstall 4096 Aug 22 16:42 oc4j
drwxr-x--- 6 oracle oinstall 4096 Aug 22 16:24 odbc
drwxr-x--- 5 oracle oinstall 4096 Aug 22 16:24 olap
drwxr-x--- 4 oracle oinstall 4096 Aug 22 16:32 OPatch
drwxr-x--- 7 oracle oinstall 4096 Aug 22 16:32 opmn
drwxr-x--- 4 oracle oinstall 4096 Aug 22 16:24 oracore
-rw-r--r-- 1 oracle oinstall 63 Aug 22 16:22 oraInst.loc
drwxr-x--- 8 oracle oinstall 4096 Aug 22 16:24 ord
drwxr-x--- 7 oracle oinstall 4096 Aug 22 16:32 oui
drwxr-x--- 4 oracle oinstall 4096 Aug 22 16:24 owm
drwxr-x--- 6 oracle oinstall 4096 Aug 22 16:24 perl
drwxr-x--- 7 oracle oinstall 4096 Aug 22 16:25 plsql
drwxr-x--- 7 oracle oinstall 4096 Aug 22 16:24 precomp
drwxr-x--- 7 oracle oinstall 4096 Aug 22 16:33 racg
drwxr-x--- 13 oracle oinstall 4096 Aug 22 16:42 rdbms
drwxr-x--- 4 oracle oinstall 4096 Aug 22 16:31 relnotes
-rwxr-xr-x 1 oracle oinstall 9522 Aug 22 16:42 root.sh
-rwxr-xr-x 1 oracle oinstall 0 Jun 7 2005 root.sh.old
drwxr-x--- 3 oracle oinstall 4096 Aug 22 16:24 slax
drwxr-x--- 3 oracle oinstall 4096 Aug 22 16:24 sqlj
-rw-r----- 1 oracle oinstall 9338 Aug 25 11:42 sqlnet.log
drwxr-x--- 9 oracle oinstall 4096 Aug 22 16:33 sqlplus
drwxr-x--- 12 oracle oinstall 4096 Aug 22 16:33 srvm
drwxr-x--- 12 oracle oinstall 4096 Aug 22 16:33 sysman
drwxr-x--- 4 oracle oinstall 4096 Aug 22 16:24 uix
drwxr-x--- 3 oracle oinstall 4096 Aug 22 16:24 wwg
drwxr-x--- 6 oracle oinstall 4096 Aug 22 16:30 xdk
drwxr----- 3 oracle oinstall 4096 Aug 25 11:25 zlm_ora10g
这次是找不到zlm_ora10g目录,同样的,也mv为bak_ora10g
[oracle@bak db_1]$ mv zlm_ora10g bak_ora10g
[oracle@bak db_1]$ 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.
:1158/em/console/aboutApplication
Oracle Enterprise Manager 10g is not running.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/10.2.0/db_1/bak_ora10g/sysman/log
[oracle@bak j2ee]$ emctl start 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.
:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control .................................. started.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/10.2.0/db_1/bak_ora10g/sysman/log
无法启动,看到url里的信息是原主机zlm,分析一下提示的错误日志
[oracle@bak j2ee]$ cd /u01/app/oracle/product/10.2.0/db_1/bak_ora10g/sysman/log
[oracle@bak log]$ ll
total 1656
-rw-r----- 1 oracle oinstall 180 Aug 25 11:28 emagentfetchlet.log
-rw-r----- 1 oracle oinstall 180 Aug 25 11:28 emagentfetchlet.trc
-rw-r----- 1 oracle oinstall 500 Oct 20 11:06 emagent.log
-rw-r----- 1 oracle oinstall 42010 Oct 20 11:14 emagent.trc
-rw-r----- 1 oracle oinstall 9816 Oct 20 11:05 emdb.nohup
-rw-r----- 1 oracle oinstall 4096 Oct 20 11:05 emdb.nohup.lr
-rw-r----- 1 oracle oinstall 0 Aug 25 11:25 emdctl.log
-rw-r----- 1 oracle oinstall 7330 Oct 20 11:14 emdctl.trc
-rw-r----- 1 oracle oinstall 802261 Aug 25 11:45 emoms.log
-rw-r----- 1 oracle oinstall 802261 Aug 25 11:45 emoms.trc
[oracle@bak log]$ cat emoms.log