Oracle Issue with Environment Variable 'ORACLE_UNQNAME' - windows

I'm trying to install Oracle 11gR2 Entreprise Edition but during database creation, I got this Error :
Environment Variable ORACLE_UNQNAME not defined
And when I tried to lunch 'emctl.bat' From cmd I got this one :
Please set ORACLE_UNQNAME to database unique name.
And to slove this error, I have used this commande :
set ORACLE_UNQNAME=orcl
To define my Enivronment variable (orcl is the database name) I got this error for the 'emctl' command:
EM Configuration issue. D:\app\product\11.2.0\dbhome_1/Chlebta-PC_orcl not found
So any Help For sloving this issue ?

:\> emctl status dbconsole
Environment variable ORACLE_UNQNAME not defined.
Please set ORACLE_UNQNAME to database unique name
Here is how to set oracle_unqname in Windows. You use a similar "export command" in UNIX/Linux:
C:\>set ORACLE_HOSTNAME=localhost
C:\>set ORACLE_UNQNAME=orcl
C:\>set ORACLE_SID=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.

the best way to set your environment variables is the graphical way :
control panel > system > advanced system settings > Environment variables
now just click on new and inter the variable name : inter your variable name like
ORACLE_UNQNAME
and int variable value : inter the value , such as orcl
now for the error of em-configuration : its seems like your host name "which is the computer name" is : chlebta-pc not localhost , check your listener and make sure of the host-name in there and the host name of the variable-value .

Related

Windows 10 pro x64, Oracle database 21c express edition: How to set ORACLE_HOME correct?

I am using Windows 10 pro x64, Oracle database 21c Express edition, Oracle SQL Developer 22.2.1 . How to set ORACLE_HOME correct?
I know this my setting was wrong (because sqlplus.exe cannot run/open with this system variable, I tried)
Is ORACLE_HOME
C:\app\Administrator\product\21c
C:\app\Administrator\product\21c\dbhomeXE
C:\app\Administrator\product\21c\homes
C:\app\Administrator\product\21c\homes\OraDB21Home1
?
Please guide me set ORACLE_HOME correctly!
On Windows you don't need to explicitly set an Oracle Home because we can work it out from the registry and the PATH.
But if you want to set an ORACLE_HOME its the parent folder of the 'bin' directory. Thus if sqlplus was found in C:\app\Administrator\product\21c\homes\OraDB21Home1\bin then your ORACLE_HOME would be C:\app\Administrator\product\21c\homes\OraDB21Home1
If you're running multiple versions/installations of Oracle (as I do), I'll often create a little batch file for each version,eg
sql19.cmd
=========
set ORACLE_SID=db19
set ORACLE_HOME=C:\oracle\product\19
set PATH=C:\oracle\product\19\bin;%PATH%
sqlplus scott/tiger#db19_pdb1
sql21.cmd
=========
set ORACLE_SID=db21
set ORACLE_HOME=C:\oracle\product\21
set PATH=C:\oracle\product\21\bin;%PATH%
sqlplus scott/tiger#db21_pdb1
and so on

Can't find SQLPATH registry entry Oracle 11.2 Express

I'm trying to start working through Tom Kyte's book, "Expert Oracle Database Architecture" and have run into a snag. Tom recommends creating a custom login.sql script and briefly mentions setting the SQLPATH environment variable.
I've been following the instructions found here: http://docs.oracle.com/cd/B28359_01/server.111/b31189/ch2.htm#i1133354
I've searched for the SQLPATH and HOME0 keys, and for the ORACLE_HOME\DBS value, but it doesn't seem to exist in the Registry. I have Oracle 11.2 Express, Windows 8, and my Oracle instance name is the default, XE. In the Registry, I see
HKEY_LOCAL_MACHINE
SOFTWARE
ORACLE
KEY_XE
...
ORACLE_HOME (value: C:\oraclexe\app\oracle\product\11.2.0\server)
ORACLE_HOME_KEY
ORACLE_HOME_NAME
...
ODE
...
OLEDB
...
ODP.NET
2.112.2.0\
4.112.2.0\
OracleMTSRecoveryService
Protid_0
Setup
All Versions
1\
Current Version\
Is it possible that the SQLPATH variable is no longer created by default, and that I need to just create a new one? If so, exactly where should it exist? If not, then what?
SQLPATH is a Windows system-or user environment variable not found under KEY_XE.
You can set the SQLPATH like this: Right-click on "Computer" -> Properties -> Advanced Settings - Environment
me#XE>host set SQLPATH
SQLPATH=c:\projects\oracle\sqlplus
-- verification
me#XE>#[%SQLPATH%]
SP2-0310: unable to open files "[c:\projects\oracle\sqlplus].sql
Bjarte

