Note_Tech

All technological notes.


Project maintained by simonangel-fong Hosted on GitHub Pages — Theme by mattgraham

Recovery - Re-creating Password File

Back


Re-creating a Password Authentication File

Oracle Password File

CREATE USER admin_user IDENTIFIED BY admin_password;
GRANT SYSDBA TO admin_user;
SELECT * FROM V$PWFILE_USERS;

pwd_file



Re-creating a Password File


Steps for re-creating the password file:

  1. Create the password file by using the password utility orapwd.
orapwd file=filename password=password entries=max users

# example
orapwd file=$ORACLE_HOME/dbs/orapwUl5 password=admin entries=20
  • There are no spaces around the “equal to” (=) character.
  • filename: the name of the password file (mandatory).
  • password: the password for SYS (optional).
    • You are prompted for the password if you do not include the password argument.
  • max_users: the maximum number of distinct users allowed to connect as SYSDBA or SYSOPER.
    • If you exceed this number, you must create a new password file.
    • It is safer to have a larger number.
  1. Connect to the database by using the password file created in step 1 and grant privileges as needed
CONNECT sys/admin AS SYSDBA
CREATE USER admin2 IDENTIFIED BY admin_password;
grant sysdba to admin2;

Lab: Restoring the Password File

Setup Environment

# copy pwd file to
cp $ORACLE_HOME/dbs/orapworcl /home/oracle/backup
# remove file
rm $ORACLE_HOME/dbs/orapworcl
# confirm file has been removed
ls $ORACLE_HOME/dbs/orapw*

lab_pwd_file

sqlplus sys@orclpdb as sysdba

lab_pwd_file


Restore password file

# view the description of the orapwd parameters.
orapwd

orapwd FILE=$ORACLE_HOME/dbs/orapworcl ENTRIES=15

lab_pwd_file

sqlplus sys@orclpdb as sysdba

-- view the users in pwf
SELECT * FROM V$PWFILE_USERS;

lab_pwd_file lab_pwd_file


Clean up

# remove the new created pwd file
rm $ORACLE_HOME/dbs/orapworcl
# copy back the old pwd file
cp /home/oracle/backup/orapworcl $ORACLE_HOME/dbs/orapworcl
# confirm file has been removed back
ls $ORACLE_HOME/dbs/orapw*

TOP