Database Reference
In-Depth Information
The
oraenv
utility is located in the
ORACLE_HOME/bin
directory. You'll have to navigate to your
ORACLE_HOME/bin
directory first (you'll have to modify the following path to match your environment):
$ cd /orahome/app/oracle/product/12.1.0.1/db_1/bin
And then you can run
oraenv
manually, like this:
$ . ./oraenv
You'll be prompted for
ORACLE_SID
(and if the
ORACLE_SID
isn't in the
oratab
file, you'll additionally be prompted
for an
ORACLE_HOME
value):
ORACLE_SID = [oracle] ?
ORACLE_HOME = [/home/oracle] ?
You can also run the
oraenv
utility non-interactively by setting OS variables before you run it. This is useful for
scripting when you don't want to be prompted for input:
$ export ORACLE_SID=O12C
$ export ORACLE_HOME=/orahome/app/oracle/product/12.1.0.1/db_1
$ export ORAENV_ASK=NO
$ cd /orahome/app/oracle/product/12.1.0.1/db_1/bin
$ . ./oraenv
■
Note
in Windows the operating system, variables are set in the registry.
You can verify that the OS variable settings with the
echo
command, for example:
$ echo $ORACLE_SID
O12C
$ echo $ORACLE_HOME
/orahome/app/oracle/product/12.1.0.1/db_1
After you've established your operating system variables, you need to connect to the database with the proper
privileges. You can do this in one of two ways: using OS authentication or using a password file.
Using OS Authentication
Before you can connect to the Oracle database, you need to have the proper OS variables set (covered in the prior
section). Additionally, if you want to connect to Oracle as a privileged user, then you must also have access to
either a privileged OS account or a privileged database user. Connecting as a privileged user allows you to perform
administrative tasks, such as starting and stopping a database. You can use either OS authentication or a password file
to connect to your database as a privileged user.
The concept of a privileged user is also important to RMAN backup and recovery. RMAN uses OS authentication
and password files to allow privileged users to establish a privileged database session (via the
rman
utility). Only a
privileged account is allowed to back up, restore, and recover a database.