After Oracle was installed on CentOS today, the "environment variable oracle_unqname not defined" error was reported when starting the management console with the command "Emctl start Dbconsole". The problem is because Oracle always gets the correct IP address (the IP address acquired when the Oracle is installed is wrong), causing EM to have problems, just reconfigure the EMCA. Toss for a long time, finally finally put the problem to solve.
Environment description
Operating system: CentOS 6.5
ip:192.168.132.41
Domain: mycompany.com.cn
Host Name: HEMW-PC
ORACLE:11GR2, the installation directory is/opt/oracle/11g
Problem analysis
Just beginning to follow the online solution using the command "Emca-config Dbcontrol db-repos create" to recreate EM, after entering the corresponding information, to the final confirmation when the IP address obtained is always incorrect (Local hostname should be 192.1 68.132.41 only):
-----------------------------------------------------------------you have specified the following settingsdatabase Oracle_home ...../opt/oracle/11glocal hostname ............... ..... ... 192.168.64.61Listener oracle_home ...../opt/oracle/11glistener port number ............. ..... .....-------. 1521Database SID ..... orclemail address for notifications .................. Outgoing Mail (SMTP) server for notifications.....------------------------------------------------------- ----------
Failed to create successfully because the hostname value obtained is incorrect, prompting the following error
Could not complete the configuration. Refer to the log file At/opt/oracle/cfgtoollogs/emca/orcl/emca_2015_03_10_17_19_30.log for more details.
Solution Solutions
After a variety of attempts and toss, the end is to fix the problem, the steps are as follows:
1. Stop the Listener
$ lsnrctl Stop
2. Stop the Oracle Database
$ sqlplus "Sys/as sysdba" Sql*plus:release 11.2.0.1.0 Production on Tue Mar 17:16:45 2015Copyright (c) 1982,, Or Acle. All rights reserved. Enter password:connected to:oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit productionwith the Partitio Ning, OLAP, Data Mining and Real application testing optionssql> shutdown
3. Modify the $ORACLE _home/network/admin/listener.oraTo change the value of HOST in the file contents to the correct IP (192.168.132.41), such as:
LISTENER = (description_list = ( DESCRIPTION = ( address = (PROTOCOL = IPC) (KEY = EXTPROC1521)) (address = (PROTOCOL = TCP) (HOST = 192.168.132.41) (PORT = 1521))))
4. Modify $ORACLE _home/network/admin/
Tnsnames.ora, change the value of HOST in the file content to the correct IP (192.168.132.41), such as:
ORCL = (DESCRIPTION = ( ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.132.41) (PORT = 1521)) (Connect_data = ( SERVER = dedicated) (service_name = ORCL) ) )
5. Modify the/etc/sysconfig/network to change the contents of the file to:
Networking=yesnetworking_ipv6=nohostname=hemw-pc
Because you need to restart the operating system after modifying this file to take effect, you need to execute it at the same time without restarting the operating system: # hostname HEMW-PC
6. Modify the/etc/hosts, add the following at the end of the file:
192.168.132.41 hemw-pc hemw-pc.mycompany.com.cn
7. Start the database
Sql> Startup
8. Start monitoring
$ lsnrctl Start
9. Delete the user who created the earlier dbconsole:
Sql>drop role Mgmt_user;sql>drop user mgmt_view Cascade;sql>drop user Sysman cascade;
10. Delete the objects created by the earlier dbconsole:
Sql>drop public synonym Mgmt_target_blackouts;sql>drop public synonym setemviewusercontext;
11. Re-Create the Dbconsole: (if it is under Windows, to the registry to remove the Dbconsole service, restart the computer)
$EMCA-config Dbcontrol Db-repos Create
If the prompt creation fails, the output is similar to the Could not complete the configuration. Refer to the log file At/opt/oracle/cfgtoollogs/emca/orcl/emca_*.log for more details. "Error message, please view the corresponding log file, the last line of the log files if it is "Ora-00955:name is already used by an existing object", such as:
CREATE public synonym mgmt_availability for mgmt_availability *error on line 1:ora-00955:name was already used by an E Xisting Object
You need to perform a rebuild command:
$EMCA-config Dbcontrol Db-repos recreate
In the process of executing the above command, you need to enter the corresponding database information and the login password of SYS, Dbsnmp and Sysman, and finally enter Y to confirm, such as:
STARTED EMCA at Mar, 10:03:17 pmem Configuration Assistant, Version 11.2.0.0.2 Productioncopyright (c) 2003, 2005, Oracle. All rights reserved. Enter the following information:database sid:orcllistener Port Number:1521listener oracle_home [/opt/oracle/11g]: Pass Word for SYS User: Password for DBSNMP User: Password for Sysman User: E -mail address for notifications (option AL): Outgoing Mail (SMTP) server for notifications (optional):
12. Check the status of EM
$ emctl Status dbconsoleoracle Enterprise Manager 11g Database Control Release 11.2.0.1.0 Copyright (c) 1996, Oracle Corporation. All rights reserved.https://hemw-pc:1158/em/console/aboutapplicationoracle Enterprise Manager 11g is running. ------------------------------------------------------------------Logs is generated in directory/opt/oracle/11g/ Hemw-pc_orcl/sysman/log
At this point, the problem has been resolved.
Attached: EMCA common commands to create an EM repository: Emca-repos
Rebuilding an EM repository: Emca-repos recreate
Delete an em repository: Emca-repos drop
Database Control:emca-config Dbcontrol db for the metabase
To delete the database control configuration for the databases: Emca-deconfig Dbcontrol db
Reconfigure the port for DB control, the default port at 1158
Emca-reconfig ports
Emca-reconfig Ports-dbcontrol_http_port 1160
Emca-reconfig Ports-agent_port 3940
After setting the ORACLE_SID environment variable, start the EM console service: Emctl start Dbconsole
Stop the EM console service after setting the ORACLE_SID environment variable first: Emctl stop Dbconsole
After setting the ORACLE_SID environment variable, check the status of the EM console service: Emctl status Dbconsole
Steps to configure Dbconsole
Emca-repos Create
Emca-config Dbcontrol DB
Emctl Start Dbconsole
Steps to reconfigure Dbconsole
Emca-repos Drop
Emca-repos Create
Emca-config Dbcontrol DB
Emctl Start Dbconsole
Resources:
http://soulful.blog.51cto.com/468033/449934
http://czhwin.iteye.com/blog/1847366
CentOS Oracle Report environment variable oracle_unqname not defined error resolution