Переменные среды windows 10 oracle

Set ORACLE_HOME environment variable.

This tutorial will teach us how to set the ORACLE_HOME environment variable on Windows 10. This variable should point to the location of the Oracle Database on the machine. We can set this variable after the Oracle database is installed.

For example, if the Oracle base install location is installed on c:\oracle, then we need to set this variable to:

ORACLE_HOME=C:\oracle

Oracle Install on Windows:

  • https://www.testingdocs.com/install-oracle-19c-database-on-windows-10/

Check if the variable is set:

Open the command prompt and issue the following command.

\> echo %ORACLE_HOME%

ORACLE_HOME not Set

The variable is not set on the machine if we see the same name displayed on the screen instead of the real directory path.

Set ORACLE_HOME

Let’s see the steps to set the variable on Windows.

Type the following  “system environment variables” in the Search Bar.

Click on the ‘Edit the system environment variables’  Control Panel search result.

In the System Properties window, choose the Advanced tab. Click on the Environment Variables… button.

In the System Variables section, click on the New… button.

Set ORACLE_HOME Windows 10

Add the environment variable.

For example, type the following to set C:\oracle as the Oracle home.

Variable name: -> ORACLE_HOME

Variable value: -> C:\oracle

Click on the OK button. Alternatively, we can choose the install folder by clicking on the Browse Directory… button.

Append to PATH

Locate the PATH system variable. Double-click on it to edit the variable. Click on the New button.

Add the bin directory to the PATH variable.

%ORACLE_HOME%\bin

ORACLE_HOME Environment variable

Verify

Open the command prompt and issue the following echo command to verify that the variable is set.

\> echo %ORACLE_HOME%

That’s it. The environment variable has been set on the Windows machine.

Video Tutorial

Database Tutorials on this website:

  • https://www.testingdocs.com/oracle-database-tutorials-for-beginners/

More information about Oracle Database:

  • https://www.oracle.com/database/

There are required and optional environment variables for Oracle data sources.The following environment variables are valid for Oracle:

ORACLE_HOME

Set the ORACLE_HOME environment variable to the directory path where the Oracle client software is installed. Specify the fully qualified path for the environment variable: ORACLE_HOME= oracle home directory. For example,

ORACLE_HOME=\usr\oracle\10.0.1

ORACLE_BASE (optional)

ORACLE_BASE represents the root of the Oracle client directory tree. For example,

ORACLE_BASE=oracle_root_directory

ORA_NLS (optional)

Oracle’s National Language Support (NLS) architecture allows you to store, process, and retrieve data in native languages. It ensures that database utilities and error messages, sort order, date, time, monetary, numeric, and calendar conventions automatically adapt to the native language and locale. If multiple versions of Oracle are running on your system, you must ensure that:

• The appropriate ORA_NLS environment variable is set
• The corresponding NLS data files for the versions that you are using are available

The location-specific data is stored in a directory that is specified by the ORA_NLS environment variable. Each version of Oracle has a different ORA_NLS data directory. For example,

ORA_NLS33=oracle_home_directory/ocommon/nls/admin/

NLS_LANG (optional)

Oracle provides Globalization Support that enables users to interact with a database in their own language, as defined by the NLS_LANG parameter. When you install Oracle Database Client components, Oracle Universal Installer sets the NLS_LANG parameter in the registry. The NLS_LANG parameter uses the following format,

NLS_LANG = LANGUAGE_TERRITORY.CHARACTER_SET

TNS_ADMIN (optional)

• On Windows
The Oracle client looks for the tnsnames.ora file in the %ORACLE_HOME%\NETWORK\ADMIN directory, where %ORACLE_HOME% is defined. If the tnsnames.ora file is not in the %ORACLE_HOME%\NETWORK\ADMIN directory, you must set the TNS_ADMIN environment variable. You set the environment variable to the path where the tnsnames.ora file is located.