Error 6 Initializing SQL*Plus

When i open sqlplus it shows
Error 6 Initializing SQL*Plus
Message file sp1<Lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
Generally speaking, you don't want to set ORACLE_HOME in a Windows environment - it's handled in the registry, and it's given me grief the times I've set it. Here is an Oracle Doc on Oracle Homes.
How many Oracle installations are on this computer?
Ancient question with hopefully a helpful new answer! Ready?
First, as others have said, you must set your ORACLE_HOME (e.g. export ORACLE_HOME=/opt/oracle/instantclient_12_2), but secondly, and oddly, you can't be cd'd into the oracle home when you run sqlplus!
$ export ORACLE_HOME=/opt/oracle/instantclient_12_2
$ cd $ORACLE_HOME
$ sqlplus
Error 6 initializing SQL*Plus
SP2-0667: Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
$ cd /
$ sqlplus
SQL*Plus: Release 12.2.0.1.0 Production on Wed Jan 3 11:02:36 2018
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Enter user-name:
Whoaaa mind blown. It's... a feature?
If ORACLE_HOME & ORACLE_BASE are all properly set,
Make sure that someone does not delete some installation folders/files. I experienced similar problem, in one of my customers, Half of the folders in OraHome had been accidently deleted by the IT Guy.
In my case, ORACLE_HOME in my windows registry was changed when I installed another Oracle tool (Workflow builder in my case), hence I got the following error. After I modified it back to where the Oracle SQLPLUS product was installed, it worked fine. We don't need to set ORACLE_HOME in the environment variables, the system would read it form the registry.
Before:
Error 6 initializing SQL*Plus
SP2-0667: Message file sp1.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

How to correctly set the ORACLE_HOME variable on Ubuntu 9.x?

