Ошибка ora 28001

I’m facing the problem about my database in Oracle, When I opened my database, it appear a message with: «ORA-28001: The password has expired»

I have updated my account with somes:

sqlplus /nolog
SQL> connect / as SYSDBA
Connected.

SQL> SELECT username, account_status FROM dba_users WHERE ACCOUNT_STATUS LIKE '%EXPIRED%';

SQL> ALTER USER system IDENTIFIED BY system;         
User altered.

SQL> ALTER USER system ACCOUNT UNLOCK;
User altered.

SQL> ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
Profile altered.

SQL> exit

I check and see that, my account: ‘system’ has OPEN, but I open it on Oracle SQL Developer, it still have alert:

ORA-28001: The password has expired

I have refered very much links but it still same the problem, how to fix this?

giannis christofakis's user avatar

asked Nov 14, 2016 at 2:34

luongkhanh's user avatar

7

ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
alter user EPUSR100 identified by EPUSR100 account unlock;
commit;

OmG's user avatar

OmG

18.2k8 gold badges54 silver badges90 bronze badges

answered Nov 14, 2017 at 1:51

Yosra's user avatar

YosraYosra

6715 silver badges2 bronze badges

I have fixed the problem, just need to check:

open_mode from v$database

and then check:

check account_status to get mode information

and then use:

alter user myuser identified by mynewpassword account unlock;

giannis christofakis's user avatar

answered Nov 14, 2016 at 7:47

luongkhanh's user avatar

luongkhanhluongkhanh

1,7052 gold badges16 silver badges29 bronze badges

2

Try to connect with the users in SQL Plus, whose password has expired. it will prompt for the new password. Enter the new password and confirm password.

It will work

SQL Plus output image

answered Jan 21, 2019 at 6:38

mahesh kumar thiruveedula's user avatar

1

Check «PASSWORD_LIFE_TIME» by

Sql > select * from dba_profiles;

Set to Never expire

Sql> ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

Then reset the password of locked user.

Dhaval Simaria's user avatar

answered Nov 14, 2016 at 4:19

user1979139's user avatar

user1979139user1979139

7545 silver badges5 bronze badges

1

C:>sqlplus /nolog
SQL> connect / as SYSDBA
SQL> select * from dba_profiles;
SQL> alter profile default limit password_life_time unlimited;
SQL> alter user database_name identified by new_password;
SQL> commit;
SQL> exit;

answered Apr 26, 2019 at 6:13

Taravat's user avatar

TaravatTaravat

1311 silver badge2 bronze badges

2

  • Connect to Oracle

sqlplus sys/root as sysdba connected to oracle

  • Check the status and expiry date for the user

SELECT username, account_status, expiry_date FROM dba_users;

status

  • Change the password for the user to resolve expiry

ALTER USER dummy_user IDENTIFIED BY dummy_password;

change password

  • Unlock the user account if it locked

ALTER USER dummy_user ACCOUNT UNLOCK;

  • Set the password expiry limit to unlimited to avoid issue in the future

ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

password unlimit

  • Again check the status of the user to verify the expiry date. The account status is now open and the expiry date is unlimited.

SELECT username, account_status, expiry_date FROM dba_users;

status1

SQL commands:

sqlplus sys/root as sysdba

SELECT username, account_status, expiry_date FROM dba_users;

ALTER USER dummy_user IDENTIFIED BY dummy_password;

ALTER USER dummy_user ACCOUNT UNLOCK;

ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

answered Mar 18, 2021 at 8:52

Harisudha's user avatar

HarisudhaHarisudha

4825 silver badges5 bronze badges

I had same problem even after changing the password, it wasn’t getting reflected in SQLDEVELOPER.

Atlast following solved my problem :

  1. Open Command Propmt
  2. Type sqlplus
  3. login as sysdba
  4. Run following command :
    alter user USERNAME identified by NEW_PASSWORD;

answered Oct 16, 2019 at 5:51

Shweta's user avatar

ShwetaShweta

2093 silver badges18 bronze badges

I had same problem, i am trying to login database it appear a message with: «ORA-28001: The password has expired» , I have fixed the problem simple steps

1.open command prompt
2.type sqlplus
3.It will ask Enter Password, you can give old password, it will show password has expired ORA-28001
4.It will ask new password and retype password
5.It will change with new password
6.Go to the sql database and try to connect with new password, it will connect.