• On AIX or Linux
The Oracle client looks for the tnsnames.ora file in the /etc directory. If the tnsnames.ora file is not in the /etc directory, then the Oracle client looks for the tnsnames.ora file in the $ORACLE_HOME/network/admin directory, where $ORACLE_HOME is defined. If the tnsnames.ora file is not in the $ORACLE_HOME/network/admin directory, you must set the TNS_ADMIN environment variable. You set the environment variable to the path where the tnsnames.ora file is located. For example, if the tnsnames.ora file is in the /home/oracle directory, you set the environment variable to:

TNS_ADMIN=/home/oracle

• On Solaris
The Oracle client looks for the tnsnames.ora file in the /var/opt/oracle directory. If the tnsnames.ora file is not in the /var/opt/oracle directory, then the Oracle client looks for the tnsnames.ora file in the $ORACLE_HOME/network/admin directory, where $ORACLE_HOME is defined. If the tnsnames.ora file is not in the $ORACLE_HOME/network/admin directory, you must set the TNS_ADMIN environment variable. You set the variable to the path where the tnsnames.ora file is located. For example, if the tnsnames.ora file is in the /home/oracle directory, you set the environment variable to:

TNS_ADMIN=/home/oracle

oracle environment oracle variable

Set the Oracle Home environment variable in Windows platform:
1. Set at Command Prompt Level( temporary at session)
2. Set at user level (with Environment variable setting)
3. Set at system level(with Environment Variable Setting)

Set at Command Prompt Level
Set the destination according to it where oracle is installed and Oracle sid defined as the instance name.
Open the command Prompt window and set the following paths will set your Oracle Environment variables.

SET ORACLE_BASE=C:\oracle
SET ORACLE_HOME=%ORACLE_BASE%\product\12.2.0
SET ORACLE_SID=test
SET PATH=%ORACLE_HOME%/bin;%PATH%

Set at user level
When you login with user, the Oracle Home environment variable is already set when you login with user by setting them in Window Environment Variable Setting.
Search Environment variable in Start menu –> Open system Properties and go to environment Variables
Edit the User and System level setting depend upon your need. If you want set Oracle Home at user level then use upper window and if you set at system level then use below window as highlighted:

Press NEW or EDIT button as shown below in following snapshot:
Set new environment variable ORACLE_HOME and its value “C:\oracle\product\12.2.0\dbhome_1”
and edit PATH variable and append its value “C:\oracle\product\12.2.0\dbhome_1\bin”.

Set Oracle Home for User and System

In my previous article i have given the detailed description of multiple queries related to oracle. In this article i would like to throw light on – How to set oracle_home path? I will explain multiple steps for setting up the oracle_home path.We often use the oracle_home in detail. In this post i would like to cover the following topics in detail.

  1. What is mean by ORACLE_HOME and What is Purpose of it?
  2. How to check the ORACLE_HOME setting
  3. How to set ORACLE_HOME path
  4. How to change setting of oracle home or how to delete or change oracle home

Purpose of ORACLE_HOME:

  1. ORACLE_HOME is a directory name which will come at the time of Oracle software installation.
  2. The specified directory path of ORACLE_HOME directory is been stored in an environment variable.
  3. The path of the ORACLE_HOME directory is stored the installation path of oracle. Example : For windows it could be C:\ or C:\Software or under D:\.
  4. File Structure under oracle home : The structure of files in ORACLE_HOME is fixed. Example : The location of sqlplus.exe is always ORACLE_HOME/bin and Tnsnames.ora path will be ORACLE_HOME\network\admin.
  5. The ORACLE_HOME file will always used to ensure the correct oracle version is accessed running against the database.
  6. When it is important : It is very critical when you are using multiple versions of oracle on same windows server. ORACLE_HOME file is also important for installing the patches of oracle.

How to set oracle_home path? :

Once you install the Oracle.We require to check ORACLE_HOME file is set or not. We require to set the ORACLE_HOME .

