There are two ways to authenticate users to the database. One way is to use OS authentication and put the responsibility on the operating system to make sure that users logging in are the correct users and that they have the appropriate privileges. The other way is to use a password file.
Oracle provides a password utility (called orapwd) that helps the DBA to create a password file. This file holds the connection information relevant to users who have been granted the SYSOPER or SYSDBA role. Users logging in as SYSDBA will connect to the SYS schema, not their own. This post discusses 2 methods to create a password file for database in ASM diskgroup. Please note that the steps outlined below are only to be used in a RAC setup.
Method 1
1. Verify Password file exists or not:
$ crsctl stat res ora.HCMPRD.db -f | grep PWFILE PWFILE=
2. Create password file in asm:
$ orapwd file='+DATA/HCMPRD/orapwHCMPRD' dbuniquename='HCMPRD'
3. Now verify password file created or not:
$ crsctl stat res ora.HCMPRD.db -f | grep PWFILE PWFILE=+DATA/HCMPRD/orapwHCMPRD
4. you can see also in ASM_CLIENT:
ASMCMD [+DATA/HCMPRD/PASSWORD] > ls pwdHCMPRD.4594.1016696757 pwdHCMPRD.493.1016696613
5. you can find from asm diskgroup:
$ asmcmd ASMCMD> pwget --dbuniquename HCMPRD +DATA/HCMPRD/orapwHCMPRD ASMCMD>
Method 2 (Valid for 12c Onwards)
An alternative method to create password file 12c asm (This method is valid only for oracle 12c onwards)
Syntax:
ASMCMD> pwcreate –dbuniquename {db_unique_name} {file_path} {sys_password}
Example
1. Here we will create a password file with dbuniquename HCMPRD.
ASMCMD> pwcreate --dbuniquename HCMPRD +DATA/PWDFILE/pwdHCMPRD oracle
2. You can check using srvctl also:
$ srvctl config database -d HCMPRD Database unique name: HCMPRD Database name: Oracle home: /u01/app/oracle/product/12.1.0.2/dbhome_1 Oracle user: oracle Spfile: +DATA/HCMPRD/PARAMETERFILE/spfile.2557.2026287697 Password file: +DATA/HCMPRD/orapwHCMPRD Domain: Start options: open Stop options: immediate Database role: PRIMARY Management policy: AUTOMATIC Server pools: Disk Groups: DATA Mount point paths: Services: Type: RAC Start concurrency: Stop concurrency: OSDBA group: dba OSOPER group: dba Database instances: HCMPRD1,HCMPRD2 Configured nodes: example1a,example1b Database is administrator managed $