answered Jul 20, 2020 at 16:05

keertijava's user avatar

I am running Oracle 18c in a Docker container, where the problematic database is a Pluggable database, so I had to take a different approach:

  1. Log in to SYSDBA

  2. Switch to Pluggagle Database

    ALTER SESSION SET CONTAINER=XEPDB2;
    
  3. Remove Password Expiry

    ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
    
  4. Get Current User Details

    SELECT dbms_metadata.get_ddl('USER','username') stmt from dual;
    

    Replace the username above with your own.

    The output will be something like:

    CREATE USER "…" IDENTIFIED BY VALUES '…'
    
  5. To reset the password, run as:

    ALTER USER "…" IDENTIFIED BY VALUES '…' ACCOUNT UNLOCK;
    

    … using the username and password from the previous step.

This is a combination of other answers here and elsewhere.

answered Mar 2, 2022 at 1:57

Manngo's user avatar

ManngoManngo

13.6k10 gold badges85 silver badges105 bronze badges

1

If you get an additional error ORA-65066: The specified changes must apply to all containers you have to switch first to the root cdb:

alter session set container=CDB$ROOT;

and then the alter command should work:

alter user USER identified by NEW_PASSWORD account unlock;

answered Jan 13 at 14:44

leon22's user avatar

leon22leon22

5,23019 gold badges61 silver badges98 bronze badges

To know which users are expired, run command
SELECT * FROM <DATABASE USERS/PROFILES>;

To unlock users, run command
alter user identified by account unlock;

answered Aug 19, 2021 at 11:24

Sarath's user avatar

Simple..
Goto Command prompt and type
SQLPLUS /@connect string
Hit Enter.

It says password expired and provide the option to enter new password.
Enter new password and you are done.

answered May 21, 2021 at 6:17

Nataraj Babu C's user avatar

1

Just go to the machine where your database resides, search windows -> search SqlPlus
Type the user name, then type password, it will prompt you to give new password. On providing new password, it will say successfully changed the password.

answered Jan 19, 2021 at 6:08

Akshay Kumar Sharma's user avatar

you are in wrong cdb/pdb so connect to right pdb

answered Aug 3, 2017 at 9:42

user3380585's user avatar

user3380585user3380585

1631 silver badge12 bronze badges

Перестало работать приложение, использующее СУБД Oracle XE, в логе сообщение об истечении срока действия пароля: ORA-28001: the password has expired. При чем, было неизвестно под каким пользователем коннектится приложение. Но ясно, что искать надо просроченные пароли.

Приконнектиться к базе как супер админ:

conn / as sysdba

Посмотреть пользователей с истекшими паролями:

SQL> SELECT USERNAME,ACCOUNT_STATUS FROM dba_users WHERE ACCOUNT_STATUS LIKE '%EXPIRED%';

USERNAME                       ACCOUNT_STATUS
------------------------------ --------------------------------
DIP                            EXPIRED > LOCKED
ORACLE_OCM                     EXPIRED > LOCKED
DBSNMP                         EXPIRED > LOCKED
APPQOSSYS                      EXPIRED > LOCKED
ORAUSER                        EXPIRED > LOCKED

Стало ясно, что искомый пользователь ORAUSER. Теперь надо его разлочить и сменитьпереназначить пароль:

SQL> ALTER USER orauser ACCOUNT UNLOCK;
User altered.
SQL> ALTER USER orauser IDENTIFIED BY newpass;
User altered.

Проверить статус и дополнительно посмотреть дату истечения пароля:

SQL> SELECT USERNAME,ACCOUNT_STATUS,EXPIRY_DATE FROM dba_users WHERE USERNAME LIKE '%ORAUSER%';

USERNAME                       ACCOUNT_STATUS                   EXPIRY_DA
------------------------------ -------------------------------- ---------
ORAUSER                        OPEN                             03-JAN-15

Видно, что учетка работает, но 3 января срок действия пароля снова истечет. Чтобы этого не происходило надо отключить данную возможность. Для этого надо узнать к какому профилю относится пользователь и отключить истечение времени действия пароля для этого профиля:

SQL> SELECT USERNAME,PROFILE from dba_users WHERE USERNAME LIKE '%ORAUSER%';

