How to recreate the lost ASM password in Oracle Clusterware?

NeilZhang
NeilZhang
管理员
140
文章
106.8千
浏览
Oracle评论1,554字数 879阅读2分55秒阅读模式

Last night my friend called me to check the network service issue after she added two SCAN IPs to one RAC system.

She added these two IPs to resolve load balance issue as the customer found the connections were not distributed on two nodes evenly. I suggested her to check the service configuration as I thought even there was just one SCAN IPs the connections should also be distributed according to the service configuration.

She still added two SCAN IPs and found the issue was not fixed so she tried to restart the network service when the cluster service was running, but for some reason the network service could not be started. I asked her to stop the Clusterware service first then restarted the network service. She did while still failed to start the network service.

I got confused as the system works well for years so I told her to restart the node and hoped to recover the error. Of course it still failed even we could not access it through the public IP. Here I found I made a mistake that I should not reboot the node before I fixed the network issue. Luckily we still had a workable node so through it we logged in the failed node using private IP. This time I reviewed the network config file carefully and found one line 'DEVICE=eno52' was missed in the failed public network interface and I added it then restarted the network service successfully. It was weird as the config file was not changed from year 2019 so I guessed something changed on the Linux system side and now this line was required.

Next we found the Clusterware failed to start automatically. I tried to recover the system first so I started the ASM instance manually and most clusterware services were booted except the crsd service. I checked the crsd log and found the crsd service failed to access the ASM instance with wrong password error and the path of password file was pointed to one deleted ASM disk group.

We still had a workable node so we confirmed the wrong path on it.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
[grid@node01:/home/grid]$srvctl config asm
ASM home: <CRS home>
Password file: +griddata/orapwASM
Backup of Password file:
ASM listener: LISTENER
ASM instance count: 3
Cluster ASM listener: ASMNET1LSNR_ASM
[grid@node01:/home/grid]$srvctl config asm ASM home: <CRS home> Password file: +griddata/orapwASM Backup of Password file: ASM listener: LISTENER ASM instance count: 3 Cluster ASM listener: ASMNET1LSNR_ASM
  1. [grid@node01:/home/grid]$srvctl config asm
  2. ASM home: <CRS home>
  3. Password file: +griddata/orapwASM
  4. Backup of Password file:
  5. ASM listener: LISTENER
  6. ASM instance count: 3
  7. Cluster ASM listener: ASMNET1LSNR_ASM

The bad new was that we even could not find a backup of the ASM password file.

Several months ago she migrated the OCR and vote disks from the GRIDDATA to OCRNEW and dropped the GRIDDATA.

From this note, we found a scare information:

If manual backup of the ASM passwordfile is not available then, please deconfigure and re-configure the clusterware by following the document "Doc ID 1377349.1"

And below one provides much more details in such situation.

How to recreate shared ASM password file in 12c GI cluster (Doc ID 1929673.1)

We recreated the lost ASM password file following below commands:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
[grid@node02:/home/grid]$$ORACLE_HOME/bin/ocrdump /tmp/ocr.dmp
PROT-310: Not all keys were dumped due to permissions.
[grid@node02:/home/grid]$vi /tmp/ocr.dmp
##Search SYSTEM.ASM.CREDENTIALS.USERS.CRSUSER__ASM_001
[SYSTEM.ASM.CREDENTIALS.USERS.CRSUSER__ASM_001]
ORATEXT : cc081ab75e72ff20bf7628cfedad880d:grid
SECURITY : {USER_PERMISSION : PROCR_ALL_ACCESS, GROUP_PERMISSION : PROCR_READ, OTHER_PERMISSION : PROCR_NONE, USER_NAME : grid, GROUP_NAME : oinstall}
[grid@node02:/home/grid]$$ORACLE_HOME/bin/ocrdump /tmp/ocr.dmp PROT-310: Not all keys were dumped due to permissions. [grid@node02:/home/grid]$vi /tmp/ocr.dmp ##Search SYSTEM.ASM.CREDENTIALS.USERS.CRSUSER__ASM_001 [SYSTEM.ASM.CREDENTIALS.USERS.CRSUSER__ASM_001] ORATEXT : cc081ab75e72ff20bf7628cfedad880d:grid SECURITY : {USER_PERMISSION : PROCR_ALL_ACCESS, GROUP_PERMISSION : PROCR_READ, OTHER_PERMISSION : PROCR_NONE, USER_NAME : grid, GROUP_NAME : oinstall}
  1. [grid@node02:/home/grid]$$ORACLE_HOME/bin/ocrdump /tmp/ocr.dmp
  2. PROT-310: Not all keys were dumped due to permissions.
  3. [grid@node02:/home/grid]$vi /tmp/ocr.dmp
  4. ##Search SYSTEM.ASM.CREDENTIALS.USERS.CRSUSER__ASM_001
  5. [SYSTEM.ASM.CREDENTIALS.USERS.CRSUSER__ASM_001]
  6. ORATEXT : cc081ab75e72ff20bf7628cfedad880d:grid
  7. SECURITY : {USER_PERMISSION : PROCR_ALL_ACCESS, GROUP_PERMISSION : PROCR_READ, OTHER_PERMISSION : PROCR_NONE, USER_NAME : grid, GROUP_NAME : oinstall}

