客户的服务器启动不了em
报错Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name.
需要做的比对
1,oracle 目录下的TNS 、LSN配置文件hostname
2,linux /etc/hosts 里的hostname
3,oracle 用户下 .bash_profile 或者是 .bashrc
能配置hostname的地方是否都一致
我出现的问题是,用户改动过hostname , oracle 下的.bash_profile 申明的hostanme 和oracle 数据库的不一致所以报错,修改一致
source .bash_profile 可以使用
如果你确认hostname 和 sid 实例名都没有错
那么建议你进行emc重建操作
$ sqlplus / as sysdba
SQL> alter user dbsnmp identified by py123456;
User altered.
SQL> drop role MGMT_USER;
Role dropped.
SQL> drop user MGMT_VIEW cascade;
User dropped.
SQL> drop user sysman cascade;
User dropped.
SQL> drop user sysman cascade;
SQL> drop PUBLIC SYNONYM MGMT_TARGET_BLACKOUTS;
Synonym dropped.
SQL> drop public synonym SETEMVIEWUSERCONTEXT;
Synonym dropped.
SQL>quit
$ emca -config dbcontrol db -repos create
进行创建操作
STARTED EMCA at May 26, 2017 10:37:01 AM
EM Configuration Assistant, Version 11.2.0.3.0 Production
Copyright (c) 2003, 2011, Oracle. All rights reserved.
Enter the following information:
Database SID: oracle11
log4j:WARN No appenders could be found for logger (emSDK.config).
log4j:WARN Please initialize the log4j system properly.
Listener port number:
Listener ORACLE_HOME [ ]:
Password for SYS user:
Password for DBSNMP user:
Password for SYSMAN user:
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
WARNING: ORA-00955: name is already used by an existing object--- 告警这个的话是配置没清除干净
使用
$ emca -config dbcontrol db -repos recreate
执行
按步骤操作
最后可以使用em