How to set oracle_home path? Windows Server

There are so many questions in mind that what is exact path of ORACLE_HOME file.We require to check whether the ORACLE_HOME is set or not.

c:\>echo %ORACLE_HOME%

C:\oraclexe\app\oracle\product\11.1.0.6\server

If the path is given below (The version name may be different). If ORACLE_HOME is not set then you require to set the ORACLE_HOME.

C :\> echo %ORACLE_HOME%%ORACLE_HOME

How to set oracle_home path?

We require to set the ORACLE_HOME for Windows server ,

C:\>set ORACLE_HOME=C:\oraclexe\app\oracle\product\11.1.0.6\server

C:\>echo %ORACLE_HOME%C:\oraclexe\app\oracle\product\11.1.0.6\server

C:\>

How to check and set Environment variable path?

Step 1 : Go to the Control Panel –> System –> Advanced

Step 2 :We require to create on button named “Environment Variables”. There are two set of variables – first is User and other is System variables.The user variables are the variables which are visible to anyone who has logged in to the system. The system variables are visible to any other person who uses the system.

Step 3:Depending on the visibility you require to create ORACLE_HOME variable by clicking on New button.

Step 4 : We require to set the ORACLE_HOME directory value and Save it.

Step 5: We require to verify it with new command line session,

  1. Go to Control Panel -> System -> Advanced.
  2. Click on button “Environment Variables”. This will open a window with two sets of variables – User and System. User variables are visible to your login only, while system variables are visible to anyone else who uses the system.
  3. Choose “New” to create ORACLE_HOME variable as either User or System variable, depending on how you want its visibility.
  4. Set its value to the Oracle directory.
  5. Click OK to save.
  6. Verify through a new command line session that the value has been set correctly.

How to set oracle_home path? Unix or Linux Server

You can also check and set the ORACLE_HOME path on unix or linux server. The first step is to check the ORACLE_HOME.

Command to use :

env | grep ORACLE_HOME

If the path is not set then you will get the following error.

SQL> @%ORACLE_HOME%\RDBMS\ADMIN\SCOTT.sqlSP2-0310: unable to open file "%ORACLE_HOME%\RDBMS\ADMIN\SCOTT.sql"

If you get above error then you require to set the ORACLE_HOME using following Steps.

Step 1 : Open the linux/unix operating system command prompt.

Step 2 : Use following commands to set the ORACLE_HOME and ORACLE_SID are set properly.

Command 1 : (bash or ksh) export ORACLE_SID=orcl

Command 2 :csh or tcsh) setenv ORACLE_SID orclYou can set these with the scripts coraenv (for the C shell) and oraenv (for other shells). These scripts are typically located in the /usr/local/bin directory.

Step 3 : Check and Ensure that the ORACLE_HOME/BIN directory in environment variable path.

Step 4 : Command to use,

export ORACLE_HOME=/app/oracle/product/11.1.0.6/server

How to change setting of ORACLE_HOME?

There is need to edit or delete the ORACLE_HOME. These kind of situation occurs when there is need to install multiple oracle installations. You require to follow the same steps and only you need to click on Edit or Delete button accordingly in Windows.

In Linux system also you can also edit profile file for your default shell in home directory. Example : /home/oracle , so that these environment variables are set every time you log in as that user.

I hope you get clear idea about – How to set oracle_home path? in detail .If you like this article or if you have any issues with the same kindly comment in comments section.

What is ORACLE_HOME used for?

* The ORACLE_HOME is an environment variable which is used to set and define the path of Oracle Home (server) Directory.
* The ORACLE_HOME directory will have the sub directories, binaries, executables, programs, scripts, etc. for the Oracle Database.
* This directory can be used by any user who wants to use the particular database.
* If the ORACLE_HOME variable is defined as an environment variable, then during the installation process, the Oracle Home Path will be set to the directory defined as default. If the variable is not defined, then the Oracle will take its own default location. i.e. The ORACLE_HOME variable does not have to be preset as an environment variable, it can be set during the installation process.
* Basically The ORACLE_HOME variable is in the following ORACLE_BASE directory:
ORACLE_HOME=$ORACLE_BASE/product/10.2.0.

