MacLochlainns Weblog

Michael McLaughlin's Technical Blog

Site Admin


with 60 comments

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               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:\>emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
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:


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.

Written by maclochlainn

August 23rd, 2012 at 10:32 pm

60 Responses to 'What’s ORACLE_UNQNAME?'

Subscribe to comments with RSS or TrackBack to 'What’s ORACLE_UNQNAME?'.

  1. Btidba, More or less, yes it’s not installed. Is this Oracle 11g or 12c?


    9 Apr 14 at 9:04 am

  2. Hi,

    I have nearly the same problem as most guys here. I’m running 11g R2 on Windows 8. I cannot basically start the dbconsole. Initially I got the error about the ORACLE_UNQNAME not being set but thanks to your notes above, that’s been resolved. So now, I can check the status of emctl dbconsole, and have also checked that the EMAgent is running. Issue is I cannot still start the emctl dbconsole.

    Error as per the EMAgent.log is:

    Thread-4180 Exceeded Max allowed Upload data – No of files: 313, Size of upload data: 30.756313MB, Pct() of Disk used: 98.84%, Disabling collections (00852)
    Thread-4180 Disable collector (00406)
    Thread-1804 Starting Agent from C:\app\isaac\product\11.2.0\dbhome_9 (00701)
    Thread-1804 : Startup of HTTP LISTENER failure (00716)

    Kindly help.


    17 Apr 14 at 7:15 am

  3. Mse, I don’t have a Windows 8 test case, but if I get a chance I’ll try to test it.


    18 Apr 14 at 3:09 am

  4. I concluded my installation part, and when I open sql plus window it is asking like…

    enter user-name:
    enter password:
    here i am confusing what to enter, & if i enter something then i got an error like…
    “ora-12560: TNS:protocol adapter error….”

    so please help me any one and i am trying on this for past five days but i am unable to go further.


    31 Jul 14 at 2:04 pm

  5. Srikar, Typically, you would enter system and the password you choose during installation. Is that failing?


    1 Aug 14 at 9:17 pm

  6. thank you


    21 Jan 15 at 2:42 pm

  7. Thanks for your post! Clearly written and your advice did the trick!


    15 Feb 15 at 12:16 pm

  8. hi
    i wanted to start the dbconsole and tried to find the oc4J-Dbconsole_localhost_orcl,but that folder is not available. how to solve the problem. Also i am trying to find Database control URL in oracle database 111gr2 for windows.


    8 Apr 15 at 12:20 am

  9. Bhuvana, I need a bit more information to help you. Did you install Oracle Database 11gR2 on Windows 7? Did you verify a successful installation or did you encounter problems during the install?


    10 Apr 15 at 2:37 am

  10. Thank you very much for a excellent post.


    14 Nov 15 at 2:16 pm

Leave a Reply