Tuesday 15 July 2014

Oracle Keep Trying Error

If your Oracle Database face following problems:
  • Giving Keep Trying Error
  • Goes in a hanging stage with SQL Queries
  • Deadlock occurs
  • Locking Issues
  • Oracle Database SQL queries consuming significant database time
Then you must need to see your oracle database sessions. To view Oracle database sessions use the query below: and kill sessions which are running from long time.
select vs.audsid audsid,
locks.sid sid,
vs.serial# serial#,
vs.username oracle_user,
vs.osuser os_user,
vs.program program,
vs.module module,
vs.action action,
vs.process process,
decode(locks.lmode,
1, NULL,
2, ‘Row Share’,
3, ‘Row Exclusive’,
4, ‘Share’,
5, ‘Share Row Exclusive’,
6, ‘Exclusive’, ‘None’) lock_mode_held,
decode(locks.request,
1, NULL,
2, ‘Row Share’,
3, ‘Row Exclusive’,
4, ‘Share’,
5, ‘Share Row Exclusive’,
6, ‘Exclusive’, ‘None’) lock_mode_requested,
decode(locks.type,
‘MR’, ‘Media Recovery’,
‘RT’, ‘Redo Thread’,
‘UN’, ‘User Name’,
‘TX’, ‘Transaction’,
‘TM’, ‘DML’,
‘UL’, ‘PL/SQL User Lock’,
‘DX’, ‘Distributed Xaction’,
‘CF’, ‘Control File’,
‘IS’, ‘Instance State’,
‘FS’, ‘File Set’,
‘IR’, ‘Instance Recovery’,
‘ST’, ‘Disk Space Transaction’,
‘TS’, ‘Temp Segment’,
‘IV’, ‘Library Cache Invalidation’,
‘LS’, ‘Log Start or Log Switch’,
‘RW’, ‘Row Wait’,
‘SQ’, ‘Sequence Number’,
‘TE’, ‘Extend Table’,
‘TT’, ‘Temp Table’,
locks.type) lock_type,
objs.owner object_owner,
objs.object_name object_name,
objs.object_type object_type,
round( locks.ctime/60, 2 ) lock_time_in_minutes
from v$session vs,
v$lock locks,
dba_objects objs,
dba_tables tbls
where locks.id1 = objs.object_id
and vs.sid = locks.sid
and objs.owner = tbls.owner
and objs.object_name = tbls.table_name
and objs.owner != ‘SYS’
and locks.type = ‘TM’
order by lock_time_in_minutes;
alter system kill session ’504,14500′;
sid,serial#

No comments:

Post a Comment