Mobile Application Services

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Tuesday, 19 March 2013

Handle Blocking sessions for oracle database

Posted on 23:49 by Unknown
For blocking session most important is to find out which session is getting blocked and which is holding the session.
most of the time seeing one session is blocking many other session so to handle this type of situations use this method to clear the blocks.

steps:
1) select instance_name||' - '||status||' - '||startup_time||' - '||host_name||' - '||sysdate from v$instance;

to confirm the db name are you in correct database.

2) select sid from v$lock where block=1;

this query gives you the sid's which are getting effected.

3) find the sql text for this sessions.

select sql_text from v$sqltext where hash_value=( select prev_hash_value from v$session where sid='&sid');

4) check for the other detials like their sid, serail#, osuser, machine and their status ( Active / Inactive) by passing the sid from previous query of step 2.
check for all sid's from all of the results you may not get any sql text with one sid which will be active in status that is the one main culprit blocking session which is holding lock for other sessions to execute.


select sid||' - '||serial#||' - '||osuser||' - '||username||' - '||machine||' - '||status||' - '||logon_time
from v$session where sid=&123;

Identify the holder session which is active for more confirmation you can also check the holders and waiters.

check holders & waiters:
========================
set pagesize 100
select decode(request,0,'Holder: ','Waiter: ')||sid sess, id1, id2, lmode, request, type from v$lock
where (id1, id2, type) IN (SELECT id1, id2, type from v$lock where request>0) ORDER BY id1, request;

This query results with more details the top one is the holder and others are waiters.
which is notthing but the active session which you can see with the pervous query.

5) kill the holder session

ALTER SYSTEM KILL SESSION '&sid, &serial';

or run this.

SELECT 'alter system kill session ''' || s.sid || ',' || s.SERIAL# || ''';' a,
'ps -ef |grep LOCAL=NO|grep ' || p.SPID SPID,
'kill -9 ' || p.SPID
FROM gv$session s, gv$process p
WHERE ( (p.addr(+) = s.paddr) AND (p.inst_id(+) = s.inst_id))
AND s.sid = &sid;

you will get the result like
alter system kill session '123, 32422';
ps -ef |grep LOCAL=NO|grep 234223
kill -9 
234223

use any one of the result to clear the lock.

Most of the time a DBA  can not directly kill the locks, in this situation consult with the application team to clear the lock and use this easy steps to clear the lock.
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in Deadlocks | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Difference Between Oracle apps 11i & R12
    Summary of Changes : Component Release 11i Release 12 Database 9.2 10.2 Developer 6i 10i Application Server 1.0 10.1 Client Plug-in Jinitiat...
  • Obtaining Forms Runtime Diagnostics (FRD) In Oracle Applications
    A. Introduction When starting a Forms-based session in Applications it is possible to pass various useful parameters like formname=xyz, or l...
  • The simplest query for checking what’s happening in a database
    When someone asks you to take a quick look into database performance and for whatever reason you can’t run your usual scripts or performance...
  • Refresh vs Clone
    Refreshing VS Cloning an e-Business Suite Environment What is Refreshing? A refresh is where the data in the target environment has been syn...
  • How To Change Look And Feel and Colors Of Oracle Applications 11i and R12
    There are two system profile options that can be used to change look and feel.  Java Look and Feel . Java Look and Feel can have two values:...
  • Workflow Scripts
    1.Check for workflow components: ================================ set pagesize 400 set linesize 120 set pagesize 50 column COMPONENT_NAME fo...
  • CMAN [ Oracle Connection Manager ]
                                         Oracle Connection Manager helps a client process with directions to a network address. The Oracle Conn...
  • Oracle 11g RAC Interview question and answers
    1. What is the major difference between 10g and 11g RAC? Well, there is not much difference between 10g and 11gR (1) RAC. But there is a sig...
  • Concurrent Manager : troubleshooting
    Concurrent Manager : troubleshooting Summary of Possible Reasons and Solutions for the Problem Where All Concurrent Requests Stuck in Pendin...
  • How to lock/unlock statistics on a table?
                   In certain cases you may want to lock statistics in a table in certain cases, for example if you want a table not be analyzed...

Categories

  • 11.2.0.3 to 12.1.0 (Oracle 12c) upgrade
  • Backup and recovery
  • Basic RAC Commands
  • Blocking Sessions
  • CMAN [ Oracle Connection Manager ]
  • Data Guard Interview Questions
  • Deadlocks
  • Difference Between Oracle apps 11i & R12
  • File Locations -R12
  • Gather stats on table in oracle
  • How To Change Look And Feel and Colors Of Oracle Applications 11i and R12
  • How to compile invalid objects in an APPS Environment
  • How to recover Applications context file if it is corrupted or deleted accidentally?
  • How to Recreate the OraInventory?
  • Important DBA Views
  • JInitiator version too low and quot Errors in EBS Environments
  • Linux interview questions for DBA
  • Log file location in Oracle Apps 11i/R12
  • Long running concurrent requests
  • MWA Services
  • Obtaining Forms Runtime Diagnostics (FRD) In Oracle Applications
  • ORA-00845: MEMORY_TARGET not supported on this system
  • Oracle 11g RAC Interview question and answers
  • Oracle Applications Idle Session Timeout
  • Oracle Apps DBA Interview Questions
  • Oracle DBA Interview Questions
  • Oracle E-Business Suite 12.2 Architecture
  • Oracle Exadata Interview Questions
  • Personalizing The Login Page
  • RAC Cheat Sheet
  • RAC Interview Questions
  • Recovery catalog for RMAN backup
  • Refresh vs Clone
  • REP-3000 Oracle Toolkit Error
  • Replacing Jinitiator with JRE
  • RMAN Backup
  • RMAN Commands List (Oracle 11g)
  • Snapshot
  • TEMP Tablespace
  • Tracing Techniques
  • Undo Tablespace
  • Unix for DBA's
  • Workflow Mailer Troubleshooting
  • Workflow Trouble Shooting

Blog Archive

  • ▼  2013 (30)
    • ►  November (3)
    • ►  October (3)
    • ►  August (3)
    • ►  July (1)
    • ►  May (1)
    • ▼  March (10)
      • Handle Blocking sessions for oracle database
      • Workflow Mailer Troubleshooting
      • Log file location in Oracle Apps 11i/R12
      • MWA Services in Oracle Apps
      • Resolving "JInitiator version too low" Errors in E...
      • Obtaining Forms Runtime Diagnostics (FRD) In Oracl...
      • Recovery catalog for RMAN backup
      • How to Recreate the OraInventory
      • Replacing Jinitiator with JRE
      • Personalizing The Login Page
    • ►  February (8)
    • ►  January (1)
  • ►  2012 (27)
    • ►  November (1)
    • ►  October (8)
    • ►  September (5)
    • ►  August (5)
    • ►  July (7)
    • ►  June (1)
Powered by Blogger.

About Me

Unknown
View my complete profile