Usually, we use the SCOTT/tiger account to login to the system after installing the database but that account is locked in the beginning for security reasons. So, if you try to enter using that user, you get the following error:
C:\Documents and Settings\Administrator>sqlplus
SQL*Plus: Release 10.1.0.2.0 – Production on Sun Feb 20 21:15:21 2011
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Enter user-name: SCOTT
Enter password:
ERROR:
ORA-28000: the account is locked
As you see, we get error code 28000. To unlock your accounts, you can use the following method:
C:\Documents and Settings\Administrator>sqlplus /NOLOG
SQL*Plus: Release 10.1.0.2.0 – Production on Sun Feb 20 21:17:20 2011
Copyright (c) 1982, 2004, Oracle. All rights reserved.
SQL>
SQL>
SQL> connect / as sysdba
Connected.
SQL>
SQL>
SQL>
SQL>
SQL> ALTER USER SCOTT IDENTIFIED BY tiger ACCOUNT UNLOCK;
User altered.
SQL>
So, I can change the password and unlock the user at the same time by a single SQL statement. Some more statements that can be used here are given as under:
Unlock the password
ALTER
USER
username
ACCOUNT
UNLOCK;
Lock the password
ALTER
USER
username
ACCOUNT
LOCK;
Change the password of an unlocked account
ALTER
USER
username
IDENTIFIED
BY
password
;
Change the password of a locked account
ALTER
USER
username
IDENTIFIED
BY
password
ACCOUNT
UNLOCK;
this was excellent.. thanks for this post.. really helped alot..
Thank u it works…
i am unable to open my account…there is a ERROR that account is locked.can you please provide me an alternate option to open my account
Thankyou it is really useful.