今天在安装11g(11.1.0.7.0)数据库之后,通过emca -config dbcontrol db -repos create 命令手工创建em的时候报错,查看日志后发现有以下错误
CONFIG: Spooling to C:\app\Administrator\cfgtoollogs\emca\orcl\emca_repos_create_2009_01_16_06_44_13.log
Jan 16, 2009 6:44:13 AM oracle.sysman.emcp.EMReposConfig createRepository INFO: Creating the EM repository (this may take a while) ... Jan 16, 2009 6:44:13 AM oracle.sysman.emcp.EMReposConfig createRepository CONFIG: ORA-20001: SYSMAN already exists.. ORA-06512: at line 17 oracle.sysman.assistants.util.sqlEngine.SQLFatalErrorException: ORA-20001: SYSMAN already exists.. ORA-06512: at line 17 at oracle.sysman.assistants.util.sqlEngine.SQLEngine.executeImpl(SQLEngine.java:1530) at oracle.sysman.assistants.util.sqlEngine.SQLEngine.executeScript(SQLEngine.java:880) at oracle.sysman.assistants.util.sqlEngine.SQLPlusEngine.executeScript(SQLPlusEngine.java:270) at oracle.sysman.assistants.util.sqlEngine.SQLPlusEngine.executeScript(SQLPlusEngine.java:311) at oracle.sysman.emcp.EMReposConfig.createRepository(EMReposConfig.java:492) at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:218) at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:147) at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:222) at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:535) at oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1215) at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:519) at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:468) Jan 16, 2009 6:44:13 AM oracle.sysman.emcp.EMReposConfig invoke SEVERE: Error creating the repository Jan 16, 2009 6:44:13 AM oracle.sysman.emcp.EMReposConfig invoke INFO: Refer to the log file at C:\app\Administrator\cfgtoollogs\emca\orcl\emca_repos_create_.log for more details. Jan 16, 2009 6:44:13 AM oracle.sysman.emcp.EMConfig perform SEVERE: Error creating the repository Refer to the log file at C:\app\Administrator\cfgtoollogs\emca\orcl\emca_2009_01_16_06_43_53.log for more details. Jan 16, 2009 6:44:13 AM oracle.sysman.emcp.EMConfig perform CONFIG: Stack Trace: oracle.sysman.emcp.exception.EMConfigException: Error creating the repository at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:230) at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:147) at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:222) at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:535) at oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1215) at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:519) at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:468)
经过同事提醒,才知道自己犯了一个很白痴的错误,在手工创建EM之前,需要先要删除EM配置信息:
具体操作如下 :
0、管理员方式启动cmd. 注意一定是管理员方式,否则后面的移动文件操作可能会造成失败。
1、使用emca -deconfig dbcontrol db命令删除配置
2、使用emca -repos drop删除repository
3、使用emca -config dbcontrol db -repos create 创建Database Control。
以上操作,也适用于10g。配置成功后,会有一下截图的提示内容。
总结:
这种错误,要查看日志文件的具体记录:如E:\Files\Oracle\cfgtoollogs\emca\orcl 中的日志文件
emca_2016_10_22_11_29_55.log
可以看到类似于下面的内容:
以上错误的提示内容为:
只要按照出错的日志提示,便可以找到问题的根本原因,而非根据网上的关键字搜索结果,去修改配置,结果弄巧成拙反而浪费了大量的时间。
参考文章