EMCA创建em资料库时报错

说明:监听程序配置及启动正常。实例运行正常,远程或是本地sqlplus连接实例也正常。主机名显示正常,与主机名相关三个配置文件也没问题。

emca报错:

[oracle@rusky-oracle11g admin]$ emca -config dbcontrol db

STARTED EMCA at Apr 2, 2015 9:27:10 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: orcl
log4j:ERROR No appenders could be found for category (emSDK.config). (报错1) log4j:ERROR Please initialize the log4j system properly.
Listener port number:

 ……

Do you wish to continue? [yes(Y)/no(N)]: yes
Apr 2, 2015 9:42:48 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2015_04_02_09_34_33.log.
Apr 2, 2015 9:42:49 AM oracle.sysman.emcp.EMConfig perform
SEVERE: Listener is not up or database service is not registered with it. Start the Listener and register database service and run EM Configuration Assistant again .
Refer to the log file at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2015_04_02_09_34_33.log for more details.
Could not complete the configuration. Refer to the log file at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2015_04_02_09_34_33.log for more details. (报错2)
[oracle@rusky-oracle11g admin]$

 

详细错误日志如下:

/u01/app/oracle/cfgtoollogs/emca/orcl/emca_2015_04_02_09_22_12.log
CONFIG: ORA-12545: Connect failed because target host or object does not exist

oracle.sysman.assistants.util.sqlEngine.SQLFatalErrorException: ORA-12545: Connect failed because target host or object does not exist

        at oracle.sysman.assistants.util.sqlEngine.SQLEngine.executeImpl(SQLEngine.java:1650)
        at oracle.sysman.assistants.util.sqlEngine.SQLEngine.executeSql(SQLEngine.java:1898)
        at oracle.sysman.emcp.ParamsManager.checkListenerStatusForDBControl(ParamsManager.java:3230)
        at oracle.sysman.emcp.EMReposConfig.unlockMGMTAccount(EMReposConfig.java:1000)
        at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:345)
        at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:157)
        at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:253)
        at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:589)
        at oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1448)
        at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:573)
        at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:521)
Apr 2, 2015 9:22:30 AM oracle.sysman.emcp.EMConfig perform
SEVERE: Listener is not up or database service is not registered with it. Start the Listener and register database service and run EM Configuration Assistant again .
Refer to the log file at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2015_04_02_09_22_12.log for more details.
Apr 2, 2015 9:22:30 AM oracle.sysman.emcp.EMConfig perform
CONFIG: Stack Trace: 
oracle.sysman.emcp.exception.EMConfigException: Listener is not up or database service is not registered with it. Start the Listener and register database service and run EM Configuration Assistant again .
        at oracle.sysman.emcp.ParamsManager.checkListenerStatusForDBControl(ParamsManager.java:3245)
        at oracle.sysman.emcp.EMReposConfig.unlockMGMTAccount(EMReposConfig.java:1000)
        at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:345)
        at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:157)
        at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:253)
        at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:589)
        at oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1448)
        at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:573)
        at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:521)
Apr 2, 2015 9:22:30 AM oracle.sysman.emcp.EMConfig restoreOuiLoc
CONFIG: Restoring oracle.installer.oui_loc to /u01/app/oracle/product/11.2.0.1/db_1/oui

 

从错误日志可看出,应该是跟target host和listener相关。

解决办法:
[root@rusky-oracle11g ~]# cat /etc/hosts  该文件配置错误
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost    --此处写错,原来为localhost.domain
192.168.1.203 rusky-oracle11g.com rusky-oracle11g

 

手动注册监听: SQL> conn sys/sys as sysdba Connected. SQL> alter system register; System altered

重新创建EMCA资料库:(未出现错误1)

[oracle@rusky-oracle11g admin]$ emca -config dbcontrol db

STARTED EMCA at Apr 2, 2015 9:34:33 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: 
……
出现错误2:
oracle.sysman.emcp.exception.EMConfigException: Listener is not up or database service is not registered with it. Start the Listener and register database service and run EM Configuration Assistant again . at oracle.sysman.emcp.ParamsManager.checkListenerStatusForDBControl(ParamsManager.java:3245) at oracle.sysman.emcp.EMReposConfig.unlockMGMTAccount(EMReposConfig.java:1000) at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:345) at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:157) at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:253) at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:589) at oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1448) at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:573) at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:521) Apr 2, 2015 9:22:30 AM oracle.sysman.emcp.EMConfig restoreOuiLoc CONFIG: Restoring oracle.installer.oui_loc to /u01/app/oracle/product/11.2.0.1/db_1/oui

==================

各种折腾,还是报同样的错, 后来也出现上面的错误1,因此可推断错误1跟/etc/hosts没关系。

在dbca下重新配置emca也报错:
EMCA创建em资料库时报错_第1张图片
使用命令再次创建时也报错:
EMCA创建em资料库时报错_第2张图片
Refer to the log file at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2015_04_02_09_22_12.log for more details.根据上多次出现的该提示,找到文件中的如下错误:

EMCA创建em资料库时报错_第3张图片

No value was set for the parameter ORACLE_HOME.

ORA-12545:connect failed because target host or object does not exist.

每次都提示错误目标主机ORACLE_HOSTNAEM,  rusky-oel.com不正确或不存在。我配置的正确的主机名为rusky-oracle11g.com。

/home/oracle/.bash_profile 最后发现该文件内ORACLE_HOSTNAME配置有错,修改为正确的rusky-oracle11g.com后,重新配置emca正常。

ORACLE_HOSTNAME=rusky-oel.com; export ORACLE_HOSTNAME

好坑爹的错误,折腾了两天。

你可能感兴趣的:(创建)