USERNAME                       PROFILE
------------------------------ ------------------------------
ORAUSER                        ORAPROFILE

SQL> ALTER PROFILE oraprofile LIMIT PASSWORD_LIFE_TIME UNLIMITED;
Profile altered.

Убедиться что все сработало. Поле EXPIRY_DATE должно быть пустым:

SQL> SELECT USERNAME,ACCOUNT_STATUS,EXPIRY_DATE FROM dba_users WHERE USERNAME LIKE '%ORAUSER%';

USERNAME                       ACCOUNT_STATUS                   EXPIRY_DA
------------------------------ -------------------------------- ---------
ORAUSER                        OPEN

Все.

ORA-28001 means that your password has been expired according to your profile. Normally, you should change the password, but you can still work around it. Don’t be confused with ORA-28000: The account is locked, it’s a different account problem.

SQL> conn hr/hr
ERROR:
ORA-28001: the password has expired

While ORA-28001 alerts that the password has expired, ORA-28002 warns that the password will expired soon in grace time.

A preventive action is to make PASSWORD_LIFE_TIME into UNLIMITED in the profile, there will be no more expiration in the future. However, at this moment, the password expiration notice has been triggered, we need to solve it.

Solutions to ORA-28001

There’re several ways to solve ORA-28001.

  1. Change Password
  2. The formal way to solve it is to change the password.

  3. Defer Expiration
  4. An unofficial way to solve it is to revert the expiration.

  5. Set Original Password
  6. If you want to set the original password, you can try this way.

Change Password

Of course, user can change the password immediately at connect-time.

Changing password for hr
New password:
Retype new password:
Password changed
Connected.

A privileged user can do it too.

SQL> conn / as sysdba
Connected.
SQL> alter user hr identified by hr;

User altered.

You can also use various GUI tools to change the password.

Defer Expiration

For senior DBA, you may consider to defer the password expiration.

Set Original Password

In some cases, changing password can not be done because the password is bound to specific application and even worse, no one remember the original one! So is there any way to unexpire the password? No, at least no direct syntax supports that, we have to set the original password for our user.

Here comes a question, where to find the original password? For 10g and early versions, just lookup the PASSWORD column in the dictionary view DBA_USERS, which is the encrypted value of password. But for later versions, the column is deprecated and shows nothing.

Now, let’s see what we can do to find the original password.

1. Generate the user’s DDL.

SQL> conn / as sysdba
Connected.
SQL> set long 4000;
SQL> select dbms_metadata.get_ddl('USER','HR') stmt from dual;

STMT
--------------------------------------------------------------------------------

   CREATE USER "HR" IDENTIFIED BY VALUES 'S:E129CFF697C9B08E613D3B22B13DC1124B80
F9346C79FAECF8426B7F3580;T:3716DFD59DAF47A9DA01E6EAE75FC3A86D4911C6FD494F5517FE1
4E19F89E781BF193E27338CE1D8F3BEE184B1B22DD1B5C3A6A355E7EB7118E53C30B5CE60E246916
2F618D658D761207BDF81523871'
      DEFAULT TABLESPACE "EXAMPLE"
      TEMPORARY TABLESPACE "TEMP"
      PASSWORD EXPIRE

2. Set Password by VALUES String

In the output, the string follows IDENTIFIED BY VALUES is the original encrypted password. We can use it to set the password. Just don’t forget to remove line breaks in betweens before using it.

SQL> alter USER "HR" IDENTIFIED BY VALUES 'S:E129CFF697C9B08E613D3B22B13DC1124B80F9346C79FAECF8426B7F3580;T:3716DFD59DAF47A9DA01E6EAE75FC3A86D4911C6FD494F5517FE14E19F89E781BF193E27338CE1D8F3BEE184B1B22DD1B5C3A6A355E7EB7118E53C30B5CE60E2469162F618D658D761207BDF81523871';

User altered.

Now the user’s password is unexpired, just like nothing happened.

SQL> conn hr/hr;
Connected.

Please note that, changing the profile with unlimited PASSWORD_LIFE_TIME for the user can not save ORA-28001 at this moment. But it makes your password unexpired afterwards.

Перейти к содержимому

Приложение перестало соединяться с базой данных Oracle. В логе — ошибка:

