What’s ORACLE_UNQNAME?
It started with a three part question: What’s the URL to run the DB Console for Oracle Database 11gR2 on Windows 7, and what’s the ORACLE_UNQNAME and why isn’t it defined by the installation. The first part is easy (shown further below), but the second and third parts were more involved.
The ORACLE_UNQNAME is an operating system environment variable that holds the database’s unique name value. You can find it with the following query as the SYSTEM user (through SQL*Plus):
SELECT name, db_unique_name FROM v$database; |
By the way, it’s not set as a Windows environment variable by default. You would need to do that manually (an example of setting an environment variable is here). The Oracle Universal Installer (OUI) actually used it to configure the already running DB Console service (with a successful installation). Once there, it didn’t need to set it as a system-level environment variable.
You may be wondering what generated the question if there’s already a configured service. You encounter the error when dropping down to the command line. First, you verify that the ports are running with this command:
C:\> netstat -an | findstr /C:1158 TCP 0.0.0.0:1158 0.0.0.0:0 LISTENING |
While this blog discusses the hard way to determine whether the DB Console is running, you can simply open the Windows Services to see whether the DB Console is running. Likewise, if you know the URL, enter it in your browser. Assuming you don’t know how to do either or are just a gluten for the command line, the rest of this post is important.
You can see your Windows services by typing services.msc in the Start->Run Command field. That way you don’t need to navigate the various links that differ between Windows releases.
Many know that you can check the status of the running DB Console with the emctl utility at the command line. It lets you find the URL that you should enter for the DB Console in a browser. This knowledge is where users encounter the problem with %ORACLE_UNQNAME% environment variable ($ORACLE_UNQNAME on Linux or Unix).
For example, running the following command raises an error that instructs you to set the %ORACLE_UNQNAME% environment variable. Although, it leaves many wondering what’s the right value to enter.
C:\> emctl status dbconsole Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name. |
If you object to using the Windows services to start and stop the OEM tool, you can do it at the command-line like the status example above. Having set the environment variables, you can start the DB console with this command-line syntax:
C:\> emctl start dbconsole |
Having set the environment variables, you can stop the DB console with this command-line syntax:
C:\> emctl stop dbconsole |
It’s not hard to find this information when you know how. While the error message complains about one environment variable, there are actually two environment values you need to set. They are: %ORACLE_HOSTNAME% and %ORACLE_UNQNAME%.
You can find them by navigating to the %ORACLE_HOME%\oc4j\j2ee\ folder (or directory). The file name of the DB Console file tells you the values for these environment variables because they’re embedded in the file’s name. A snapshot from Windows Explorer shows them both.
You can set these environment variables as shown below in command shell of Windows (Linux or Unix users should use terminal), and then successfully run emctl from the command line.
C:\>set ORACLE_HOSTNAME=localhost C:\>set ORACLE_UNQNAME=orcl C:\>emctl status dbconsole Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0 Copyright (c) 1996, 2010 Oracle Corporation. All rights reserved. https://localhost:1158/em/console/aboutApplication Oracle Enterprise Manager 11g is running. ------------------------------------------------------------------ Logs are generated in directory C:\app\McLaughlinM\product\11.2.0\dbhome_1/localhost_orcl/sysman/log |
If you’re using Linux or Unix, the export commands differ. You can check this other post for those. They under step 8 in that post.
You then enter the following URL in a browser to use the newly installed DB Console:
https://localhost:1158/em |
The browser will prompt you with a security warning like the following:
Click the Add Exception button and you’ll see the following Windows dialog.
Having granted the exception, you arrive at the following credential web page. Connect as the SYSDBA using the SYS user’s account when you require extraordinary privileges. Doing so, shows a security risk in the console. You should connect as the SYSTEM user with NORMAL access generally, as shown below.
The following home page shows after your credentials are validated.
Hope that helps those trying to sort out running the DB Console and finding the magic %ORACLE_UNQNAME% value. Check this other blog post for instructions to reconfigure OEM.






