创建用户配置文件强制用户在首次登录 oracle 时更改密码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26455884/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:34:08  来源:igfitidea点击:

creating user profile force user to change password on first login in oracle

oracle

提问by Mohammad Siful Islam Sumon

could any one help me how to write sql command to create a profile force user to change password on first login.

任何人都可以帮助我如何编写 sql 命令来创建配置文件强制用户在第一次登录时更改密码。

I know it is possible when we want to create user but I want to do it when I am creating profile.

我知道当我们想创建用户时是可能的,但我想在创建配置文件时这样做。

回答by codenheim

I may be wrong but I don't believe you can do this with a profile. You can set other limits like password life time, grace time, lock time, reuse time, etc. but neither the default profile nor the documentation suggest a limit for password expire time for a profile. In order to expire a user I've always used:

我可能是错的,但我不相信你可以用个人资料做到这一点。您可以设置其他限制,如密码有效期、宽限时间、锁定时间、重用时间等,但默认配置文件和文档均未建议配置文件的密码过期时间限制。为了让我一直使用的用户过期:

alter user scott password expire;

If you want to do this automatically, I suggest writing a script or stored procedure.

如果您想自动执行此操作,我建议您编写脚本或存储过程。

Worst case scenario, you could probably accomplish this using a logon trigger, but be careful doing it. The cleanest way is a script or stored proc to add users anyway.

最坏的情况是,您可能可以使用登录触发器来完成此操作,但要小心执行。最简洁的方法是使用脚本或存储过程来添加用户。

回答by Lalit Kumar B

ALTER USER username PASSWORD EXPIRE;

ALTER USER username PASSWORD EXPIRE;

From documentation :

从文档:

If you cause a database user's password to expire with PASSWORD EXPIRE, then the user (or the DBA) must change the password before attempting to log in to the database following the expiration. However, tools such as SQL*Plus allow the user to change the password on the first attempted login following the expiration.

如果您使用 PASSWORD EXPIRE 导致数据库用户的密码过期,则用户(或 DBA)必须在过期后尝试登录数据库之前更改密码。但是,SQL*Plus 等工具允许用户在到期后第一次尝试登录时更改密码。

Link to documentation about ALTER USERhttp://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_4003.htm

链接到有关http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_4003.htm 的文档ALTER USER