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>