Showing posts with label PL/SQL. Show all posts
Showing posts with label PL/SQL. Show all posts

Thursday, November 14, 2013

How to see login history of a oracle user

select c.username,a.SAMPLE_TIME, a.SQL_OPNAME, a.SQL_EXEC_START, a.program, a.module, a.machine, b.SQL_TEXT
from DBA_HIST_ACTIVE_SESS_HISTORY a, dba_hist_sqltext b, dba_users c
where a.SQL_ID = b.SQL_ID(+)
and a.user_id=c.user_id
and c.username='&username'
order by a.SQL_EXEC_START asc;

ORA-01591: lock held by in-doubt distributed transaction

ORA-01591: lock held by in-doubt distributed transaction

 SQL> select local_tran_id from dba_2pc_pending;
LOCAL_TRAN_ID
 ------------------------------------------------------------------
7.55.64129

 SQL> rollback force '7.55.64129';
 Rollback complete.

 SQL> exec dbms_transaction.purge_lost_db_entry('7.55.64129'); 
 PL/SQL procedure successfully completed.

 SQL> select local_tran_id from dba_2pc_pending;
 no rows selected  

Enjoy :)