Database Reference
In-Depth Information
Using a Password File
If you aren't using OS authentication, then you can use a password file to connect to the database as a privileged user.
A password file allows you to do the following from SQL*Plus or RMAN:
sys*
privileges as a non-
SYS
database user
•
Connect to your database with
sys*
privileges
The password file must be manually created with the
orapwd
utility and is populated via the SQL
grant
command. To implement a password file, perform the following steps:
•
Connect to remote database (over the network) with
Create the password file with the
orapwd
utility.
1.
2.
Set the initialization parameter
remote_login_passwordfile
to
exclusive
.
In a Linux/Unix environment, use the
orapwd
utility to create a password file as follows:
$ cd $ORACLE_HOME/dbs
$ orapwd file=orapw$ORACLE_SID password=<sys password>
In a Linux/Unix environment, the password file is usually stored in the
ORACLE_HOME/dbs
directory, and in
Windows, it's typically placed in the
ORACLE_HOME\database
directory. The format of the file name that you specify in
the previous command may vary by OS. For example, on Windows the format is
PWD<ORACLE_SID>.ora
. The following
shows the syntax in a Windows environment:
c:\> cd %ORACLE_HOME%\database
c:\> orapwd file=PWD<ORACLE_SID>.ora password=<sys password>
To enable the use of the password file, set the initialization parameter
remote_login_passwordfile
to
exclusive
(this is the default value). You can verify its value as shown next:
SQL> show parameter remote_login_password
NAME TYPE VALUE
-------------------------- ------ ---------
remote_login_passwordfile string EXCLUSIVE
If need be, you can manually set the
remote_login_passwordfile
parameter as shown:
$ sqlplus / as sysdba
SQL> alter system set remote_login_passwordfile=exclusive scope=spfile;
You will then need to stop and start your database for this parameter to take effect (more details on stopping/
starting your database later in this chapter). The prior example assumes you are using a server parameter file (
spfile
).
If you are not using a
spfile
, you will have to manually edit the
init.ora
file by adding this entry with a text editor:
remote_login_passwordfile=exclusive