Basic Oracle Concepts and Programming Question:
Download Job Interview Questions and Answers PDF
How To Lock and Unlock a User Account in Oracle?
Answer:
If you want to lock a user account for a short period of time, and unlock it later, you can use the ALTER USER ... ACCOUNT command. The following sample script shows how to use this command:
>.insqlplus /nolog
SQL> connect SYSTEM/globalguideline
SQL> ALTER USER dev ACCOUNT LOCK;
User altered.
SQL> disconnect
SQL> CONNECT DEV/developer
ORA-28000: the account is locked
SQL> disconnect
SQL> connect SYSTEM/globalguideline
SQL> ALTER USER dev ACCOUNT UNLOCK;
User altered.
SQL> disconnect
SQL> CONNECT DEV/developer
Connected.
>.insqlplus /nolog
SQL> connect SYSTEM/globalguideline
SQL> ALTER USER dev ACCOUNT LOCK;
User altered.
SQL> disconnect
SQL> CONNECT DEV/developer
ORA-28000: the account is locked
SQL> disconnect
SQL> connect SYSTEM/globalguideline
SQL> ALTER USER dev ACCOUNT UNLOCK;
User altered.
SQL> disconnect
SQL> CONNECT DEV/developer
Connected.
Download Oracle Database Interview Questions And Answers
PDF
Previous Question | Next Question |
How To Revoke CREATE SESSION Privilege from a User in Oracle? | What Privilege Is Needed for a User to Create Tables in Oracle? |