Locking a user account

In this recipe, you'll learn to lock and unlock user accounts.

Getting ready

To complete this recipe, you'll need an existing (for example, OS-authenticated) user who has alter user privilege (you may use user who has a DBA role) and another existing user (for example, mike).

How to do it...

  1. Connect to the database as a user who has alter user privilege:
    $ sqlplus /
    
    
  2. Lock the account of user mike:
    SQL> alter user mike account lock;
    
    
  3. Unlock the account of user mike:
    SQL> alter user mike account unlock;
    
    

How it works...

In step 1, you used OS authentication to connect to the database.

In step 2, you locked the account of user mike. This means that user mike cannot connect to the database:

 SQL> alter user mike account lock; User ...

Get Oracle Database 12c Security Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.