首页 > 数据库 > 数据库开发技术 > Oracle数据库密码逐步切换策略
conn sys/SysPassword1@//localhost:1521/pdb1 as sysdba
--drop user testuser1 cascade;
create user testuser1 identified by testuser1 quota unlimited on users;
grant connect, resource to testuser1;
-- drop profile pw_rollover_time_prof;
create profile pw_rollover_time_prof limit
password_rollover_time 1;
alter user testuser1 profile pw_rollover_time_prof;
alter profile pw_rollover_time_prof limit
password_rollover_time 1.5;
conn testuser1/testuser1@//localhost:1521/pdb1
alter user testuser1 identified by newpasswd1;
conn testuser1/testuser1@//localhost:1521/pdb1
Connected.
SQL>
conn testuser1/newpasswd1@//localhost:1521/pdb1
Connected.
SQL>
conn sys/SysPassword1@//localhost:1521/pdb1 as sysdba
select account_status,
to_char(password_change_date, 'dd-mon-yyyy hh24:mi:ss') as password_change_date
from dba_users
where username = 'TESTUSER1';
ACCOUNT_STATUS PASSWORD_CHANGE_DATE
-------------------------------- -----------------------------
OPEN & IN ROLLOVER 21-nov-2021 19:22:43
SQL>
column resource_name format a25
column limit format a10
select resource_name,
limit
from dba_profiles
where profile = 'PW_ROLLOVER_TIME_PROF'
and resource_name = 'PASSWORD_ROLLOVER_TIME';
RESOURCE_NAME LIMIT
------------------------- ----------
PASSWORD_ROLLOVER_TIME 1.5
SQL>
conn sys/SysPassword1@//localhost:1521/pdb1 as sysdba
alter profile pw_rollover_time_prof limit
password_rollover_time 0;
conn testuser1/testuser1@//localhost:1521/pdb1
USER = testuser1
URL = jdbc:oracle:oci8:@//localhost:1521/pdb1
Error Message = no ocijdbc21 in java.library.path
USER = testuser1
URL = jdbc:oracle:thin:@//localhost:1521/pdb1
Error Message = ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE.
SQL>
conn sys/SysPassword1@//localhost:1521/pdb1 as sysdba
alter profile pw_rollover_time_prof limit
password_rollover_time 1.5;
conn testuser1/newpasswd1@//localhost:1521/pdb1
alter user testuser1 identified by newpasswd2;
conn testuser1/newpasswd1@//localhost:1521/pdb1
Connected.
SQL>
conn testuser1/newpasswd2@//localhost:1521/pdb1
Connected.
SQL>
conn sys/SysPassword1@//localhost:1521/pdb1 as sysdba
alter profile pw_rollover_time_prof limit
password_rollover_time 0;
alter profile pw_rollover_time_prof limit
password_rollover_time 1.5;
conn testuser1/newpasswd1@//localhost:1521/pdb1
Connected.
SQL>
conn testuser1/newpasswd2@//localhost:1521/pdb1
Connected.
SQL>
原文作者:SQL编程思想;如有侵权,请联系管理员删除。