If SAP* and DDIC logins are locked and you are not able to login through SAP GUI then we can unlock SAP* and DDIC at database level by resetting the flags of SAP* and DDIC to 0 in the table USR02 where all the user records are saved. When the logins are locked out then the flag value will be 128. If we change it to 0 at database level then it will get unlocked.
Below is the query for resetting the flag
UPDATE prd.USR02 set UFLAG = ’00′ where MANDT = ’000′ and bname= ‘DDIC’;
Here prd is the database name; UFLAG is the field which we need to set to 0, MANDT represents in which client the login belongs to and BNAME is the field which contains logins. If you want to reset the flag for SAP* when it gets locked then replace DDIC with SAP* in above query.
1) Login to database using / as sysdba
2) select aname from sapsr3.usr02 where mandt=000;
3)delete from sapsr3.usr02 where aname=’SAP*’ and mandt=000;