码迷,mamicode.com
首页 > 其他好文 > 详细

rac环境密码文件管理

时间:2017-04-03 12:51:04      阅读:319      评论:0      收藏:0      [点我收藏+]

标签:不一致   add   3.0   共享   更改密码   不同   ade   ice   cte   

密码文件作用:

密码文件用于dba用户的登录认证。

dba用户:具备sysdba和sysoper权限的用户,即oracle的sys和system用户。

RAC环境中多个节点的密码文件应该保证一致,否则在以DBA权限登陆数据库的时候可能造成问题。

密码文件位置:

linux/unix:[oracle@rac1 ~]$ ls $ORACLE_HOME/dbs/orapw$ORACLE_SID

windows:$ORACLE_HOME/database/orapw$ORACLE_SID

密码文件认证还是OS认证:

1)参数:remote_login_passwordfile=none|exclusive|shared

none:不使用密码文件认证

exclusive:使用密码文件认证,自己独占使用(默认)

shared:使用密码文件认证,不同实例dba用户可以共享密码文件(asm下必须使用)。

2)$ORACLE_HOME/network/admin/sqlnet.ora文件下:

SQLNET.AUTHENTICATION_SERVICES =none|all|nts(linux下默认没有设置)

none:关闭OS认证,只能密码文件认证

all:linux平台关闭本机密码文件认证,采用操作系统认证,但是远程(异机)可以密码文件认证

nts:windows下使用(同linux下all)

密码文件管理:

密码文件建立:orapwd命令用法(不建议使用)

[oracle@localhost ~]$ orapwd

Usage: orapwd file=<fname> password=<password> entries=<users> force=<y/n>

where

file - name of password file (mand), -->创建密码文件名字:orapw<sid>

password - password for SYS (mand), -->sys用户密码

entries - maximum number of distinct DBA and -->可以有多少个sysdba和sysoper用户可以放到密码文件里边去(采用二进制方式,即输入1表示最少存放4个,去除重复的)

force - whether to overwrite existing file (opt), -->oracle 10g后新加的参数,用法:force=n或force=y,表示密码文件存在是否覆盖,10g之前只能删除原有的密码文件,再创建。

OPERs (opt),

There are no spaces around the equal-to (=) character.

例如:[oracle@localhost ~]$orapwd file=orapworcl password=rezin entries=1 force=y

RAC环境下对于SYSDBA权限密码更改注意事项:

对于RAC环境,在授权、撤销SYSDBA和SYSOPER权限的时候以及修改拥有SYSDBA和SYSOPER权限的用户密码的时候,应该在每个实例上分别进行,否则会造成密码的不一致。

当然,对于基于裸设备的RAC环境,也可以在RAC环境建立的过程中,通过MAPFILE指定用户的密码文件到裸设备上。这样,每个$ORACLE_HOME/dbs目录下的密码文件实际上就是连接,指向裸设备上的密码文件:

bash-3.00$ cd $ORACLE_HOME/dbs
bash-3.00$ ls -l orapwtradedb1
lrwxrwxrwx 1 oracle oinstall 35 Apr 18 15:25 orapwtradedb1 -> /dev/vx/rdsk/datadg/tradedb_pwdfile

如果采用了这种方法,那么就可以避免多次修改密码问题的。

方法二:软连接方式避免多次修改sys用户密码

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:oinstall 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 2
-rw-r-----  1 oracle oinstall  1536 Mar 30 22:33 orapwdevdb1
rac1-> mv orapwdevdb1 orapwdevdb1.bak

rac1-> ln -s /ocfs/pwdfile/orapwdevdb orapwdevdb1
rac1-> ll
total 3
lrwxrwxrwx  1 oracle oinstall    24 Mar 31 00:35 orapwdevdb1 -> /ocfs/pwdfile/orapwdevdb
-rw-r-----  1 oracle oinstall  1536 Mar 30 22:33 orapwdevdb1.bak
rac2和rac3也类似的建立link:

rac2-> ln -s /ocfs/pwdfile/orapwdevdb orapwdevdb2
rac2-> ll
total 3
lrwxrwxrwx  1 oracle oinstall    24 Mar 31 00:35 orapwdevdb2 -> /ocfs/pwdfile/orapwdevdb
-rw-r-----  1 oracle oinstall  1536 Mar 30 22:33 orapwdevdb2.bak

rac3-> ln -s /ocfs/pwdfile/orapwdevdb orapwdevdb3
rac3-> ll
total 3
lrwxrwxrwx  1 oracle oinstall    24 Mar 31 00:35 orapwdevdb3 -> /ocfs/pwdfile/orapwdevdb
-rw-r-----  1 oracle oinstall  1536 Mar 30 22:33 orapwdevdb3.bak

alter user sys更改sys用户密码时注意事项:

当remote_login_passwordfile= shared时禁止alter user sys的方式更改sysdba用户密码,matalink上解释如下:

28046, 0000, "Password change for SYS disallowed"

// *Cause: REMOTE_LOGIN_PASSWORDFILE is set to SHARED, prohibiting SYS

// password changes.

// *Action: Change setting of REMOTE_LOGIN_PASSWORDFILE to EXCLUSIVE or NONE.

翻译如下:

28046,0000,“不允许更改密码系统”

/ / *原因:remote_login_passwordfile设置为共享,禁止系统

/ /密码更改。

/ / *作用:改变remote_login_passwordfile独家或没有设置。

此时可以通过orapwd命令在操作系统层次修改sys用户密码。

到底有几个用户被授予了sysdba或者sysoper权限,可以通过查询v$pwfile_users获得,v$pwfile_users的信息就是源于口令文件的(this view lists users who have been granted SYSDBA and SYSOPER priveleges as derived from the password file.)

SQL>select * from v$pwfile_users;

username ysdba sysoper

-----------------------------------

SYS TRUE TRUE

rac环境密码文件管理

标签:不一致   add   3.0   共享   更改密码   不同   ade   ice   cte   

原文地址:http://www.cnblogs.com/wcwen1990/p/6661641.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!