[...] next step running OEM [...]
Install Oracle 11gR2
23 Aug 12 at 10:41 pm
A great help for a complicated problem that otherwise requires tedious methodical work! I hope this shows up at the top of Google search results
Mike S.
24 Aug 12 at 7:43 am
Why don’t you connect as SYS using SYSDBA? How to you start and stop the database as the SYSTEM user?
Jordan Smith
26 Aug 12 at 9:49 pm
Jordan, I’ve answered the question about starting and stopping the database in this blog post.
Start and stop Server from OEM
1 Sep 12 at 1:17 am
Hi,
I have followed the above steps but it is showing me “Oracle Enterprise Manager 11g is not running.”
can you please help me with this problem?
should we need to set environmental variables when ever we open the console.
Daram
7 Sep 12 at 10:36 pm
Did an error occur during the installation? Did you make sure that the
hostnamecorresponds to thehostsfile content? What did you see in the log files? Check the pre-requisites in this Oracle 11gR2 installation post.Open
services.mscand check whether or not the Oracle DB Console started successfully. Three possibilities: (1) No service means one wasn’t configured; (2) A service exists but it won’t start; and (3) A working service installs.Generally, the error is in how the Oracle DB Console service was configured. You may want to take a look at this older post.
maclochlainn
7 Sep 12 at 10:47 pm
when i am installing first, it showed me error ending with ear file is missing.
then, i closed the application and restarted installing oracle. i did for 5 times and for the 5th time it has installed successfully
i have did the following
Daram
7 Sep 12 at 11:04 pm
This typically means your Windows Registry has an error. Unfortunately, Oracle doesn’t cleanup the Windows Registry effectively. If you have a backup of the Windows Registry, recover to that point.
If that doesn’t work, the easiest way is to refresh the Windows operating system and re-install the Oracle Database 11g from the start. Next time take a copy of the Windows Registry as a point of backup before you install the database.
maclochlainn
7 Sep 12 at 11:18 pm
when i am starting oracle dbconconsoleorcl in services.msc it generates an error called “windows could not start the oracleDBconsoleorcl on local computer”
can you please find the solution for this problem.
thanks
Daram
9 Sep 12 at 5:50 pm
Daram, You need to fix the Windows registry, as explained earlier. I don’t have an inclusive list, and unfortunately it differs some on each install. Recommendation are provided in the earlier post.
maclochlainn
9 Sep 12 at 6:10 pm
Hi,
Not able to start dbconsole service on windows 7. Getting message as service specific error occurred : 2 . More help available by typing “Net HELPMSG 3547″.
I have installed oracle 11.2.0.1 almost 8 months back and was using dbconsole successfully. however, past 2-3 weeks, service stopped starting automatically and when I try to start manually I was getting above error message. tried starting from windows services menu and manually using “emctl start dbconsole”. Pls help.
Ashok
7 Oct 12 at 2:30 pm
I’m not sure why it spontaneously stopped working. Try referring to the older post on reconfiguring an Oracle Enterprise Manager (OEM).
maclochlainn
7 Oct 12 at 11:56 pm
Very good publication, my installation went very smoothly. Thanks.
Geoff Caesar
9 Oct 12 at 12:12 pm
i install linux but when i start emctl give an error
oracle_unique name not defind what this i donot know plz give me information about this
attiq
7 Nov 12 at 7:02 am
i have found username or password error
suhaib
9 Nov 12 at 10:38 pm
I’m not sure how your user name and password error relates to the post. Can you elaborate?
maclochlainn
10 Nov 12 at 1:45 pm
Yes, in the original post the setting are only for Windows. They would be set as follows for a sample database installation in Linux:
maclochlainn
10 Nov 12 at 1:49 pm
Nice post I don’t have any questions, I am sure you are sorry to hear.
The export commands you used in your post of 10-Nov are incorrect.
They should be:
Sorry for being that guy.
SuilAmhain
18 Nov 12 at 2:57 pm
Good catch, you’re right if you’re using Linux but they work in Windows. I’ve updated the post with a note to this post on configuring Oracle 11g XE on Fedora.
If this is linked to my earlier reply both of these work because
SETis an optional key word in the BASH shell:or,
maclochlainn
18 Nov 12 at 3:03 pm
Great article. Thanks for going to the trouble.
Kurt
7 Dec 12 at 12:46 pm
What is the reason behind OC4J configuration error. I followed all the steps you described above. I followed other successive tutorial but it didnt solve my problem. After I log in to the database ‘orcl’ as system i got “Internal Error has occured. Check the log file for details.”
Any help or suggestion would be a gr8 help. Thanks
mubin
12 Dec 12 at 4:57 am
I’ve followed your post but I still get a blank screen when I open the em… any ideias?
help???
joao dias
31 Jan 13 at 11:50 am
You get a blank web page? or, something fails at the command-line?
maclochlainn
31 Jan 13 at 11:57 am
blank web page
joao dias
1 Feb 13 at 4:58 am
It sounds like the Oracle Enterprise Manager didn’t install correctly. You should examine a reinstall of that component, which you can find instructions for in this other post.
maclochlainn
1 Feb 13 at 11:55 pm
Thanks, I will try
joao dias
4 Feb 13 at 11:39 am
hi,
i have win2008 R2 and oracle10g and same error in my console : Getting message as service specific error occurred : 2 . More help available by typing “Net HELPMSG 3547?.
I’ve applied the Patch 8350262 then excecuted
My question is this command
the same as
and
When I RECREATE must I delete user
SYSMANcascade? and how times may recreate the dbconsole with this commands?thnaks!
In the emca_2013-02-06_03-54-27-PM.log :
Jo
7 Feb 13 at 5:55 am
And, just the ports (5560 and 1521) are running and 1158 and 3938 not.
Jo
7 Feb 13 at 6:47 am
I saw so many blogs or articles about install oracle 11g in WIN7 64 bit. This is only one really explained key stuff.
Thanks
Sherry Liu
14 Feb 13 at 3:26 pm
I apologize for the delay, the
recreateis the same as adropandcreate; you should dropSYSMANwith theCASCADEoption; and you can do it anytime you want to rebuild the OEM instance.maclochlainn
16 Feb 13 at 12:25 am
That would indicate that the OEM server isn’t configured or started.
maclochlainn
16 Feb 13 at 12:27 am
Hi maclochlainn
thanks for the post.it really helped me.good
thanks
goutham
20 Feb 13 at 8:55 am
Thank you so much! I also had an additional problem that the DB Console service wasn’t actually running, I followed the advice here:
http://www.dbforums.com/oracle/1630372-dbconsole-service-not-existing.html
emca -config dbcontrol db -repos recreate
Took a long time for that to run, but with their advice and yours, I was finally able to get into Oracle EM.
Michael
30 Mar 13 at 10:34 am
Hey maclochlainn
These are my problems…
and the next thing is I can’t create username and pwd with sqldba.
And when trying to create a connection in sql developet it is giving an listner erro of ora-12505 , what to do help me .. I need to create and work on it.
Thanks in Advacne.
Amruta
3 Apr 13 at 5:28 am
Can you connect to the database, like this?
Then, can you connect to the database like this?
sqlplus system/password@orclmaclochlainn
4 Apr 13 at 8:12 am
Excelente articulo, gracias por la información.
Milton Padilla
19 Apr 13 at 10:17 am