What is ORACLE_BASE used for?

* The ORACLE_BASE is also an environment variable to define the base/root level directory where you will have the Oracle Database directory tree – ORACLE_HOME defined under the ORACLE_BASE directory.
* Basically, The ORACLE_BASE directory is a higher-level directory, than ORACLE_HOME, that you can use to install the various Oracle Software Products and the same Oracle base directory can be used for more than one installation.

Note: If you did not set the ORACLE_BASE environment variable before starting OUI, the Oracle home directory is created in an app/username/directory on the first existing and writable directory from /u01 through /u09 for UNIX and Linux systems, or on the disk drive with the most available space for Windows systems. If /u01 through /u09 does not exist on the UNIX or Linux system, then the default location is user_home_directory/app/username.

How to check if ORACLE_HOME is set already?

On Unix/Linux Systems:

Basically, before or after the Oracle Database is installed, the oracle user profile, the environment variable file, is prepared where all the required environment variables for Oracle are set. i.e. ORACLE_BASE, ORACLE_HOME, ORACLE_SID,PATH, LD_LIBRARY_PATH, NLS_LANG, etc.

The user profile file can be
.bash_profile – Bash Shell
.profile – Bourne Shell or Korn shell
.login­ – C Shell

Note: This user profile file will be under user’s home directory i.e. $HOME/.bash_profile

To check specific environment variable set:

$ echo $ORACLE_HOME

To check all the environment variables set:

$ env

On Windows Systems:

To check specific environment variable set:

C:> set ORACLE_HOME

OR

C:echo %ORACLE_HOME%

To check all the environment variables set:

C:> set

Or

C:> env

Other way, to check the ORACLE_HOME, is as follows.

Start -> Run -> Regedit (enter) -> HKEY_LOCAL_MACHINE -> SOFTWARE –> ORACLE

i.e. My ComputerHKEY_LOCAL_MACHINESOFTWAREORACLE

How to check using sqlplus command:

To find the ORACLE_HOME path in Oracle Database

How to set the ORACLE_HOME environment variable?

On Unix/Linux Systems:

Define the ORACLE_HOME value in the user profile file i.e. .bash_profile or .profile

ORACLE_HOME=$ORACLE_BASE/product/10.2.0
export ORACLE_HOME

Source the user profile as follows:

Bash shell:

$ . ./.bash_profile

Bourne shell or Korn shell:

$ . ./.profile

C shell:

% source ./.login

If no profile file is set with environment variables, then physically also be set as follows:

Bourne, Bash, or Korn shell:

$ ORACLE_BASE=/oracle/app
$ export ORACLE_BASE
$ ORACLE_HOME=$ORACLE_BASE/product/10.2.0
$ export ORACLE_HOME

C Shell:

% setenv ORACLE_BASE /oracle/app
% setenv ORACLE_HOME /oracle/app/product/10.2.0

On Windows Systems:

My Computer -> Properties -> Advanced -> Environment Variables -> System Variables -> New/Edit/Delete (to set the variables)

After setting the environment variables as above, open a fresh CMD tool and check whether they set properly or not. Do not try on already opened CMD tool to make sure the variables set or not.

Another way to physically set the variables as follow at the DOS prompt:

C:> set ORACLE_HOME=C:oracleappproduct10.2.0
C:> echo %ORACLE_HOME%

Note: I would suggest to refer the Oracle Documentation on Installation where these environment variables are discussed and explained with the enough information.

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Упрощение работы с мышью windows 10
  • Как поменять название профиля в windows 10
  • Windows kms server download
  • Nvidia gtx 970 driver windows 7
  • Демо версия windows 10