MacLochlainns Weblog

Michael McLaughlin's Technical Blog

Site Admin

What’s ORACLE_UNQNAME?

with 53 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    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.

Written by maclochlainn

August 23rd, 2012 at 10:32 pm

53 Responses to 'What’s ORACLE_UNQNAME?'

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

  1. [...] next step running OEM [...]

  2. 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

  3. 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

  4. Jordan, I’ve answered the question about starting and stopping the database in this blog post.

  5. 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

  6. Did an error occur during the installation? Did you make sure that the hostname corresponds to the hosts file content? What did you see in the log files? Check the pre-requisites in this Oracle 11gR2 installation post.

    Open services.msc and 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

  7. 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

    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 not running.
    ------------------------------------------------------------------
    Logs are generated in directory C:\app\daram\product\11.2.0\dbhome_5/localhost_orcl/sysman/log

    Daram

    7 Sep 12 at 11:04 pm

  8. 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

  9. 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

  10. 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

  11. 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

  12. 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

  13. Very good publication, my installation went very smoothly. Thanks.

    Geoff Caesar

    9 Oct 12 at 12:12 pm

  14. 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

  15. i have found username or password error

    suhaib

    9 Nov 12 at 10:38 pm

  16. 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

  17. Yes, in the original post the setting are only for Windows. They would be set as follows for a sample database installation in Linux:

    # export set ORACLE_HOSTNAME=localhost
    # export set ORACLE_UNQNAME=orcl

    maclochlainn

    10 Nov 12 at 1:49 pm

  18. 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:

    # export ORACLE_HOSTNAME=localhost
    # export ORACLE_UNQNAME=orcl

    Sorry for being that guy. :-)

    SuilAmhain

    18 Nov 12 at 2:57 pm

  19. 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 SET is an optional key word in the BASH shell:

    # export SET ORACLE_HOSTNAME=localhost

    or,

    # export ORACLE_HOSTNAME=localhost

    maclochlainn

    18 Nov 12 at 3:03 pm

  20. Great article. Thanks for going to the trouble.

    Kurt

    7 Dec 12 at 12:46 pm

  21. 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

  22. I’ve followed your post but I still get a blank screen when I open the em… any ideias?

    help??? :P

    joao dias

    31 Jan 13 at 11:50 am

  23. You get a blank web page? or, something fails at the command-line?

    maclochlainn

    31 Jan 13 at 11:57 am

  24. blank web page

    joao dias

    1 Feb 13 at 4:58 am

  25. 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

  26. Thanks, I will try :)

    joao dias

    4 Feb 13 at 11:39 am

  27. 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

    emca -config dbcontrol db -repos recreate.

    My question is this command

    emca -config dbcontrol db -repos

    the same as

    emca -deconfig dbcontrol db -drop repos

    and

    emca -config dbconsole db -create repos

    When I RECREATE must I delete user SYSMAN cascade? and how times may recreate the dbconsole with this commands?
    thnaks!

    In the emca_2013-02-06_03-54-27-PM.log :

    Feb 6, 2013 4:04:22 PM oracle.sysman.emcp.util.PlatformInterface serviceCommand
    CONFIG: Initialization failure for service during start
    Feb 6, 2013 4:04:22 PM oracle.sysman.emcp.EMConfig perform
    SEVERE: Error starting Database Control
    Refer to the log file at E:\oracle\product\10.2.0\db_1\cfgtoollogs\emca\orcl\emca_2013-02-06_03-54-27-PM.log for more details.
    Feb 6, 2013 4:04:22 PM oracle.sysman.emcp.EMConfig perform
    CONFIG: Stack Trace: 
    oracle.sysman.emcp.exception.EMConfigException: Error starting Database Control
    	at oracle.sysman.emcp.EMDBPostConfig.performConfiguration(EMDBPostConfig.java:646)
    	at oracle.sysman.emcp.EMDBPostConfig.invoke(EMDBPostConfig.java:224)
    	at oracle.sysman.emcp.EMDBPostConfig.invoke(EMDBPostConfig.java:193)
    	at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:184)
    	at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:486)
    	at oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1142)
    	at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:470)
    	at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:419)

    Jo

    7 Feb 13 at 5:55 am

  28. And, just the ports (5560 and 1521) are running and 1158 and 3938 not.

    E:\oracle\product\10.2.0\db_1\BIN> netstat -an|findstr 3938
    E:\oracle\product\10.2.0\db_1\BIN> netstat -an|findstr 1158
    E:\oracle\product\10.2.0\db_1\BIN> netstat -an|findstr 5560
      TCP    0.0.0.0:5560           0.0.0.0:0              LISTENING
    E:\oracle\product\10.2.0\db_1\BIN> netstat -an|findstr 1521
      TCP    0.0.0.0:1521           0.0.0.0:0              LISTENING

    Jo

    7 Feb 13 at 6:47 am

  29. 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

  30. I apologize for the delay, the recreate is the same as a drop and create; you should drop SYSMAN with the CASCADE option; and you can do it anytime you want to rebuild the OEM instance.

    maclochlainn

    16 Feb 13 at 12:25 am

  31. That would indicate that the OEM server isn’t configured or started.

    maclochlainn

    16 Feb 13 at 12:27 am

  32. Hi maclochlainn
    thanks for the post.it really helped me.good

    thanks

    goutham

    20 Feb 13 at 8:55 am

  33. 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

  34. Hey maclochlainn

    These are my problems…

    C:\>set ORACLE_HOSTNAME=localhost
     
    C:\>;set ORACLE_UNQNAME=orcl
     
    C:\> 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
    Access denied
    Oracle Enterprise Manager 11g is running.
    ------------------------------------------------------------------
    Logs are generated in directory E:\app\Venkat\product\11.2.0\dbhome_5/localhost_orcl/sysman/log

    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

  35. Can you connect to the database, like this?

    sqlplus / AS sysdba

    Then, can you connect to the database like this?

    sqlplus system/password@orcl

    maclochlainn

    4 Apr 13 at 8:12 am

  36. Excelente articulo, gracias por la información.

    Milton Padilla

    19 Apr 13 at 10:17 am

  37. Thanks for the write-up. This still failed to solve my problem, but after digging around the emoms.trc file and realizing that Java could not recognize my locale, I googled around and finally found that I needed to add the following to my environment variables for my setup to work:

    JAVA_TOOL_OPTIONS -Dfile.encoding=UTF8 -Duser.language=en -Duser.region=US -Duser.country=US

    Eric Gitonga

    2 Jul 13 at 1:10 pm

  38. Many many thanks boss.
    It was my great problem. I could not solved this problem within 7 days.

    Thanks boss thanks….

    Md. Obydul Islam

    5 Jul 13 at 5:55 am

  39. Select query for ORACLE_UNQNAME and netstat command were helpful. netstat command returned blank meaning port was not listening. So i restarted the service and it started behaving normally.

    Thanks!

    Ketan

    6 Aug 13 at 10:22 pm

  40. Great Article.
    Thanks for posting.

    VicKs

    2 Oct 13 at 1:36 pm

  41. My problem is same as Amruta’s on Apr. 3, 2013. In IE8 I can’t get anything from https://…em but I can access and login in Chrome. I tried sqlplus / AS sysdba and sqlplus system/password@orcl both work. So it’s problem of IE or some otehr settings?
    Thanks in advance.

    allan

    2 Nov 13 at 11:20 pm

  42. greats , thanks
    i have done all steps , it works , but the OEM is very slow and once it did not ask me the username and Pass , its logged directly

    could you advice plz ?

    note : i am using Oracle Linux Enterprise installed in Workstation VM

    Adam

    21 Jan 14 at 4:00 am

  43. Adam,

    It may be tied to how much memory you allocate the VM. I typically use 4 GB for the VM on a server with 64 GB of real memory.

    maclochlainn

    21 Jan 14 at 11:19 am

  44. thanks Maclochlainn, appreciate your response
    i will try to allocate 4 GB

    Adam

    21 Jan 14 at 9:46 pm

  45. Thank you so much for writing useful article…
    It helped me greately

    akram Khan

    28 Feb 14 at 6:23 pm

  46. Sir … I got a problem..
    when i run ..emctl status dbconsole …
    error occurs ..Access is denied ..EM Daemon is not running..
    need your help plz..

    akram Khan

    28 Feb 14 at 6:27 pm

  47. Akram, You’d need to post log files or some more detail for me to help.

    maclochlainn

    28 Feb 14 at 10:41 pm

  48. i make like your steps on the installation
    and i run the sqlplus as you post before but i can’t access the oracle home page when i try to make as your steps i cant found the oracledbconsoleorcl on the service
    only i have for oracle service

    Oraclec_users_admin_docume~1_product_121~1.0_dbhome_1
    ConfigurationManager
    OracleJobSchedulerORCL
    OracleOraDB12Home1MTSRecoveryService
    OracleOraDB12Home1TNSListener
    OracleRemExecServiceV2
    OracleServiceORCL
    OracleVssWriterORCL

    please help me

    Marwa

    10 Mar 14 at 3:51 am

  49. Marwa,

    More or less you see this for Oracle Database 12c?

    ServicesOracle12c

    When you ran this command from the post, you should have seen that there wasn’t a listener on the port. That because it isn’t installed by the generic installation any longer (this post was for Oracle 11g).

    netstat -an | findstr /C:1158

    Hope that helps …

    maclochlainn

    11 Mar 14 at 12:26 pm

  50. Hi,

    I’m trying to run the emctl start but when i check (as you adviced) the

    %ORACLE_HOME%\oc4j\j2ee\ folder

    i dont find the folder with OC4J_DBConsole_localhost_sid i find only the ” folders :

    -OC4J_DBConsole, 
    -OC4J_Workflow_Component_Container -OC4J_Workflow_Management_Container

    what does this means? the em is not installed?

    regards

    btidba

    8 Apr 14 at 3:12 pm

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

    maclochlainn

    9 Apr 14 at 9:04 am

  52. 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 10.2.0.4.4 from C:\app\isaac\product\11.2.0\dbhome_9 (00701)
    Thread-1804 : Startup of HTTP LISTENER failure (00716)

    Kindly help.

    Mse

    17 Apr 14 at 7:15 am

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

    maclochlainn

    18 Apr 14 at 3:09 am

Leave a Reply