rac修改sys密码

sys是数据库库中权限最高的用户,在登录时,我们可以用os认证的方式直接登录,也可以利用sqlplus “sys/your_password@your_tnsnames as sysdba”来登录。特别是对于后面的这种远程登录,在第三方的备份备份软件中需要配置。因此这个文件对于使用了第三方备份软件的数据库系统,就比较重要了。

在单实例,如果我们在数据库执行了更改密码的命令:alter user sys identified by new_password;这个时候,数据库就会自动的改写$ORACLE_HOME/dbs/下的密码文件,将里面的内容改成新密码。但是在rac中,这就是一个比较需要注意的地方了。

在rac中,如果你仅仅是在一个节点上运行alter user sys的命令,完成更改后,数据库自动在此节点上更新密码文件。但是,在其他节点中,这个密码文件不会被更新,还是原来的密码文件。这就造成了一个很奇特的现象:在一个3节点的rac中,rac1上登录数据库后更改了sys的密码,在rac1主机上的密码文件被更新,rac2和rac3主机上密码文件不会被更新,仍然能用老密码来登录rac2和rac3。
rac1:

rac1-> ll
……
-rw-r-----  1 oracle oinstall  1536 Jun 21  2009 orapwdevdb1
 
##我们看到这边的密码文件还是2009年6月21日的。我们到数据库更改sys密码。
 
rac1-> sqlplus "/ as sysdba"
 
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Mar 30 22:31:59 2010
 
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
 
 
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
 
SQL> alter user sys identified by oracle123;
 
User altered.
 
SQL>
 
## 我们看到密码文件被更新
rac1-> ls -l
……
-rw-r-----  1 oracle oinstall  1536 Mar 30 22:33 orapwdevdb1
rac1-> date
Tue Mar 30 22:33:42 CST 2010
rac1->
rac2上:

rac2-> ll
……
-rw-r-----  1 oracle oinstall  1536 Jun 21  2009 orapwdevdb2
 
##密码文件未被更新
rac3:

rac3-> cd $ORACLE_HOME/dbs
rac3-> ll
……
-rw-r-----  1 oracle oinstall  1536 Jun 21  2009 orapwdevdb3
rac3->
 
## rac3上的密码文件也未被更新。
## 新密码无法登录rac3和rac2,但是可以用老密码远程登录rac3和rac2,用新密码远程登录rac1.
[root@rac3 root]# sqlplus "sys/oracle123@DEVDB3 as sysdba"
 
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Mar 30 22:46:18 2010
 
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
 
ERROR:
ORA-01017: invalid username/password; logon denied
 
 
Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied
 
 
Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied
 
 
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
[root@rac3 root]
[root@rac3 admin]# sqlplus "sys/oracle@DEVDB2 as sysdba"
 
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Mar 30 23:59:22 2010
 
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
 
 
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
 
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining option
 
[root@rac3 admin]# sqlplus "sys/oracle@DEVDB3 as sysdba"
 
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Mar 30 23:58:49 2010
 
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
 
 
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
 
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
[root@rac3 admin]#
 
[root@rac3 admin]# sqlplus "sys/oracle123@devdb1 as sysdba"
 
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Mar 31 00:23:27 2010
 
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
 
 
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
 
SQL>
因此,为了避免出现这样的问题,我们可以有以下解决方式:

1、最简单方式就是更改sys密码的时候,在每个节点上都运行一次alter user命令,使得每个主机上的密码文件都被更新成同一个的密码的密码文件。
2、找一个共享存储的文件系统,nfs或者ocfs或者其他的共享方式都可以。只要保证是共享的文件系统就可以,共享的裸设备不行。然后把各个节点上的密码文件link到共享存储上的同一个密码文件。
下面的例子是以ocfs为例:
rac1:

[root@rac1 root]# cd /ocfs
[root@rac1 ocfs]# mkdir pwdfile
[root@rac1 ocfs]# chown oracle:dba pwdfile
[root@rac1 ocfs]# su - oracle
rac1-> cd /ocfs
rac1-> cd pwdfile
rac1-> cp $ORACLE_HOME/dbs/orapwdevdb1 orapwdevdb
rac1-> ll
total 2
-rw-r-----  1 oracle oinstall 1536 Mar 31 00:33 orapwdevdb
 
