配置EM遇到的问题:*_orcl not found\listener not up\Error creating the repository
要想打开OEM的web管理程序,必须先启动Database listener,再启动Datebase Control端口监控程序,但是碰到下面的情况。
问题0:
[oracle@localhost OC4J_DBConsole]$ emctl start 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.
其实产生的这样的情况,可能是em资料库配置不正确或者是dbcotrol没有配置好
注:(1)如果服务器上存在多个数据库,必须在启动Database control之前设置ORACLE_SID环境变量:$ set oracle_sid=orcl
(2)最好使用静态IP地址来配置服务器
参考文章:http://jvilaikeo.com/?p=237
http://blog.csdn.net/huzia/article/details/6742307
http://blog.csdn.net/bamuta/article/details/7872138
http://www.linuxidc.com/Linux/2011-09/43898.htm
http://blog.itpub.net/28602568/viewspace-766317/
解决:
①重建em资料
[oracle@localhost OC4J_DBConsole]$ emca -repos recreate
...
Enter the following information:
Database SID: orcl
Listener port number: 1521
Password for SYS user: oracle
Password for SYSMAN user: oracle
Do you wish to continue? [yes(Y)/no(N)]: y
...
INFO: Repository successfully created
上面这一步并不一定成功,在你创建资料库的时候,依然会遇到问题:
问题1: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 .
[oracle@redhat ~]$ emca -repos recreate
.........
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 .
...........
问题1解决办法:
查看listener的状态
[oracle@redhat ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 01-AUG-2015 11:08:20
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=redhat.oracle.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 30-JUL-2015 23:30:54
Uptime 1 days 11 hr. 37 min. 26 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/redhat/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=redhat.oracle.com)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
这个状态说明listener已经起来,如果不是这个状态,
请启动监听:lsnrctl start
修改数据库register的状态:
$sqlplus / as sysdba
SQL>alter system register;
SQL>exit
然后在执行emca -repos recreate,发现问题还是没有解决,查看日志:
$ tail -n 50 /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2015_07_31_14_50_45.log
CONFIG: SQLEngine created successfully and connected
Aug 15, 2012 9:45:49 AM oracle.sysman.emcp.ParamsManager checkListenerStatusForDBControl
CONFIG: ORA-12541: TNS:no listener
oracle.sysman.assistants.util.sqlEngine.SQLFatalErrorException: ORA-12541: TNS:no listener
.....
at oracle.sysman.assistants.util.sqlEngine.SQLEngine.executeImpl(SQLEngine.java:1650)
.....
Aug 15, 2012 9:45: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 /apps/cfgtoollogs/emca/E7DEV/emca_2012_08_15_09_45_23.log for more details.
Aug 15, 2012 9:45:49 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)
.........
Aug 15, 2012 9:45:49 AM oracle.sysman.emcp.EMConfig restoreOuiLoc
CONFIG: Restoring oracle.installer.oui_loc to /apps/product/11.2.0/db_home/oui
处理方法:检查主机名:/etc/sysconfig/network、/etc/hosts、listenter.ora、tnsnames.ora、数据库中的主机名、oracle环境变量中的主机名 确保主机名的一致性。
[oracle@redhat ~]$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=redhat.oracle.com
[oracle@redhat ~]$ cat /etc/hosts
127.0.0.1 redhat.oracle.com localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.15.112 redhat redhat.oracle.com
[oracle@redhat ~]$
[oracle@redhat ~]$ cd /u01/app/oracle/product/11.2.0/db_1/network/admin/
[oracle@redhat admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = redhat.oracle.com)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
[oracle@redhat admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
NET_ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = redhat.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
[oracle@redhat ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Aug 1 11:38:06 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select utl_inaddr.get_host_address(host_name), host_name from v$instance;
UTL_INADDR.GET_HOST_ADDRESS(HOST_NAME)
--------------------------------------------------------------------------------
HOST_NAME
----------------------------------------------------------------
127.0.0.1
redhat.oracle.com
[oracle@redhat ~]$ echo $ORACLE_HOSTNAME
redhat.oracle.com
[oracle@redhat ~]$
[oracle@redhat ~ ]$ emca -repos recreate
...
Enter the following information:
Database SID: orcl
Listener port number: 1521
Password for SYS user: oracle
Password for SYSMAN user: oracle
Do you wish to continue? [yes(Y)/no(N)]: y
...
INFO: Repository successfully created
修改成一致之后就可以成功创建。祝你们好运。
问题2:Error creating the repository
[oracle@redhat ~]$ emca -repos recreate
STARTED EMCA at Jul 31, 2015 2:50:46 PM
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
Listener port number: 1521
Password for SYS user:
Password for SYSMAN user:
Password for SYSMAN user:
Do you wish to continue? [yes(Y)/no(N)]: Y
Jul 31, 2015 2:51:04 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2015_07_31_14_50_45.log.
Jul 31, 2015 2:51:05 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Jul 31, 2015 2:54:25 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Jul 31, 2015 2:54:25 PM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Jul 31, 2015 3:01:13 PM oracle.sysman.emcp.EMReposConfig invoke
SEVERE: Error creating the repository
Jul 31, 2015 3:01:13 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Refer to the log file at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_repos_create_<date>.log for more details.
Jul 31, 2015 3:01:13 PM oracle.sysman.emcp.EMConfig perform
SEVERE: Error creating the repository
Refer to the log file at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2015_07_31_14_50_45.log for more details.
Could not complete the configuration. Refer to the log file at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2015_07_31_14_50_45.log for more details.
查看日志:
$ tail -n 50 /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2015_07_31_14_50_45.log
Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.util.GeneralUtil isLocalConnectionRequired
......................
Aug 16, 2012 9:12:57 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:1650)
.........
Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.EMReposConfig invoke
SEVERE: Error creating the repository
Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.EMReposConfig invoke
...........
at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:521)
Aug 16, 2012 9:12:57 AM oracle.sysman.emcp.EMConfig restoreOuiLoc
问题2的解决办法:
手工重新配置dbconsole的步骤
1,修改DBSNMP密码:
重新配置DBCONSOLE,需要输入DBSNMP密码,但任何密码都会显示错误,需要预先修改。
sql>alter user dbsnmp identified by xxx;
2,删除早期DBCONSOLE创建的用户:
sql>drop role MGMT_USER;
sql>drop user MGMT_VIEW cascade;
sql>drop user sysman cascade;
3,删除早期DBCONSOLE创建的对象:
sql>drop PUBLIC SYNONYM MGMT_TARGET_BLACKOUTS;
sql>drop public synonym SETEMVIEWUSERCONTEXT;
4,重新创建DBCONSOLE:(如果是在windows下,要先到注册表删除DBCONSOLE的服务,重启电脑)
$emca -config dbcontrol db -repos create
根据提示,先输入SID,再输入Y继续;
输入端口1521,输入SYS密码,输入DBSNMP密码,输入SYSMAN 密码,输入Y继续
完成。