Lock & Unlock SAP User(s) via Oracle SQL

Instead of using lock & unlock steps in SAP GUI level, you can also lock the SAP user(s) via Oracle SQL. The locking and unlocking process are depending on the UFLAG status. Please refer to UFLAG value article for details.

Lock User using Oracle SQL

1. Query the BNAME(username), UFLAG, MANDT(client) of the user.

SQL> select BNAME, MANDT, UFLAG from SAPSR3.USR02 where bname='ARA';

BNAME             MANDT     UFLAG
----------------- --------- ----------
ARA               000       0
ARA               500       0

2. Set the UFLAG to 64 to lock the user.

SQL> update SAPSR3.USR02 set UFLAG=64 where BNAME='ARA';
SQL> commit;

Unlock User using Oracle SQL

1. Query the BNAME(username), UFLAG, MANDT(client) of the user.

SQL> select BNAME, MANDT, UFLAG from SAPSR3.USR02 where bname='ARA';

BNAME             MANDT     UFLAG
----------------- --------- ----------
ARA               000       64
ARA               500       64

2. Set the UFLAG to 0 to unlock the user.

SQL> update SAPSR3.USR02 set UFLAG=0 where BNAME='ARA';
SQL> commit;

Mass Lock & Unlock Users using Oracle SQL

In SAP level, you can use transaction code SU10 to mass lock and unlock users. In Oracle database level, you can use below command to mass lock and unlock SAP users. Below command will be useful if you are doing system upgrade, refresh or copy.

1. Mass Lock. This command will lock all dialog (USTYP=’A’) users except for users (DDIC, SAP*, ARA and ITSITI). You can add or remove any users not to be locked as well.

update SAPSR3.USR02 set UFLAG='96' where BNAME not in
('DDIC','SAP*','ARA','ITSITI') AND UFLAG='0' AND USTYP='A';

2. Mass Unlock.

update SAPSR3.USR02 set UFLAG='0' where UFLAG='96';

You May Also Like

Leave a Reply?