rac1-> cd $ORACLE_HOME/dbs/          
rac1-> ll
total 88
-rw-rw----  1 oracle oinstall  1584 Mar 30 22:16 ab_+ASM1.dat
-rw-r-----  1 oracle oinstall  1544 Jun 21  2009 hc_+ASM1.dat
-rw-r-----  1 oracle oinstall  1544 Jun 21  2009 hc_devdb1.dat
lrwxrwxrwx  1 oracle oinstall    41 Jun 21  2009 init+ASM1.ora -> /u01/app/oracle/admin/+ASM/pfile/init.ora
-rw-r-----  1 oracle oinstall    36 Jun 21  2009 initdevdb1.ora
-rw-r-----  1 oracle oinstall 12920 May  3  2001 initdw.ora
-rw-r-----  1 oracle oinstall  8385 Sep 11  1998 init.ora
-rw-r-----  1 oracle oinstall  1536 Jun 21  2009 orapw+ASM1
-rw-r-----  1 oracle oinstall  1536 Mar 30 22:33 orapwdevdb1
rac1-> mv orapwdevdb1 orapwdevdb1.bak20100330
rac1-> ln -s /ocfs/pwdfile/orapwdevdb orapwdevdb1
rac1-> ll
total 92
-rw-rw----  1 oracle oinstall  1584 Mar 30 22:16 ab_+ASM1.dat
-rw-r-----  1 oracle oinstall  1544 Jun 21  2009 hc_+ASM1.dat
-rw-r-----  1 oracle oinstall  1544 Jun 21  2009 hc_devdb1.dat
lrwxrwxrwx  1 oracle oinstall    41 Jun 21  2009 init+ASM1.ora -> /u01/app/oracle/admin/+ASM/pfile/init.ora
-rw-r-----  1 oracle oinstall    36 Jun 21  2009 initdevdb1.ora
-rw-r-----  1 oracle oinstall 12920 May  3  2001 initdw.ora
-rw-r-----  1 oracle oinstall  8385 Sep 11  1998 init.ora
-rw-r-----  1 oracle oinstall  1536 Jun 21  2009 orapw+ASM1
lrwxrwxrwx  1 oracle oinstall    24 Mar 31 00:35 orapwdevdb1 -> /ocfs/pwdfile/orapwdevdb
-rw-r-----  1 oracle oinstall  1536 Mar 30 22:33 orapwdevdb1.bak20100330
rac2和rac3也类似的建立link:

rac2-> ln -s /ocfs/pwdfile/orapwdevdb orapwdevdb2
rac2-> ll
total 92
-rw-rw----  1 oracle oinstall  1558 Mar 30 22:16 ab_+ASM2.dat
-rw-r-----  1 oracle oinstall  1544 Jun 21  2009 hc_+ASM2.dat
-rw-r-----  1 oracle oinstall  1544 Jun 21  2009 hc_devdb2.dat
lrwxrwxrwx  1 oracle oinstall    41 Jun 21  2009 init+ASM2.ora -> /u01/app/oracle/admin/+ASM/pfile/init.ora
-rw-r-----  1 oracle oinstall    36 Jun 21  2009 initdevdb2.ora
-rw-r-----  1 oracle oinstall 12920 May  3  2001 initdw.ora
-rw-r-----  1 oracle oinstall  8385 Sep 11  1998 init.ora
-rw-r-----  1 oracle oinstall  1536 Jun 21  2009 orapw+ASM2
lrwxrwxrwx  1 oracle oinstall    24 Mar 31 00:35 orapwdevdb2 -> /ocfs/pwdfile/orapwdevdb
-rw-r-----  1 oracle oinstall  1536 Jun 21  2009 orapwdevdb2.bak20100330
 
 
rac3-> ln -s /ocfs/pwdfile/orapwdevdb orapwdevdb3
rac3-> ll
total 92
-rw-rw----  1 oracle oinstall  1558 Mar 30 22:16 ab_+ASM3.dat
-rw-rw----  1 oracle oinstall  1544 Jul  8  2009 hc_+ASM3.dat
-rw-rw----  1 oracle oinstall  1544 Jul  8  2009 hc_devdb3.dat
lrwxrwxrwx  1 oracle oinstall    41 Jul  8  2009 init+ASM3.ora -> /u01/app/oracle/admin/+ASM/pfile/init.ora
-rw-r-----  1 oracle oinstall    36 Jul  8  2009 initdevdb3.ora
-rw-r-----  1 oracle oinstall 12920 May  3  2001 initdw.ora
-rw-r-----  1 oracle oinstall  8385 Sep 11  1998 init.ora
-rw-r-----  1 oracle oinstall  1536 Jun 21  2009 orapw+ASM3
lrwxrwxrwx  1 oracle oinstall    24 Mar 31 00:36 orapwdevdb3 -> /ocfs/pwdfile/orapwdevdb
-rw-r-----  1 oracle oinstall  1536 Jun 21  2009 orapwdevdb3.bak20100330

文章出自:http://www.oracleblog.cn/study-note/change-rac-password-file/

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11134237/viewspace-631256/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/11134237/viewspace-631256/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值