PL/SQL to find and lock or drop user accounts
Script to hunt and lock/drop user accounts, can call from a central script connecting to multiple databases:
BEGIN
FOR d1 IN (
SELECT username
FROM dba_users
WHERE username LIKE 'AGXDL%'
AND account_status != 'LOCKED'
ORDER BY 1 )
LOOP
dbms_output.put_line ( 'alter user ' || d1.username || ' account lock ' ) ;
execute immediate 'alter user ' || d1.username ||' account lock' ;
END LOOP ;
END ;
Leave a Reply