oracle sp2-0157,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->

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

rac1->ll

……

-rw-r-----1oracleoinstall1536Jun212009orapwdevdb1

##我们看到这边的密码文件还是2009年6月21日的。我们到数据库更改sys密码。

rac1->sqlplus"/ as sysdba"

SQL*Plus:Release10.2.0.1.0-ProductiononTueMar3022:31:592010

Copyright(c)1982,2005,Oracle.Allrightsreserved.

Connectedto:

OracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-Production

WiththePartitioning,RealApplicationClusters,OLAPandDataMiningoptions

SQL>alterusersysidentifiedbyoracle123;

Useraltered.

SQL>

## 我们看到密码文件被更新

rac1->ls-l

……

-rw-r-----1oracleoinstall1536Mar3022:33orapwdevdb1

rac1->date

TueMar3022:33:42CST2010

rac1->

rac2上:

rac2-> ll

……

-rw-r----- 1 oracle oinstall 1536 Jun 21 2009 orapwdevdb2

##密码文件未被更新

1

2

3

4

5

rac2->ll

……

-rw-r-----1oracleoinstall1536Jun212009orapwdevdb2

##密码文件未被更新

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

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

rac3->cd$ORACLE_HOME/dbs

rac3->ll

……

-rw-r-----1oracleoinstall1536Jun212009orapwdevdb3

rac3->

## rac3上的密码文件也未被更新。

## 新密码无法登录rac3和rac2,但是可以用老密码远程登录rac3和rac2,用新密码远程登录rac1.

[root@rac3root]# sqlplus "sys/oracle123@DEVDB3 as sysdba"

SQL*Plus:Release10.2.0.1.0-ProductiononTueMar3022:46:182010

Copyright(c)1982,2005,Oracle.Allrightsreserved.

ERROR:

ORA-01017:invalidusername/password;logondenied

Enteruser-name:

ERROR:

ORA-01017:invalidusername/password;logondenied

Enteruser-name:

ERROR:

ORA-01017:invalidusername/password;logondenied

SP2-0157:unabletoCONNECTtoORACLEafter3attempts,exitingSQL*Plus

[root@rac3root]

[root@rac3admin]# sqlplus "sys/oracle@DEVDB2 as sysdba"

SQL*Plus:Release10.2.0.1.0-ProductiononTueMar3023:59:222010

Copyright(c)1982,2005,Oracle.Allrightsreserved.

Connectedto:

OracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-Production

WiththePartitioning,RealApplicationClusters,OLAPandDataMiningoptions

SQL>exit

DisconnectedfromOracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-Production

WiththePartitioning,RealApplicationClusters,OLAPandDataMiningoption

[root@rac3admin]# sqlplus "sys/oracle@DEVDB3 as sysdba"

SQL*Plus:Release10.2.0.1.0-ProductiononTueMar3023:58:492010

Copyright(c)1982,2005,Oracle.Allrightsreserved.

Connectedto:

OracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-Production

WiththePartitioning,RealApplicationClusters,OLAPandDataMiningoptions

SQL>exit

DisconnectedfromOracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-Production

WiththePartitioning,RealApplicationClusters,OLAPandDataMiningoptions

[root@rac3admin]#

[root@rac3admin]# sqlplus "sys/oracle123@devdb1 as sysdba"

SQL*Plus:Release10.2.0.1.0-ProductiononWedMar3100:23:272010

Copyright(c)1982,2005,Oracle.Allrightsreserved.

Connectedto:

OracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-Production

WiththePartitioning,RealApplicationClusters,OLAPandDataMiningoptions

SQL>

因此,为了避免出现这样的问题,我们可以有以下解决方式:

1、最简单方式就是更改sys密码的时候,在每个节点上都运行一次alter user命令,使得每个主机上的密码文件都被更新成同一个的密码的密码文件。

2、找一个共享存储的文件系统,nfs或者ocfs或者其他的共享方式都可以。只要保证是共享的文件系统就可以,共享的裸设备不行。然后把各个节点上的密码文件link到共享存储上的同一个密码文件。

1

2

1、最简单方式就是更改sys密码的时候,在每个节点上都运行一次alteruser命令,使得每个主机上的密码文件都被更新成同一个的密码的密码文件。

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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

[root@rac1root]# cd /ocfs

[root@rac1ocfs]# mkdir pwdfile

[root@rac1ocfs]# chown oracle:dba pwdfile