I have the same problem as listed here: How to recover or change Oracle sysdba password although I did not lose the password, I entered it twice in the configure script originally, and then when I went to login (localhost:8080/apex, password not accepted.
I don't have anything in the database, I just want to install and use Oracle-XE. I have tried apt-get removing it twice and reinstalling, but if I try to run /etc/init.d/oracle-xe configure again and I get "Oracle Database 10g Express Edition is already configured" despite the second time removing any folders I could find for Oracle XE.
I tried running sqlplus "/ as sysdba" but all I get is:
Error 6 initializing SQL*Plus
Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
I tried setting the variable via export. (also tried set).
Tried: export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/sqlplus
and all the subdirectories of that. Same error every time.
What is the ORACLE_HOME supposed to be set to? The only reference I have seen either just say general or say the above up to the version number then "/db_1". I do no thave a db_1.
Let me know if you need any clarification. I don't understand what I did wrong in this process.
Usually the msb file not found problems are the result of an environment setting problem, but in your case I'm a little suspicious of the installation (I've never used the apt-get + configure method).
To check the sanity of the installation:
ORACLE_HOME should be set to a directory path one level above the bin directory where sqlplus executable is found.
There should some .msb files under $ORACLE_HOME/sqlplus/mesg
There should be hundreds (not sure of the number with XE) of .msb files
under $ORACLE_HOME (try find $ORACLE_HOME -name "*.msb" -print to show them)
Your PATH should include $ORACLE_HOME/bin.
All files under ORACLE_HOME should be owned by user:oracle group:dba.
I had the same issue. In my home folder I've got a script named sqlplus.sh that takes care of this for me, containing:
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
export ORACLE_HOME
ORACLE_SID=XE
export ORACLE_SID
NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export NLS_LANG
PATH=$ORACLE_HOME/bin:$PATH
export PATH
sqlplus /nolog
Had the same problem,
All i had to do whas set the oracle shell variable:
. /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
Sorterd!
You have to set LANG as well, look for files named 'sp1*.msb', and set for instance export LANG=us if you find a file name sp1us.msb. The error message could sure be better :)
ORACLE_HOME needs to be at the top level of the Oracle directory structure for the database installation. From that point, Oracle knows how to find all the other files it needs. For example, the error message you get is because Oracle can't locate the message files to report errors with (should be in the various mesg directories below the oracle home. Instead of the above value you give, I would try
export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0
Once I also got that same type of error.
I.E:
C:\oracle\product\10.2.0\db_2>SQLPLUS SYS AS SYSDBA
Error 6 initializing SQL*Plus
Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
This error is occurring as the home path is not correctly set. To rectify this, if you are using Windows, run the below query:
C:\oracle\product\10.2.0\db_2>SET ORACLE_HOME=C:\oracle\product\10.2.0\db_2
C:\oracle\product\10.2.0\db_2>SQLPLUS SYS AS SYSDBA
SQL*Plus: Release 10.2.0.3.0 - Production on Tue Apr 16 13:17:42 2013
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Or if you are using Linux, then replace set with export for the above command like so:
C:\oracle\product\10.2.0\db_2>EXPORT ORACLE_HOME='C:\oracle\product\10.2.0\db_2'
C:\oracle\product\10.2.0\db_2>SQLPLUS SYS AS SYSDBA
SQL*Plus: Release 10.2.0.3.0 - Production on Tue Apr 16 13:17:42 2013
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
This is the right way to clear this error.
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
sqlplus / as sysdba
After installing weblogic and forms server on a Linux machine we met some problems initializing sqlplus and tnsping. We altered the bash_profile in a way that the forms_home acts as the oracle home. It works fine, both commands
(sqlplus and tnsping) are executable for user oracle
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export JAVA_HOME=/mnt/software/java/jdk1.7.0_71
export ORACLE_HOME=/oracle/Middleware/Oracle_FRHome1
export PATH=$PATH:$JAVA_HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=/oracle/Middleware/Oracle_FRHome1/lib
export FORMS_PATH=$FORMS_PATH:/oracle/Middleware/Oracle_FRHome1/forms:/oracle/Middleware/asinst_1/FormsComponent/forms:/appl/myapp:/home/oracle/myapp
set <ORACLE_HOME> path variable
example
path ORACLE_HOME
value is C:\oraclexe\app\oracle\product\10.2.0\server

Oracle connectivity in Ruby

In my ruby script, I set to connect to oracle db via:
conn = OCI8.new(username, password, database)
It works well on my own desktop (Ubuntu), however, when I deploy it onto a lab machine (Ubuntu VM), it has oracle connection error. The machine has all oracle drivers needed because I can connect to it by commandline sqlplus. Also I did echo $ORACLE_HOME and it's set correctly.
The error is like:
env.c:257:in oci8lib.so: ORA-12154: TNS:could not resolve service name (OCIError)
I had the same error on my desktop when ORACLE_HOME was not set correctly. Once I set it right, it started to work. But on this lab machine, although I can launch sqlplus w/o problem, I can't connect via ruby script. Any advice?
The ORA-12154 error means that the value of the "database" argument in your OCI8.new call is not being found in the tnsnames.ora file that the environment is using. This could be due to:
an incorrect value being passed through the variable
something in the environment that is
pointing to the wrong location for
tnsnames.ora. By default it should
be in $ORACLE_HOME/network/admin, but
this can be overridden by the
TNS_ADMIN environment variable.
You say that you can launch sqlplus on the lab machine without any problem, and I assume that this means you can connect to the database of interest when you do this. If this is the case, it seems that the environment present when you run the Ruby script must be somehow different.

Resources