Wrote down the string 'cc081ab75e72ff20bf7628cfedad880d' and got the needed username and password using it.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
[grid@node02:/home/grid]$crsctl get credmaint -path /ASM/Self/cc081ab75e72ff20bf7628cfedad880d -credtype userpass -id 0 -attr user -local
CRSUSER__ASM_001
[grid@node02:/home/grid]$crsctl get credmaint -path /ASM/Self/cc081ab75e72ff20bf7628cfedad880d -credtype userpass -id 0 -attr passwd -local
nMvLqKfQr3P0FupelnGluQJEbDF02
[grid@node02:/home/grid]$crsctl get credmaint -path /ASM/Self/cc081ab75e72ff20bf7628cfedad880d -credtype userpass -id 0 -attr user -local CRSUSER__ASM_001 [grid@node02:/home/grid]$crsctl get credmaint -path /ASM/Self/cc081ab75e72ff20bf7628cfedad880d -credtype userpass -id 0 -attr passwd -local nMvLqKfQr3P0FupelnGluQJEbDF02
  1. [grid@node02:/home/grid]$crsctl get credmaint -path /ASM/Self/cc081ab75e72ff20bf7628cfedad880d -credtype userpass -id 0 -attr user -local
  2. CRSUSER__ASM_001
  3. [grid@node02:/home/grid]$crsctl get credmaint -path /ASM/Self/cc081ab75e72ff20bf7628cfedad880d -credtype userpass -id 0 -attr passwd -local
  4. nMvLqKfQr3P0FupelnGluQJEbDF02