[root@rac1ocfs]# su - oracle

rac1->cd/ocfs

rac1->cdpwdfile

rac1->cp$ORACLE_HOME/dbs/orapwdevdb1orapwdevdb

rac1->ll

total2

-rw-r-----1oracleoinstall1536Mar3100:33orapwdevdb

rac1->cd$ORACLE_HOME/dbs/

rac1->ll

total88

-rw-rw----1oracleoinstall1584Mar3022:16ab_+ASM1.dat

-rw-r-----1oracleoinstall1544Jun212009hc_+ASM1.dat

-rw-r-----1oracleoinstall1544Jun212009hc_devdb1.dat

lrwxrwxrwx1oracleoinstall41Jun212009init+ASM1.ora->/u01/app/oracle/admin/+ASM/pfile/init.ora

-rw-r-----1oracleoinstall36Jun212009initdevdb1.ora

-rw-r-----1oracleoinstall12920May32001initdw.ora

-rw-r-----1oracleoinstall8385Sep111998init.ora

-rw-r-----1oracleoinstall1536Jun212009orapw+ASM1

-rw-r-----1oracleoinstall1536Mar3022:33orapwdevdb1

rac1->mvorapwdevdb1orapwdevdb1.bak20100330

rac1->ln-s/ocfs/pwdfile/orapwdevdborapwdevdb1

rac1->ll

total92

-rw-rw----1oracleoinstall1584Mar3022:16ab_+ASM1.dat

-rw-r-----1oracleoinstall1544Jun212009hc_+ASM1.dat

-rw-r-----1oracleoinstall1544Jun212009hc_devdb1.dat

lrwxrwxrwx1oracleoinstall41Jun212009init+ASM1.ora->/u01/app/oracle/admin/+ASM/pfile/init.ora

-rw-r-----1oracleoinstall36Jun212009initdevdb1.ora

-rw-r-----1oracleoinstall12920May32001initdw.ora

-rw-r-----1oracleoinstall8385Sep111998init.ora

-rw-r-----1oracleoinstall1536Jun212009orapw+ASM1

lrwxrwxrwx1oracleoinstall24Mar3100:35orapwdevdb1->/ocfs/pwdfile/orapwdevdb

-rw-r-----1oracleoinstall1536Mar3022:33orapwdevdb1.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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

rac2->ln-s/ocfs/pwdfile/orapwdevdborapwdevdb2

rac2->ll

total92

-rw-rw----1oracleoinstall1558Mar3022:16ab_+ASM2.dat

-rw-r-----1oracleoinstall1544Jun212009hc_+ASM2.dat

-rw-r-----1oracleoinstall1544Jun212009hc_devdb2.dat

lrwxrwxrwx1oracleoinstall41Jun212009init+ASM2.ora->/u01/app/oracle/admin/+ASM/pfile/init.ora

-rw-r-----1oracleoinstall36Jun212009initdevdb2.ora

-rw-r-----1oracleoinstall12920May32001initdw.ora

-rw-r-----1oracleoinstall8385Sep111998init.ora

-rw-r-----1oracleoinstall1536Jun212009orapw+ASM2

lrwxrwxrwx1oracleoinstall24Mar3100:35orapwdevdb2->/ocfs/pwdfile/orapwdevdb

-rw-r-----1oracleoinstall1536Jun212009orapwdevdb2.bak20100330

rac3->ln-s/ocfs/pwdfile/orapwdevdborapwdevdb3

rac3->ll

total92

-rw-rw----1oracleoinstall1558Mar3022:16ab_+ASM3.dat

-rw-rw----1oracleoinstall1544Jul82009hc_+ASM3.dat

-rw-rw----1oracleoinstall1544Jul82009hc_devdb3.dat

lrwxrwxrwx1oracleoinstall41Jul82009init+ASM3.ora->/u01/app/oracle/admin/+ASM/pfile/init.ora

-rw-r-----1oracleoinstall36Jul82009initdevdb3.ora

-rw-r-----1oracleoinstall12920May32001initdw.ora

-rw-r-----1oracleoinstall8385Sep111998init.ora

-rw-r-----1oracleoinstall1536Jun212009orapw+ASM3

lrwxrwxrwx1oracleoinstall24Mar3100:36orapwdevdb3->/ocfs/pwdfile/orapwdevdb

-rw-r-----1oracleoinstall1536Jun212009orapwdevdb3.bak20100330

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值