How To Lock and Unlock a User Account

Q

How To Lock and Unlock a User Account? - Oracle DBA FAQ - Managing Oracle User Accounts, Schema and Privileges

✍: FYIcenter.com

A

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:

>.\bin\sqlplus /nolog
SQL> connect SYSTEM/fyicenter

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/fyicenter

SQL> ALTER USER dev ACCOUNT UNLOCK;
User altered.

SQL> disconnect
SQL> CONNECT DEV/developer
Connected.

2007-05-01, 5157👍, 0💬