Sunday, July 29, 2012

Oracle user become locked


http://oramrmessin.blogspot.com/2007/11/oracle-audit-failed-logon-attempts.html


SELECT 
os_username,
username,
userhost,
to_char(timestamp,'mm/dd/yyyy hh24:mi:ss') timestamp,
returncode
from dba_audit_session
where action_name = 'LOGON'
AND RETURNCODE > 0
AND TIMESTAMP > SYSDATE-1
and username = 'USER1'
order by timestamp ;


-- under system
ALTER USER USER1 ACCOUNT UNLOCK;




SQL to define who locked object:

SELECT c.owner, c.object_name, c.object_type, b.SID, b.serial#, b.status,
       b.osuser, b.machine, b.sql_id
  FROM v$locked_object a, v$session b, all_objects c
 WHERE b.SID = a.session_id AND a.object_id = c.object_id
;

SQL to define what SQL is performed during lock: 
 select * from sys.v_$sqlarea where sql_id = '<GET IT FROM PREVIOUS SQL>';

No comments:

Post a Comment