- ANKUSH THAVALI
- 11 Jun, 2022
- 0 Comments
- 9 Mins Read
PaSSword File – orapwd Utility in Oracle
Password file - orapwd utility in Oracle
Oracle password file stores passwords for users with administrative privileges.
Password file for an Oracle database is called a database password file, and the password file for Oracle ASM is called an Oracle ASM password file.Â
%ORACLE_HOME%\database\PWD%ORACLE_SID%.ora on Windows
REMOTE_LOGIN_PASSWORDFILE
NONEÂ – Oracle ignores the password file if it exists i.e. no privileged connections are allowed over non-secure connections. If REMOTE_LOGIN_PASSWORDFILE is set to EXCLUSIVE or SHARED and the password file is missing, this is equivalent to setting REMOTE_LOGIN_PASSWORDFILE to NONE.
EXCLUSIVEÂ (default) – Password file is exclusively used by only one (instance of the) database. Any user can be added to the password file. Only an EXCLUSIVE file can be modified. EXCLUSIVE password file enables you to add, modify, and delete users. It also enables you to change the SYS password with the ALTER USER command.
SHARED – The password file is shared among databases. A SHARED password file can be used by multiple databases running on the same server, or multiple instances of an Oracle RAC database. However, the only user that can be added/authenticated is SYS.
A SHARED password file cannot be modified i.e. you cannot add users to a SHARED password file. Any attempt to do so or to change the password of SYS or other users with the SYSDBA or SYSOPER or SYSASM (this is from Oracle 11g), SYSKM, SYSDG and SYSBACKUP (these 3 are from Oracle 12c R1) privileges generates an error. All users needing SYSDBA, SYSOPER, SYSASM, SYSKM, SYSDG and SYSBACKUP system privileges must be added to the password file when REMOTE_LOGIN_PASSWORDFILE is set to EXCLUSIVE. After all users are added, you can change REMOTE_LOGIN_PASSWORDFILE to SHARED.
Till Oracle 11g:
$ orapwd file=password_file_name [password=the_password] [entries=n] [force=Y|N] [ignorecase=Y|N] [nosysdba=Y|N] From Oracle Database 12c release 2: orapwd FILE = filename [FORCE = {y|n}] [ASM = {y|n}] [DBUNIQUENAME = dbname] [FORMAT = {12.2|12}] [SYS = {y|n|password|external('sys-external-name')|global('sys-directory-DN')}] [SYSBACKUP = {y|n|password|external('sysbackup-external-name')|global('sysbackup-directory-DN')}] [SYSDG = {y|n|password|external('sysdg-external-name')|global('sysdg-directory-DN')}] [SYSKM = {y|n|password|external('syskm-external-name')|global('syskm directory-DN')}] [DELETE = {y|n}] [INPUT_FILE = input-fname]
Examples:
$ orapwd file=orapwSID password=sys_password force=y nosysdba=y $ orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=secret $ orapwd file=orapwprod entries=32 force=y C:\orapwd file=%ORACLE_HOME%\database\PWD%ORACLE_SID%.ora password=2012 entries=20 C:\orapwd file=D:\oracle11g\product\11.1.0\db_1\database\pwdsfs.ora password=id entries=8 force=y $ orapwd file=orapwPRODB3 password=abc123 entries=12 ignorecase=n $ orapwd file=orapwprodb password=oracle1 ignorecase=y $ orapwd FILE='+DATA/orcl/orapworcl' DBUNIQUENAME='orcl' SYSBACKUP=password FORMAT=12.2 $ orapwd FILE='+DATA/orcl/orapworcl' DBUNIQUENAME='orcl' FORMAT=12.2 sys=external('[email protected]') syskm=external('[email protected]') $ orapwd FILE='/u01/oracle/dbs/orapworcl' FORMAT=12.2 INPUT_FILE='/u01/oracle/dbs/orapworcl' FORCE=y $ orapwd FILE='/u01/oracle/dbs/orapworcl' SYS=Y INPUT_FILE='/u01/oracle/dbs/orapworcl' FORCE=y$ orapwd DESCRIBE FILE=’orapwprod’
Oracle Database 12C onwards, IGNORECASE parameter has been deprecated.
The administrative privileges SYSBACKUP, SYSDG, and SYSKM are not supported in the password file when the file is created with the FORMAT=LEGACY argument. 12.2 is the default for the FORMAT command line argument.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.
Granting SYSDBA, SYSOPER, SYSASM, SYSKM, SYSDG or SYSBACKUP privileges
select * from v$pwfile_users;
Column | Description |
---|---|
USERNAME | This column contains the name of the user that is recognized by the password file. Â |
SYSDBA | If the value of this column is TRUE, then the user can log on with SYSDBA system privilege. Â |
SYSOPER | If the value of this column is TRUE, then the user can log on with SYSOPER system privilege. Â |
SYSASM | If the value of this column is TRUE, then the user can log on with SYSASM system privilege. |
If orapwd has not yet been executed or password file is not available, attempting to grant SYSDBA, SYSOPER, SYSASM, SYSKM, SYSDG or SYSBACKUPÂ privileges will result in the following error:
grant sysdba to Chetan; ORA-01994: GRANT failed: cannot add users to public password file
If your server is using an EXCLUSIVE password file, use the GRANT statement to grant the SYSDBA, SYSOPER, SYSASM, SYSKM, SYSDG or SYSBACKUPÂ system privilege to a user, as shown in the following example:
grant sysoper to Chetan; select * from v$pwfile_users; USERNAME SYSDBA SYSOPER SYSASM SYSBACKUP SYSKM SYSDG -------- ------ ------- ------ ------ ------- ------ SYS TRUE TRUE FALSE FALSE FALSE FALSE SATYA TRUE TRUE FALSE FALSE FALSE FALSE
grant sysasm to Chetan; SQL> select * from v$pwfile_users; USERNAME SYSDBA SYSOPER SYSASM SYSBACKUP SYSKM SYSDG -------- ------ ------- ------ ------ ------- ------ SYS TRUE TRUE FALSE FALSE FALSE FALSE SATYA TRUE TRUE TRUE FALSE FALSE FALSE
Use the REVOKE statement to revoke the SYSDBA, SYSOPER, SYSASM, SYSKM, SYSDG and SYSBACKUPÂ system privilege from a user, as shown in the following example:
revoke sysoper from Chetan; SQL> select * from v$pwfile_users; USERNAME SYSDBA SYSOPER SYSASM SYSASM SYSBACKUP SYSKM SYSDG -------- ------ ------- ------ ------ ------- ------ SYS TRUE TRUE FALSE FALSE FALSE FALSE SATYA TRUE FALSE TRUE FALSE FALSE FALSE
REVOKE SYSDG FROM non-SYS-user; GRANT SYSKM TO non-SYS-user;