Solution to Environment variable ORACLE_UNQNAME not defined error reported by CentOS Oracle, environmentvariable

Source: Internet
Author: User

Solution to Environment variable ORACLE_UNQNAME not defined error reported by CentOS Oracle, environmentvariable

After installing Oracle on CentOS today, the "Environment variable ORACLE_UNQNAME not defined" error is reported when the "emctl start dbconsole" command is run to start the management console. The cause is that Oracle cannot obtain the correct IP address (the IP address obtained when Oracle is installed is incorrect), which leads to a problem in em. You only need to reconfigure emca. After a long time, I finally solved the problem.

Environment Description

Operating System: CentOS 6.5
IP: 192.168.132.41
Domain: mycompany.com.cn
Host Name: hemw-pc
Oracle: 11gR2, installation directory:/opt/oracle/11g

Problem Analysis

At the beginning, use the "emca-config dbcontrol db-repos create" command to re-create the em according to the online solution. after entering the corresponding information, the obtained IP address is always incorrect (the Local hostname should be 192.168.132.41 ):

-----------------------------------------------------------------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 ............... -----------------------------------------------------------------
The obtained hostname value is incorrect, causing the creation to fail. The following error message is displayed:

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

After a variety of attempts and hard work, the problem was finally solved. 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 10 17:16:45 2015Copyright (c) 1982, 2009, Oracle.  All rights reserved.Enter password: Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> shutdown

3. Modify $ ORACLE_HOME/network/admin/Listener. oraTo change the HOST value in the file content to the correct IP address (192.168.132.41), for example:

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. oraTo change the HOST value in the file content to the correct IP address (192.168.132.41), for example:
ORCL =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.132.41)(PORT = 1521))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = orcl)    )  )
5. Modify/etc/sysconfig/network and change the file content:
NETWORKING=yesNETWORKING_IPV6=noHOSTNAME=hemw-pc

Because the modified file takes effect only after the operating system is restarted, You need to execute the following command without restarting the operating system: # hostname hemw-pc

6. Modify/etc/hosts and add the following content 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 the listener

$ lsnrctl start
9. delete users created on the early DBCONSOLE:
sql>drop role MGMT_USER;sql>drop user MGMT_VIEW cascade;sql>drop user sysman cascade;
10. Delete the objects created on the early DBCONSOLE:
sql>drop PUBLIC SYNONYM MGMT_TARGET_BLACKOUTS;sql>drop public synonym SETEMVIEWUSERCONTEXT;
11. re-create DBCONSOLE: (if it is in windows, first go to the Registry to delete the DBCONSOLE service and restart the computer)
$emca -config dbcontrol db -repos create
If the creation fails, the output is similar to "cocould not complete the configuration. refer to the log file at/opt/oracle/export toollogs/emca/orcl/emca _*. log for more details. "error message, view the corresponding log file, the last line of the log file if it is" ORA-00955: name is already used by an existing object ", such:
CREATE PUBLIC SYNONYM MGMT_AVAILABILITY FOR MGMT_AVAILABILITY                      *ERROR at line 1:ORA-00955: name is already used by an existing object
You need to execute a reconstruction command:
$emca -config dbcontrol db -repos recreate
During the execution of the preceding command, enter the corresponding database information and the logon passwords SYS, DBSNMP, and SYSMAN as prompted. Then, enter Y to confirm the logon password. For example:
STARTED EMCA at Mar 10, 2015 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 ]: Password for SYS user:  Password for DBSNMP user:  Password for SYSMAN user:  Email address for notifications (optional): Outgoing Mail (SMTP) server for notifications (optional):
12. Check the em status
$ emctl status dbconsoleOracle Enterprise Manager 11g Database Control Release 11.2.0.1.0 Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.https://hemw-pc:1158/em/console/aboutApplicationOracle Enterprise Manager 11g is running. ------------------------------------------------------------------Logs are generated in directory /opt/oracle/11g/hemw-pc_orcl/sysman/log
Now, the problem has been solved.

Appendix: Common commands of emca to create an em Database: emca-repos create
Re-create an em Database: emca-repos recreate
Delete An em Database: emca-repos drop
 
Configure Database Control for the Database: emca-config dbcontrol db
Delete the Database Control Configuration of the Database: emca-deconfig dbcontrol db
 
Reconfigure the Database control port. The default port is 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
After setting the ORACLE_SID environment variable, stop the em console service: emctl stop dbconsole
After setting the ORACLE_SID environment variable, check the em console service status: emctl status dbconsole

Steps for configuring dbconsole
Emca-repos create
Emca-config dbcontrol db
Emctl start dbconsole
 
To reconfigure dbconsole
Emca-repos drop
Emca-repos create
Emca-config dbcontrol db

Emctl start dbconsole


References:
Http://soulful.blog.51cto.com/468033/449934
Http://czhwin.iteye.com/blog/1847366

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.