ORA-28001: the password has expired

(это означает, что срок действия пароля истек)

Смотрим, у каких пользователей срок истёк:

select username,ACCOUNT_STATUS,EXPIRY_DATE from dba_users;

Устанавливаем бесконечный срок для пароля:

ALTER PROFILE default LIMIT password_life_time UNLIMITED;

После чего всё-таки придётся законнектиться sqlplus-ом под нужным пользователем и сменить пароль. Также нужно не забыть поменять его в приложении.

What This Error Means

You’re trying to login to an Oracle database and you get ORA-28001: the password has expired. Yikes! This means that the user’s profile forces them to periodically change their password, due to a security precaution. So, if you’re getting this error, it means a password change is overdue. Oracle is trying to force you to change your password to something different so that your database remains secure.

There are times when this feature is an annoyance, because sometimes changing your password is more trouble than it’s worth. So, here’s a workaround that will let you unexpire your password without having to change it! Or, even know what the password is!!

How to Fix The Issue Now

In the below block of code, you’ll want to replace PUT_USERNAME_YOU_WANT_TO_UNEXPIRE_HERE with whomever you want to unexpire the password for.

<<unexpire_password>>
declare
  CONST_USERNAME constant varchar2(128) := 'PUT_USERNAME_YOU_WANT_TO_UNEXPIRE_HERE';
  v_unexpire_command varchar2(4000);
begin

  execute immediate ' alter user ' || CONST_USERNAME || ' account unlock';

  select 'alter user ' || name || q'< identified by values '>' || spare4 || ';' || password || q'<'>' into v_unexpire_command
  from sys.user$ 
  where name = unexpire_password.const_username;

  execute immediate v_unexpire_command;

end unexpire_password;
/

Run the block of code, and your account will be unlocked and the password unexpired.

How to Prevent “ORA-28001: the password has expired” From Happening In The Future

You say you want to prevent your password from expiring in the future? Not problem, because all you need is a profile that prevents the password from expiring.

The safest way to do this is to create a new profile that has all the same settings as the old profile, but with one change. The new profile should have the PASSWORD_LIFE_TIME set to UNLIMITED.

Below is a script that can help you create the new profile. Just replace USERNAME_GOES_HERE with whatever username you wish to have no password expiration. Optionally, you can change the name of the profile that you’re creating. In the code snippet below, I called it NO_PASSWORD_EXPIRE, but you can change the script so that it’s more meaningful to you.

declare
  CONST_USERNAME constant varchar2(128) := 'USERNAME_GOES_HERE';
  CONST_NEW_PROFILE_NAME constant varchar2(128) := 'NO_PASSWORD_EXPIRE';
  
  v_existing_profile varchar2(128);
  v_sql varchar2(32767);
begin
  select du.profile into v_existing_profile
  from dba_users du
  where du.username = CONST_USERNAME;
  
  v_sql := ' create profile ' || CONST_NEW_PROFILE_NAME || ' limit ';
  
  for v_row in (select dp.resource_name, dp.limit
                from dba_profiles dp
                where dp.profile = v_existing_profile
                  and dp.resource_name <> 'PASSWORD_LIFE_TIME')
  loop
    v_sql := v_sql || v_row.resource_name || ' ' || v_row.limit || ' ';
  end loop;

  v_sql := v_sql || 'PASSWORD_LIFE_TIME UNLIMITED';
                
  declare
    profile_already_exists exception;
    pragma exception_init(profile_already_exists, -2379);
  begin
    execute immediate v_sql;
  exception when profile_already_exists then 
    null;
  end;
  
  
  execute immediate 'alter user ' || CONST_USERNAME || ' profile ' || CONST_NEW_PROFILE_NAME;
end;
/

Free Oracle SQL Tuning Guide

Check out my FREE guide! 7 SQL Tuning Secrets You Can Use Immediately, Even If You’ve Never Tuned a Query In Your Life!

Get it here: tuningsql.com/secrets

7 SQL Tuning Secrets You can Use Immediately, Even If You've Never Tuned A Query In Your Life

Понравилась статья? Поделить с друзьями:
  • Ошибка ora 12899
  • Ошибка ora 12705
  • Ошибка ora 12560 tns protocol adapter error
  • Ошибка ora 12557
  • Ошибка ora 01036