Unlock Database User Account in Oracle 10g XE using SQL Command Line

Following are the Steps that how we can unlock any Database User Account(eg. HR).
Before Unlocking any user account that user must be in the Database and must be Locked and to unlock that user you need DBA(Database Administrator) Privileges that's why I firstly connected as SYSDBA.

Press win+R( For Run) and type cmd then ok.then you need to write SQLPLUS/NOLOG as shown below to reach SQL Command Line.
OR
you can directly go to SQL Command Line
Start-> All programs-> Oracle 10g Express Edition -> Run SQL Command Line
Why we need to Unlock HR User:
When you try to work(eg. create table) with HR User First Time then you wouldn't be able to connect HR User because by default it remains Locked that's why we need to unlock it.

you can also see this error while connecting to HR Locked Account.
"Error,account is locked,Warning, you no longer connected to Oracle"
 C:\>SQLPLUS/NOLOG  
 SQL>CONN/AS SYSDBA  
 connected  
 SQL>CONN HR/HR  
 Error,account is locked  
 warning,you no longer connected to oracle  
 SQL>CONN/AS SYSDBA  
 connected  
 SQL>ALTER USER HR IDENTIFIED BY HR;  
 user altered  
 SQL>ALTER USER HR ACCOUNT UNLOCK;  
 user altered  
 SQL>ALTER USER HR IDENIFIED BY HR ACCOUNT UNLOCK;  
 user altered  
 SQL>CONN HR/HR  
 connected    

No comments: