Password Files   «Prev  Next»

Lesson 4Placing and naming the password file
ObjectiveDetermine the proper location and name for a password file.

Placing Naming Password File in Oracle

As an Oracle Database Administrator (DBA), determining the proper location and name for a password file is crucial for database security and administration. The password file stores passwords for users with SYSDBA, SYSOPER, SYSASM, SYSBACKUP, or SYSDG privileges. Here's how you can determine the proper location and name for the password file in Oracle 12c:

Location

The location of the password file is generally specified by the `ORACLE_HOME/dbs` directory on Unix and Linux systems or
`ORACLE_HOME\database` 
on Windows systems.
  1. Unix/Linux: `$ORACLE_HOME/dbs`
  2. Windows: `%ORACLE_HOME%\database`

    Name

    The name of the password file is usually associated with the Oracle instance SID and takes the form:
    1. `orapw<SID>` on Unix and Linux systems
    2. `PWD<SID>.ora` on Windows systems

    Finding Password File Information

    Here are the ways you can find or specify the password file location and name:
    1. Initialization Parameters: The parameters `REMOTE_LOGIN_PASSWORDFILE` and `ORACLE_HOME` in the initialization file (init.ora or spfile.ora) can give you information about password files.
    2. Environment Variables: The `$ORACLE_SID` and `$ORACLE_HOME` environment variables on Unix/Linux or `%ORACLE_SID%` and `%ORACLE_HOME%` on Windows can help you identify the SID and Oracle home directory.
    3. SQL Query: You can query the `v$pwfile_users` view to get details about the password file:
      SELECT * FROM v$pwfile_users;
      
    4. Show Parameter: Use the following SQL command to see the current setting for the `REMOTE_LOGIN_PASSWORDFILE` parameter:
      SHOW PARAMETER REMOTE_LOGIN_PASSWORDFILE;
      

    Creating or Changing the Password File

    If you need to create or re-create the password file, you can use the `orapwd` utility. Here's an example command to create a password file:
    orapwd FILE=$ORACLE_HOME/dbs/orapw$ORACLE_SID PASSWORD= ENTRIES=
    

    Replace `<sys_password>` with the password for the SYS user and `<max_users>`with the maximum number of distinct privileged users you plan to have.

    Key Points to Remember

    1. Make sure the `ORACLE_HOME` and `ORACLE_SID` environment variables are set correctly.
    2. The user who is creating the password file should have write permissions to the specified directory.
    3. Ensure that the `REMOTE_LOGIN_PASSWORDFILE` parameter is set appropriately (`EXCLUSIVE`, `SHARED`, or `NONE`).
    4. Keep the password file secure, and restrict its permissions to prevent unauthorized access.
    By following these guidelines, you should be able to determine the proper location and name for the password file in Oracle 12c.
    The proper name and location for a password file is specific to the operating system. There are some slight differences between Windows and Unix, and there may be differences for other operating systems as well.

    If you make a Mistake

    Naming the password file is one area where Oracle is somewhat forgiving. If you configure a database to use a password file and Oracle can not find the file when you try to start the database, Oracle will display a message showing you the exact directory path and filename that it is looking for. So if you get the filename or location wrong the first time, it is a very easy mistake to correct. You can simply create the password file again using the correct name and location.

    Naming Password file

    The name of the password file for a database should take one of the following two forms:

    Unix: orapw_instance_identifier
    Windows: pwd_instance_identifier.ora

    In both cases, the "_instance_identifier" represents the Oracle instance identifier, or SID. Using the COIN instance as an example, the password file should be named orapwCOIN or pwdCOIN.ora, depending on whether you are running Oracle on Unix or Windows NT. Note that Oracle on Unix does not expect the password file to have an extension, while Oracle running on Windows NT does.

    Placing the password file in Legacy Environments

    In addition to having inconsistent naming conventions across platforms, Oracle also expects to find the password file in different directories for each operating system. For Unix and Windows, the password file should be in one of the following two directories:

    Under Windows, the c:\oracle\ora81 part of the path represents the default install. When installing an Oracle 11g database on a Windows 7 machine which already has a lot of different software installed,
    On win 7 64bit, go to PATH variable
    Right click on my computer > properties > 
    Advanced system Settings > Advanced Tab > 
    click on Envirnment variable > in system variable - look for Path>
    
    1. When the failure occurs during installation of Oracle 11g, click on cancel, you will need to restart the installation from scratch
    2. On win 7 64bit, go to PATH variable(Right click on my computer>properties>Advanced system Settings>Advanced Tab>click on Envirnment variable>in system variable - look for Path>
    3. Find the Path environment in the System Variables window and edit it, click on it and select all the values within it, paste these into a word document or something and save it.
    4. Clear the Path environment and simply add a single directory such as c:\Seer
    5. Start the installation of Oracle 11g again and wait while it executes the process
    6. Return to the Environment Variables and paste the originals back after the new ones put in by the installation
    If you chose a different location for your Oracle home when you installed the software, that part of the path will reflect your choice. Also, do not be confused by the fact that both the Windows NT and Unix implementations have a dbs directory. The password file goes in dbs for Unix and in database for Windows.
    Now, determine the proper location and name for the password file for your own database. Later on in this module, you will use this information to actually create the password file.