Oracle 사용자 계정 상태를 EXPIRE(GRACE)에서 OPEN으로 변경
메시지를 받은 후Your password will be expired with in 7 days의 암호 만료일을 변경했습니다.default의 옆모습.UNLIMITED그러나 일부 사용자의 계정 상태는 여전히 다음에 남아 있습니다.EXPIRE(GRACE).
오라클 사용자 계정 상태를 변경하는 모든 방법EXPIRE(GRACE)로.OPEN비밀번호를 재설정하지 않고?
아니요, 암호를 재설정하지 않고는 계정 상태를 EXPIRE(GRACE)에서 OPEN으로 직접 변경할 수 없습니다.
설명서에는 다음과 같이 나와 있습니다.
PASSWORD EXPIRE로 데이터베이스 사용자의 암호가 만료되도록 하는 경우, 사용자(또는 DBA)는 만료 후 데이터베이스에 로그인하기 전에 암호를 변경해야 합니다.
그러나 사용자의 암호 해시를 기존 값으로 재설정하여 상태를 간접적으로 OPEN으로 변경할 수 있습니다.그러나 암호 해시를 자체로 설정하면 다음과 같은 문제가 발생하며, 거의 모든 다른 솔루션은 이러한 문제 중 하나를 누락합니다.
- Oracle 버전마다 사용하는 해시 유형이 다릅니다.
- 사용자의 프로필로 인해 암호를 다시 사용할 수 없습니다.
- 프로파일 한계는 변경할 수 있지만 마지막에 값을 다시 변경해야 합니다.
- 프로파일 값은 사소한 것이 아닙니다. 왜냐하면 값이 다음과 같으면
DEFAULT그것은 에 대한 포인터입니다.DEFAULT프로필 값입니다.프로파일을 재귀적으로 확인해야 할 수도 있습니다.
다음의 터무니없이 큰 PL/SQL 블록은 이러한 모든 경우를 처리해야 합니다.Oracle 버전 또는 프로필 설정에 관계없이 동일한 암호 해시를 사용하여 계정을 OPEN으로 재설정해야 합니다.그리고 프로파일은 원래의 한계로 다시 변경될 것입니다.
--Purpose: Change a user from EXPIRED to OPEN by setting a user's password to the same value.
--This PL/SQL block requires elevated privileges and should be run as SYS.
--This task is difficult because we need to temporarily change profiles to avoid
-- errors like "ORA-28007: the password cannot be reused".
--
--How to use: Run as SYS in SQL*Plus and enter the username when prompted.
-- If using another IDE, manually replace the variable two lines below.
declare
v_username varchar2(128) := trim(upper('&USERNAME'));
--Do not change anything below this line.
v_profile varchar2(128);
v_old_password_reuse_time varchar2(128);
v_uses_default_for_time varchar2(3);
v_old_password_reuse_max varchar2(128);
v_uses_default_for_max varchar2(3);
v_alter_user_sql varchar2(4000);
begin
--Get user's profile information.
--(This is tricky because there could be an indirection to the DEFAULT profile.
select
profile,
case when user_password_reuse_time = 'DEFAULT' then default_password_reuse_time else user_password_reuse_time end password_reuse_time,
case when user_password_reuse_time = 'DEFAULT' then 'Yes' else 'No' end uses_default_for_time,
case when user_password_reuse_max = 'DEFAULT' then default_password_reuse_max else user_password_reuse_max end password_reuse_max,
case when user_password_reuse_max = 'DEFAULT' then 'Yes' else 'No' end uses_default_for_max
into v_profile, v_old_password_reuse_time, v_uses_default_for_time, v_old_password_reuse_max, v_uses_default_for_max
from
(
--User's profile information.
select
dba_profiles.profile,
max(case when resource_name = 'PASSWORD_REUSE_TIME' then limit else null end) user_password_reuse_time,
max(case when resource_name = 'PASSWORD_REUSE_MAX' then limit else null end) user_password_reuse_max
from dba_profiles
join dba_users
on dba_profiles.profile = dba_users.profile
where username = v_username
group by dba_profiles.profile
) users_profile
cross join
(
--Default profile information.
select
max(case when resource_name = 'PASSWORD_REUSE_TIME' then limit else null end) default_password_reuse_time,
max(case when resource_name = 'PASSWORD_REUSE_MAX' then limit else null end) default_password_reuse_max
from dba_profiles
where profile = 'DEFAULT'
) default_profile;
--Get user's password information.
select
'alter user '||name||' identified by values '''||
spare4 || case when password is not null then ';' else null end || password ||
''''
into v_alter_user_sql
from sys.user$
where name = v_username;
--Change profile limits, if necessary.
if v_old_password_reuse_time <> 'UNLIMITED' then
execute immediate 'alter profile '||v_profile||' limit password_reuse_time unlimited';
end if;
if v_old_password_reuse_max <> 'UNLIMITED' then
execute immediate 'alter profile '||v_profile||' limit password_reuse_max unlimited';
end if;
--Change the user's password.
execute immediate v_alter_user_sql;
--Change the profile limits back, if necessary.
if v_old_password_reuse_time <> 'UNLIMITED' then
if v_uses_default_for_time = 'Yes' then
execute immediate 'alter profile '||v_profile||' limit password_reuse_time default';
else
execute immediate 'alter profile '||v_profile||' limit password_reuse_time '||v_old_password_reuse_time;
end if;
end if;
if v_old_password_reuse_max <> 'UNLIMITED' then
if v_uses_default_for_max = 'Yes' then
execute immediate 'alter profile '||v_profile||' limit password_reuse_max default';
else
execute immediate 'alter profile '||v_profile||' limit password_reuse_max '||v_old_password_reuse_max;
end if;
end if;
end;
/
Jonearles의 답변, http://kishantha.blogspot.com/2010/03/oracle-enterprise-manager-console.html 및 http://blog.flimatech.com/2011/07/17/changing-oracle-password-in-11g-using-alter-user-identified-by-values/ (Oracle 11g)에서 편집:
나중에 이런 일이 발생하지 않도록 하려면 다음을 수행합니다.
- sqlplus에 sysdba로 로그인 -> sqlplus "/as sysdba"
- 실행 ->
ALTER PROFILE DEFAULT LIMIT FAILED_LOGIN_ATTEMPTS UNLIMITED PASSWORD_LIFE_TIME UNLIMITED;
사용자 상태를 재설정하려면 쿼리를 실행합니다.
select
'alter user ' || su.name || ' identified by values'
|| ' ''' || spare4 || ';' || su.password || ''';'
from sys.user$ su
join dba_users du on ACCOUNT_STATUS like 'EXPIRED%' and su.name = du.username;
결과 집합의 일부 또는 전부를 실행합니다.
set long 9999999
set lin 400
select DBMS_METADATA.GET_DDL('USER','YOUR_USER_NAME') from dual;
이렇게 하면 다음과 같은 결과가 출력됩니다.
SQL> select DBMS_METADATA.GET_DDL('USER','WILIAM') from dual;
DBMS_METADATA.GET_DDL('USER','WILIAM')
--------------------------------------------------------------------------------
CREATE USER "WILIAM" IDENTIFIED BY VALUES 'S:6680C1468F5F3B36B726CE7620F
FD9657F0E0E49AE56AAACE847BA368CEB;120F24A4C2554B4F'
DEFAULT TABLESPACE "USER"
TEMPORARY TABLESPACE "TEMP"
PASSWORD EXPIRE
대신 다른 사용자와 함께 첫 번째 부분을 사용합니다.
ALTER USER "WILIAM" IDENTIFIED BY VALUES 'S:6680C1468F5F3B36B726CE7620F
FD9657F0E0E49AE56AAACE847BA368CEB;120F24A4C2554B4F';
이렇게 하면 계정이 다시 에 저장됩니다.OPEN(" " " "의 만 하면 됩니다." (" 암 출 잘 게 붙 태 경 상 어 는 넣 내 여 라 우 르 바 올 서 에 호 을 시 값 해 를 변 않 력 경 은 하 지 ▁correctly as ▁status ▁without 출 ▁value ▁the ▁changing ▁from ▁as ▁long ▁and )DBMS_METADATA.GET_DDL암호가 무엇인지 알 필요도 없습니다.
해당 사용자의 암호를 알고 있거나 추측하려는 경우 다음을 수행합니다.
connect user/password
이 명령이 성공적으로 연결되면 "연결됨" 메시지가 표시되고, 그렇지 않으면 오류 메시지가 표시됩니다.로그에 성공하면 암호를 알고 있음을 의미합니다.그런 경우에는 다음을 수행합니다.
alter user NAME_OF_THE_USER identified by OLD_PASSWORD;
그러면 암호가 이전과 동일한 암호로 재설정되고 해당 사용자의 account_status도 재설정됩니다.
단계-1 아래 쿼리를 사용하여 사용자 세부 정보를 찾아야 합니다.
SQL> select username, account_status from dba_users where username='BOB';
USERNAME ACCOUNT_STATUS
------------------------------ --------------------------------
BOB EXPIRED
단계-2 아래 쿼리를 사용하여 사용자 암호를 가져옵니다.
SQL>SELECT 'ALTER USER '|| name ||' IDENTIFIED BY VALUES '''|| spare4 ||';'|| password ||''';' FROM sys.user$ WHERE name='BOB';
ALTER USER BOB IDENTIFIED BY VALUES 'S:9BDD17811E21EFEDFB1403AAB1DD86AB481E;T:602E36430C0D8DF7E1E453;2F9933095143F432';
단계 - 3 위로 실행 쿼리 변경
SQL> ALTER USER BOB IDENTIFIED BY VALUES 'S:9BDD17811E21EFEDFB1403AAB1DD86AB481E;T:602E36430C0D8DF7E1E453;2F9933095143F432';
User altered.
4단계 : 사용자 계정 상태 확인
SQL> select username, account_status from dba_users where username='BOB';
USERNAME ACCOUNT_STATUS
------------------------------ --------------------------------
BOB OPEN
제1부(사용자가 있는지 확인)
--예를 들어 시스템 유형 계정으로 확인할 수 있습니다.SYS
> SQL >
select username, account_status from dba_users where username='BOB';> SQL >
select username, account_status from dba_users where username like 'BOB%';> SQL >
select username, account_status from dba_users where like '%BOB%';
Part II 계정 속성 변경
> SQL >ALTER user [username] account UNLOCK;.-----------------------------------------------------------------------------
> SQL >Alter user [username] IDENTIFIED BY "password";합니다.-----------------------------------------------------------------------
SQL > ALTER 사용자 [사용자 이름] 계정 잠금 해제; --잠금된 계정 잠금 해제
SQL > "password"로 식별된 사용자 [username] 변경; -- 사용자의 암호를 변경합니다.
이것은 나에게 효과가 있습니다.
언급URL : https://stackoverflow.com/questions/5521766/change-oracle-user-account-status-from-expiregrace-to-open
'code' 카테고리의 다른 글
| $.textstatus는 성공을 표시하지만 데이터베이스는 업데이트되지 않습니까?제이쿼리 php 아약스 (0) | 2023.06.17 |
|---|---|
| adplyrtbl 열을 벡터로 추출합니다. (0) | 2023.06.17 |
| 목표-C 분할()? (0) | 2023.06.17 |
| x86의 MOV가 정말 "무료"가 될 수 있습니까?왜 나는 이것을 전혀 재현할 수 없습니까? (0) | 2023.06.17 |
| 여러 클래스 제거(jQuery) (0) | 2023.06.17 |