防止业务自身通过oracle客户端或第三方客户端工具修改密码,造成其他应用连接错误,防止数据库因密码延时验证,出现library cache lock等待事件。
适用版本:oracle 11.2.0.4及以后版本
创建用户hfxf并授予权限。
sys@cdb19c >create user hfxf identified by oracle_123;user created.
sys@cdb19c >grant connect,resource to hfxf;grant succeeded.
使用业务用户hfxf登录,尝试修改自身密码
[oracle@db19do01 ~]$ sqlplus hfxf/oracle_123@hrpdb
sql*plus: release 19.0.0.0.0 - production on mon sep 19 21:57:08 2022
version 19.3.0.0.0米乐app官网下载 copyright (c) 1982, 2019, oracle.
all rights reserved.
connected to:oracle database 19c enterprise edition release 19.0.0.0.0 - productionversion 19.3.0.0.0
hfxf@hrpdb >show user
user is "hfxf"
hfxf@hrpdb >alter user hfxf identified by oracle_456;
user altered.
hfxf@hrpdb >
hfxf@hrpdb >password
changing password for hfxf
old password:
new password:
retype new password:
password changed
hfxf@hrpdb >
业务用户hfxf可以修改自身密码
创建密码验证的函数
sys@cdb19c >create or replace function verify_function_false
(username varchar2,password varchar2,
old_password varchar2)
return boolean is
begin
if user not in ('sys','system')
then -- customize this to allow any particular user by adding those users in this list of users. return(false);
elsereturn true;
end if;
end;
/
function created.
创建profile并使用函数verify_function_false
sys@cdb19c >create profile no_change_pwd limit password_verify_function verify_function_false;
profile created.
sys@cdb19c >
修改业务用户profile
sys@cdb19c >alter user hfxf profile no_change_pwd;
user altered.
sys@cdb19c >
进行验证,业务用户hfxf已经不能修改自己密码
[oracle@db19do01 ~]$ sqlplus hfxf/oracle_789@hrpdb
sql*plus: release 19.0.0.0.0 - production on mon sep 19 22:06:54 2022
version 19.3.0.0.0米乐app官网下载 copyright (c) 1982, 2019, oracle. a
ll rights reserved.
last successful login time:
mon sep 19 2022 22:06:19 08:00
connected to:oracle database 19c enterprise edition release 19.0.0.0.0 - productionversion 19.3.0.0.0
hfxf@hrpdb >alter user hfxf identified by oracle_123;
alter user hfxf identified by oracle_123
*error at line 1:
ora-28221: replace not specified
hfxf@hrpdb >passwordchanging password for
hfxfold password:
new password:
retype new password:
error:ora-28003: password verification for the specified password failedpassword unchanged
hfxf@hrpdb >
-the end-
最后修改时间:2022-09-20 14:32:05
【米乐app官网下载的版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。