今天一位同事接到一项任务是修改数据库系统和系统用户的密码,老大在布置任务的时候还带了一句别忘了同步密码文件,于是想到了自己前几天写的一篇博客介绍甲骨文密码文件的,当时只是写了如何创建密码文件,如何远程使用SYSDBA登录数据库做操作,但是并没有提到密码文件中用户的密码跟数据库中用户的密码是否有关系。
下面来测试一下,我用的平台是11.2.0.4
首先修改系统的密码
sys@ORCL> alter user sys identified by 坚决地; User 改变。 ——由于11 g里dba_user视图里的密码是空值,所以选择用户视美元图 sys@ORCL> select  password 得到用户,美元where name=癝YS”; 密码 ------------------------------------------------------------------------------------------ C53B64BC84353309 ——建议remote_login_passwordfile需要为排斥 sys@ORCL> show  parameter remote_login_passwordfile 的名字,,,,,类型,,,,,,,的值 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -,- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -女人,- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - remote_login_passwordfile,,,,,字符串,,,,,,,独家
创建一个密码文件然后测试远程登录
#创建一个与系统用户密码相同的密码文件 (oracle@rhel6 dbs)美元,cd $ ORACLE_HOME/dbs (oracle@rhel6 dbs)美元,orapwd 文件=orapworcl 条目=3,密码=坚决 (oracle@rhel6 dbs)美元,ls -l orapworcl -rw-r——安康;1,oracle oinstall 1536年,Dec 26, 21:32 orapworcl #测试连接成功 美元(c: \ ~), sqlplus sys/zhaoxu@192.168.56.2/orcl as sysdba SQL * +: Release 12.1.0.1.0  Production 提醒星期一,12月,26日21:34:22 2016 Copyright (c), 1982年,2013年,甲骨文只All rights 保留。 连接到: Oracle Database 11 g Enterprise  Edition Release 11.2.0.4.0 作用;64 bit 生产 With 从而,分区,OLAP,, Data Mining 以及Real Application Testing 选项 完成,select password 得到用户,美元where name=癝YS”; 密码 ------------------------------------------------------------ C53B64BC84353309 #密码的哈希值没有变化 #创建一个与系统密码不同的密码文件 (oracle@rhel6 dbs)美元,orapwd 文件=orapworcl 条目=3,密码=luoxi 力=y (oracle@rhel6 dbs)美元,ls -l orapworcl -rw-r——安康;1,oracle oinstall 1536年,Dec 26, 21:36 orapworcl #测试连接,使用原密码文件的密码登录不成功,使用新密码文件的密码登录成功,但是系统用户的密码哈希值仍没有变 美元(c: \ ~), sqlplus sys/zhaoxu@192.168.56.2/orcl as sysdba SQL * +: Release 12.1.0.1.0  Production 提醒星期一,12月,26日21:36:20 2016 Copyright (c), 1982年,2013年,甲骨文只All rights 保留。 错误: ora - 01017: invalid 用户名/密码;logon 否认 美元(c: \ ~), sqlplus sys/luoxi@192.168.56.2/orcl as sysdba SQL * +: Release 12.1.0.1.0  Production 提醒星期一,12月,26日21:36:30 2016 Copyright (c), 1982年,2013年,甲骨文只All rights 保留。 连接到: Oracle Database 11 g Enterprise  Edition Release 11.2.0.4.0 作用;64 bit 生产 With 从而,分区,OLAP,, Data Mining 以及Real Application Testing 选项 完成,select password 得到用户,美元where name=癝YS”; 密码 ------------------------------------------------------------ C53B64BC84353309
测试直接修改系统用户密码,查看密码文件会有什么变化
#修改SYS密码成功,密码散列值与之前不同 sys@ORCL> alter  user sys identified  by 甲骨文; User 改变。 sys@ORCL> select  password 得到用户,美元where name=癝YS”; 密码 ------------------------------------------------------------------------------------------ 8 a8f025737a9097a #查看密码文件,在修改SYS密码时密码文件也有更新 (oracle@rhel6 dbs)美元,ls -l orapworcl -rw-r——安康;1,oracle oinstall 1536年,Dec 26, 21:39 orapworcl #测试远程登录,使用luoxi密码已不能登录数据库,但修改的SYS密码可以登录数据库 美元(c: \ ~), sqlplus sys/luoxi@192.168.56.2/orcl as sysdba SQL * +: Release 12.1.0.1.0  Production 提醒星期一,12月,26日21:41:50 2016 Copyright (c), 1982年,2013年,甲骨文只All rights 保留。 错误: ora - 01017: invalid 用户名/密码;logon 否认 美元(c: \ ~), sqlplus sys/oracle@192.168.56.2/orcl as sysdba SQL * +: Release 12.1.0.1.0  Production 提醒星期一,12月,26日21:41:58 2016 Copyright (c), 1982年,2013年,甲骨文只All rights 保留。 连接到: Oracle Database 11 g Enterprise  Edition Release 11.2.0.4.0 作用;64 bit 生产 null null null甲骨文密码文件与用户密码的关系