一、背景
今天有一个客户忘记了当时安装grid设置得sys密码了,有监控工具需要连接测试。尝试了几次密码都是错误的
1.1 连接登录ASM查看
查看密码文件策略
SQL> show parameter pass
NAME TYPE
------------------------------------ ----------------------
VALUE
------------------------------
remote_login_passwordfile string
EXCLUSIVE
查看_asmid隐含参数
SQL> select a.ksppinm name, b.ksppstvl value, a.ksppdesc description from x$ksppi a, x$ksppcv b where a.indx = b.indx and a.ksppinm like '%_asmsid%';
NAME
--------------------------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------
DESCRIPTION
--------------------------------------------------------------------------------
_asmsid
asm
ASM instance id
查看密码文件
hisnode1-> ll
total 20
-rw-rw---- 1 grid oinstall 1082 Mar 19 01:13 ab_+ASM1.dat
-rw-rw---- 1 grid oinstall 1544 Mar 19 01:13 hc_+ASM1.dat
-rw-r--r-- 1 grid oinstall 2851 May 15 2009 init.ora
-rw-r----- 1 grid oinstall 2048 Jul 28 17:26 orapw+ASM
1.2 测试密码
这里不能使用直接测试方式,这样使用操作系统验证,密码输入什么都是可以连接的
如:sqlplus sys/ASM12345 as sysasm
需要使用简易连接方式:
如hisnode2-> sqlplus sys/asm12345@10.0.0.52:1521/+ASM as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Jul 28 17:23:46 2021
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
提示密码错误
二、修改密码
2.1 修改密码
这里简单说明一下,如果是oracle10g的修改asm sys密码,是需要关闭ASM的
同时这里采用的是asmcmd命令的orapwusr命令进行修改
单机情况命令如下:
Oracle 11g修改单实例asm sys密码的方法
su -
$ asmcmd
ASMCMD> passwd sys
Enter old password (optional): ******
Enter new password: ******
此次RAC修改方式
hisnode1-> asmcmd
ASMCMD> orapwusr --modify --password sys
Enter password: *******
ASMCMD> exit
2.2 同步密码文件
备份所有的密码文件-两个节点
mv orapw+ASM orapw+ASM.bak0728
在rac1上重新生成密码文件,这里需要注意密码文件名字是+ASM,在11g之前是分别是+ASM1 +ASM2等
Example:
Pre 11gR2:
Password file on Node1: orapw+ASM1
Password file on Node2: orapw+ASM2
11gR2:
Password file on Node1: orapw+ASM
Password file on Node2: orapw+ASM
orapwd file='orapw+ASM' entries=5 password=asm1234
同步密码文件到rac2上
scp orapw+ASM hisnode2:/u01/app/11.2.0/grid/dbs
三、再次测试密码有效性
hisnode2-> sqlplus sys/asm1234@10.0.0.52:1521/+ASM as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Jul 28 17:23:40 2021
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> exit
hisnode1-> sqlplus sys/asm1234@10.0.0.51:1521/+ASM as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Jul 28 17:23:14 2021
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> exit
四、参考文档
** Creating ASMSNMP User reports ORA-15306: ASM Password File Update Failed On At Least One Node. (文档 ID 1137504.1)**
How To Change ASM SYS PASSWORD ? (文档 ID 452076.1)
How to Change SYS and SYSTEM Passwords(文档 ID 1051982.6)
五 扩展如何修改oracle RAC 的oracle sys密码
https://www.modb.pro/db/20592
总结一下就是,分别需要修改密码,然后重建密码文件。
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