The string 'nMvLqKfQr3P0FupelnGluQJEbDF02' was the password and we had to reuse it.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
[grid@node01:/home/grid]$asmcmd
ASMCMD> pwget --asm
+griddata/orapwASM
ASMCMD> pwcreate --asm +OCRNEW/orapwASM 'Abcd#1234'
OPW-00010: Could not create the password file. This resource has a Password File.
ASMCMD-9454: could not create new password file
ASMCMD> pwcreate --asm +OCRNEW/orapwASM 'Abcd#1234' -f
ASMCMD> pwget --asm
+OCRNEW/orapwasm
ASMCMD> lspwusr
Username sysdba sysoper sysasm
SYS TRUE TRUE FALSE
ASMCMD> orapwusr --grant sysasm SYS
ASMCMD> orapwusr --add ASMSNMP
Enter password: *********
ASMCMD> orapwusr --grant sysdba ASMSNMP
ASMCMD> lspwusr
Username sysdba sysoper sysasm
SYS TRUE TRUE TRUE
ASMSNMP TRUE FALSE FALSE
ASMCMD> orapwusr --add CRSUSER__ASM_001
Enter password: ***************************** ####Must use the password got in the previous result
ASMCMD> lspwusr
Username sysdba sysoper sysasm
SYS TRUE TRUE TRUE
ASMSNMP TRUE FALSE FALSE
CRSUSER__ASM_001 FALSE FALSE FALSE
ASMCMD> orapwusr --grant sysdba CRSUSER__ASM_001
ASMCMD> orapwusr --grant sysasm CRSUSER__ASM_001
ASMCMD> lspwusr
Username sysdba sysoper sysasm
SYS TRUE TRUE TRUE
ASMSNMP TRUE FALSE FALSE
CRSUSER__ASM_001 TRUE FALSE TRUE
ASMCMD> exit
[grid@node01:/home/grid]$srvctl config asm
ASM home: <CRS home>
Password file: +OCRNEW/orapwasm
Backup of Password file:
ASM listener: LISTENER
ASM instance count: 3
Cluster ASM listener: ASMNET1LSNR_ASM
[grid@node01:/home/grid]$asmcmd ASMCMD> pwget --asm +griddata/orapwASM ASMCMD> pwcreate --asm +OCRNEW/orapwASM 'Abcd#1234' OPW-00010: Could not create the password file. This resource has a Password File. ASMCMD-9454: could not create new password file ASMCMD> pwcreate --asm +OCRNEW/orapwASM 'Abcd#1234' -f ASMCMD> pwget --asm +OCRNEW/orapwasm ASMCMD> lspwusr Username sysdba sysoper sysasm SYS TRUE TRUE FALSE ASMCMD> orapwusr --grant sysasm SYS ASMCMD> orapwusr --add ASMSNMP Enter password: ********* ASMCMD> orapwusr --grant sysdba ASMSNMP ASMCMD> lspwusr Username sysdba sysoper sysasm SYS TRUE TRUE TRUE ASMSNMP TRUE FALSE FALSE ASMCMD> orapwusr --add CRSUSER__ASM_001 Enter password: ***************************** ####Must use the password got in the previous result ASMCMD> lspwusr Username sysdba sysoper sysasm SYS TRUE TRUE TRUE ASMSNMP TRUE FALSE FALSE CRSUSER__ASM_001 FALSE FALSE FALSE ASMCMD> orapwusr --grant sysdba CRSUSER__ASM_001 ASMCMD> orapwusr --grant sysasm CRSUSER__ASM_001 ASMCMD> lspwusr Username sysdba sysoper sysasm SYS TRUE TRUE TRUE ASMSNMP TRUE FALSE FALSE CRSUSER__ASM_001 TRUE FALSE TRUE ASMCMD> exit [grid@node01:/home/grid]$srvctl config asm ASM home: <CRS home> Password file: +OCRNEW/orapwasm Backup of Password file: ASM listener: LISTENER ASM instance count: 3 Cluster ASM listener: ASMNET1LSNR_ASM
  1. [grid@node01:/home/grid]$asmcmd
  2. ASMCMD> pwget --asm
  3. +griddata/orapwASM
  4. ASMCMD> pwcreate --asm +OCRNEW/orapwASM 'Abcd#1234'
  5. OPW-00010: Could not create the password file. This resource has a Password File.
  6.  
  7. ASMCMD-9454: could not create new password file
  8. ASMCMD> pwcreate --asm +OCRNEW/orapwASM 'Abcd#1234' -f
  9. ASMCMD> pwget --asm
  10. +OCRNEW/orapwasm
  11. ASMCMD> lspwusr
  12. Username sysdba sysoper sysasm
  13. SYS TRUE TRUE FALSE
  14. ASMCMD> orapwusr --grant sysasm SYS
  15. ASMCMD> orapwusr --add ASMSNMP
  16. Enter password: *********
  17. ASMCMD> orapwusr --grant sysdba ASMSNMP
  18. ASMCMD> lspwusr
  19. Username sysdba sysoper sysasm
  20. SYS TRUE TRUE TRUE
  21. ASMSNMP TRUE FALSE FALSE
  22. ASMCMD> orapwusr --add CRSUSER__ASM_001
  23. Enter password: ***************************** ####Must use the password got in the previous result
  24. ASMCMD> lspwusr
  25. Username sysdba sysoper sysasm
  26. SYS TRUE TRUE TRUE
  27. ASMSNMP TRUE FALSE FALSE
  28. CRSUSER__ASM_001 FALSE FALSE FALSE
  29. ASMCMD> orapwusr --grant sysdba CRSUSER__ASM_001
  30. ASMCMD> orapwusr --grant sysasm CRSUSER__ASM_001
  31. ASMCMD> lspwusr
  32. Username sysdba sysoper sysasm
  33. SYS TRUE TRUE TRUE
  34. ASMSNMP TRUE FALSE FALSE
  35. CRSUSER__ASM_001 TRUE FALSE TRUE
  36. ASMCMD> exit
  37. [grid@node01:/home/grid]$srvctl config asm
  38. ASM home: <CRS home>
  39. Password file: +OCRNEW/orapwasm
  40. Backup of Password file:
  41. ASM listener: LISTENER
  42. ASM instance count: 3
  43. Cluster ASM listener: ASMNET1LSNR_ASM

Then we restarted the clusterware and this time it worked well.

So to avoid such things, we'd better make a manual backup of the ASM password file.

 
  • 本文由 NeilZhang 发表于04/07/2021 13:18:35
  • Repost please keep this link: https://www.dbcloudsvc.com/blogs/oracle/how-to-recreate-the-lost-asm-password-in-oracle-clusterware/
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定