Вы находитесь на странице: 1из 13

/usr/local/git/bin/em-blackout-cmd -o list-----------Blockout At Os level. =========================================== form session details ==================== select b.user_name,a.action,a.program,a.module,a.status,a.last_call_et/3600,a.pr ocess from v$session a,apps.fnd_user b,apps.

fnd_logins c where a.process=c.process_spid and c.user_id=b.user_id and a.sid=&Session_id; 2 select USER_NAME,EMAIL_ADDRESS from apps.fnd_user where USER_NAME='XXINF'; select piece,sql_text from v$sqltext where HASH_VALUE = &hash and ADDRESS ='&add r' order by piece; No cd /ptsadmin/common/OHSMON/OHSMON-NEW scripts working then folow steps ========================================================================= show parameter cluster col HOST_NAME for a21 select INSTANCE_NUMBER,INST_ID,INSTANCE_NAME,STATUS,HOST_NAME from gv$instance; col HOST_NAME for a21 select INSTANCE_NAME,HOST_NAME,INSTANCE_NUMBER,STATUS from v$instance; From EXAData Team ================== select inst_id, sid, blocking_session, blocking_instance, username, status, wait _class, seconds_in_wait,sql_id from Gv$session where blocking_session is not NUL L order by blocking_session col HOST_NAME for a21 select * from gv$lock where (ID1,ID2,TYPE) in (select ID1,ID2,TYPE from gv$lock where request>0); SQL> nst_id, id1, id2, lmode, request, type, block FROM GV$LOCK WHERE (id1, id2, type) IN (SELECT id1, id2, type FROM GV$LOCK WHERE request>0) ORDER BY id1, request; SQL> SELECT blocking_sid, SUM(num_blocked) num_blocked FROM (SELECT id1, id2, MAX(DECODE(block, 1, sid, 0)) blocking_sid, SUM(DECODE(request, 0, 0, 1)) num_blocked FROM v$lock WHERE block = 1 OR request > 0 column sess format a13 column inst_id format 99 SELECT substr(DECODE(request,0,'Holder: ','Waiter: ')||sid,1,12) sess, i

GROUP BY id1, id2) GROUP BY blocking_sid; Only blocking sessions will display ==================================== col SESS for a12 SELECT DECODE(request,0,'Holder: ','Waiter: ')||sid sess, id1, id2, lmode, request, type ,inst_id FROM GV$LOCK WHERE (id1, id2, type) IN (SELECT id1, id2, type FROM GV$LOCK WHERE request>0) and request=0 ORDER BY id1, request ; @?/rdbms/admin/utllockt.sql SQL> col HOST_NAME for a21 select INSTANCE_NAME,HOST_NAME,INSTANCE_NUMBER from v$instance; Total Loks =========== set linesize150 select * from v$lock where block>0; select * from gv$lock where lmode=6 and block>0; To find SQL Text ============================= select s.username, s.sid, t.sql_text "Last SQL" from gv$session s, gv$sqlarea t where s.sql_address =t.address and s.sql_hash_value =t.hash_value and s.sid = '&sid'; To Find Wait Event ========================== column seq# format 99999 column EVENT format a30 column p2 format 999999 column STATE format a10 column WAIT_T format 9999 select SID,SEQ#,EVENT,P1,P2,WAIT_TIME WAIT_T,SECONDS_IN_WAIT,STATE from v$session_wait where sid = '&sid';

==============================

To find Which is Parent Blocker ------------------------------set lines 132 SELECT Instance_number,instance_name ,DECODE(request,0,'Holder: ','Waiter: ')|| sid sess, id1, id2, lmode, request, type FROM v$instance,V$LOCK WHERE (id1, id2, type) IN (SELECT id1, id2, type FROM V$LOCK WHERE request>0) ORDER BY id1, request; Java Blocking Session =================== set heading off set ver off set feedback off select 'ALTER SYSTEM KILL SESSION '||''''||a.sid ||','|| a.serial#||''''||' imme diate;' from v$session a where status != 'ACTIVE' and last_call_et > 8 * 3600 and a.module not like '%FN%OPP%' and a.module not like 'WF%' AND (module like 'JDB%' or program like 'JDB%') ================================================================= set echo off set heading off set ver off set feedback off spool kill_session.sql select 'ALTER SYSTEM KILL SESSION '||''''||a.sid ||','|| a.serial#||''''||' imme diate;' from v$session a where status != 'ACTIVE' and last_call_et > &noh * 3600 and a.module not like '%FN%OPP%' and a.module not like 'WF%' AND (module like 'JDB%' or program like 'JDB%'); ================================================================================ ===================================================== cd /ptsadmin/common/OHSMON perl block.pl sqlplus '/as sysdba' show parameter cluster select count(*) from gv$instance; set linesize 150

select * from v$lock where block>0; select * from gv$lock where block>0; col SESS for a12 set lines 132 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;

================================================================================ =====================================================

EM Query ========== SELECT blocking_sid, SUM(num_blocked) num_blocked FROM (SELECT id1, id2, MAX(DECODE(block, 1, sid, 0)) blocking_sid, SUM(DECODE(request, 0, 0, 1)) num_blocked FROM v$lock WHERE block = 1 OR request > 0 GROUP BY id1, id2) GROUP BY blocking_sid / ================================================================================ =====================================================

if many holders ================ @$ORACLE_HOME/rdbms/admin/utllockt.sql check sr - 3-5308057525 = for some reference =============================================

set linesize 250 select INSTANCE_NUMBER,INSTANCE_NAME,HOST_NAME,STATUS,DATABASE_STATUS from gv$in stance; RAC BLOCK ================

column host_name format a11 select INST_ID,INSTANCE_NAME,HOST_NAME from gv$instance; set linesize150 column sess format A20 SELECT substr(DECODE(request,0,'Holder: ','Waiter: ')||sid,1,12) sess, id1, id2, lmode, request, type, inst_id FROM GV$LOCK WHERE (id1, id2, type) IN (SELECT id1, id2, type FROM GV$LOCK WHERE request>0) ORDER BY id1, request; RAC : ----------------------------perl racblockinfo.pl Lokesh script - racblockinginfo.pl.1

set head on set linesize 250 select INSTANCE_NUMBER,INSTANCE_NAME,HOST_NAME,STATUS,DATABASE_STATUS from gv$in stance;

set lines 200 select * from gv$lock where (ID1,ID2,TYPE) in (select ID1,ID2,TYPE from gv$lock where request>0);

************************************************************* CLOPAY ====== 1. Login to auohsclop120 node 2. set linesize 250 select INSTANCE_NUMBER,INSTANCE_NAME,HOST_NAME,STATUS,DATABASE_STATUS from gv $instance; 3. set linesize 200 select s.SID,S.serial#,s.PROCESS, s.MODULE , p.spid, s.ACTION ,s.inst_id from gv$session s,gv$process p where s.paddr=p.addr and s.inst_id=p.inst_id and s.process in ('10141') and s.sid in (4095); set linesize 200

select s.SID,S.serial#,s.PROCESS, s.MODULE , p.spid, s.ACTION ,s.inst_id from gv$session s,gv$process p where s.paddr=p.addr and s.inst_id=p.inst_id and s.process in ('8308') and s.sid in (4498); or set linesi 200 select s.SID,S.serial#,s.PROCESS, s.MODULE , p.spid, s.ACTION ,s.inst_id from gv $session s,gv$process p where s.paddr=p.addr and s.inst_id=p.inst_id and s.serial# in ('3 0805') and s.sid in (4360); or) select SID, SERIAL#, STATUS,MODULE,PROCESS from v$session where sid= set linesize 200 select s.SID,S.serial#,s.PROCESS, s.MODULE , p.spid, s.ACTION ,s.inst_id from gv $session s,gv$process p where s.paddr=p.addr and s.inst_id=p.inst_id and s.serial# in ('2 2429') and s.sid in (4091);

Check for all the sessions as above. 4. We can find the instance id of the session from the above script if the sessi on exist. Else shows no rows selected. 5. Identify the correct instnace id and login to the correct node. 6. Check the session details. 7. Clear the session. 8. Sometimes session will be marked for kill, then we can try with immediate els e wait for some time it will be auto cleared.

CLOPAY - Recent update ======================

3-5207137541 --clopay hung sessions.Whenever customer review comes stating to c lear the blocking sessions

please chk with esd team.We should not work on it. (6:36:27 PM) Saravanan_Hyatt : Room : od_esd_exec (6:36:31 PM) Saravanan_Hyatt : it is internal room (6:36:38 PM) Saravanan_Hyatt : password is esd

od_esd_exec chat room.. password is esd

*****************************************************************

check the sid and pid ======================= select s.SID,S.serial#,s.PROCESS, s.MODULE , p.spid, s.ACTION ,s.inst_id from gv $session s,gv$process p where s.paddr=p.addr and s.inst_id=p.inst_id and s.process in ('p id','pid') and s.sid in (sid,sid); eg: set linesize 200 select s.SID,S.serial#,s.PROCESS, s.MODULE , p.spid, s.ACTION ,s.inst_id from gv $session s,gv$process p where s.paddr=p.addr and s.inst_id=p.inst_id and s.process in ('3 062','3113','10880') and s.sid in (4109,4464,4802);

NON-RAC -----------------set linesize150 select * from v$lock where block>0;

TO FIND THE HOLDING AND THE BLOCKING SESSION ------------------------------------------------------col SESS for a12 set lines 132 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;

col SESS for a12 set lines 132 SELECT DECODE(request,0,'Holder: ','Waiter: ')||sid sess, id1, id2, lmode, request, type FROM GV$LOCK WHERE (id1, id2, type) IN (SELECT id1, id2, type FROM GV$LOCK WHERE request>0) ORDER BY id1, request; Before killing check this ===================== BEFORE KILLING FORM PROCESS NOT ALPINA AND PHANOI REM Checking Timing Details of SID and event waiting for (re written) this is first ================ set head on column seq# format 99999 column EVENT format a30 column p2 format 9999999 column STATE format a10 column WAIT_T format 9999 select SID,SEQ#,EVENT,P1,P2,WAIT_TIME WAIT_T,SECONDS_IN_WAIT,STATE from gv$session_wait where sid ='&sid' ;

==================================================== set head on col sid for 9999 col serial# for 9999999 col program for a9 col machine for a15 col event for a15 col CURRNT_TIME a15 col LOGON_TIME for a15 col lastcallet for a15 select a.sid, a.serial#, a.status, a.program, b.event,to_char(a.logon_time, 'ddmon-yy hh24:mi') LOGON_TIME, to_char(Sysdate, 'dd-mon-yy--hh24:mi') CURRENT_TIME, (a.last_call_et/3600) "Hrs connected" from v$session a, v$session_wait b where a.sid=&sid and a.sid=b.sid;

Rem checking what is the Last SQL (re written) Rem============================== set head on undefine sid col "Last SQL" for a70 select s.username, s.sid, s.serial#,t.sql_text "Last SQL" from gv$session s, gv$sqlarea t where s.sql_address =t.address and

s.sql_hash_value =t.hash_value and s.sid = '&sid'; set head on select sid,serial# from v$session where sid= 2:57:24 PM) vijay.h.ramanna@oracle.com: col program for a15 col machine for a15 col terminal for a15 col sid for 9999 col serial# for 9999999 col action for a40 set lines 152 select s.sid, s.serial#, '*'||s.process||'*' Client, p.spid Server, s.sql_address, s.sql_hash_value, s.username, s.action, s.program || s.module, s.terminal, s.machine, s.status, --s.last_call_et s.last_call_et/3600 from gv$session s, gv$process p where p.addr=s.paddr and s.sid=nvl('&sid',s.sid) and p.spid=nvl('&spid',p.spid) and nvl(s.process,-1) = nvl('&ClientPid',nvl(s.process,-1));

REM Checking Timing Details of SID and event waiting for (re written) REM ==================================================== select a.sid, a.serial#, a.status, a.program, b.event,to_char(a.logon_time, 'ddmon-yy hh24:mi') LOGON_TIME, to_char(Sysdate, 'dd-mon-yy--hh24:mi') CURRENT_TIME, (a.last_call_et/3600) "Hrs connected" from v$session a, v$session_wait b where a.sid=&sid and a.sid=b.sid; (2:57:39 PM) vijay.h.ramanna@oracle.com: Rem checking what is the Last SQL (re w ritten) Rem============================== undefine sid col "Last SQL" for a70 select s.username, s.sid, s.serial#,t.sql_text "Last SQL" from gv$session s, gv$sqlarea t where s.sql_address =t.address and s.sql_hash_value =t.hash_value and s.sid = '&sid'; set verify off

set head on set linesize 300 col "Last SQL" for a70 select s.username, s.sid, s.serial#,t.sql_text "Last SQL" from gv$session s, gv$sqlarea t where s.sql_address =t.address and s.sql_hash_value =t.hash_value and s.sid = '&sid' and s.serial#=&serial_num;

undefine sid col "Last SQL" for a70 select s.username, s.sid, s.serial#,t.sql_text "Last SQL" from gv$session s, gv$sqlarea t where s.sql_address =t.address and s.sql_hash_value =t.hash_value and s.sid = '&sid'; SQL> SQL> 2 3 4 5 Enter value for sid: 1705 old 5: s.sid = '&sid' new 5: s.sid = '1705' no rows selected

SQL> alter system kill session '3755,36808'; System altered.

====================================== Find out last sql associated with sid ====================================== undefine sid col "Last SQL" for a70 select s.username, s.sid, s.serial#,t.sql_text "Last SQL" from gv$session s, gv$sqlarea t where s.sql_address =t.address and s.sql_hash_value =t.hash_value and s.sid = '&sid'; or select b.sql_text,a.sid,a.serial#,b.users_executing, b.rows_processed,a.last_cal l_et/3600 Hrs from v$sqlarea b,v$session a where a.sid=&BSID and a.sql_address=b .address; USERNAME SID Last SQL ------------------------------ ----- --------------------------------------------------------------------APPS 3942 SELECT ORGANIZATION_ID FROM HR_ALL_ORGANI ZATION_UNITS WHERE NAME = 'NetApp Italy'

================================== Find Out Event associatedwith sid ================================== column seq# format 99999 column EVENT format a30 column p2 format 9999 column STATE format a10 column WAIT_T format 9999 select SID,SEQ#,EVENT,P1,P2,WAIT_TIME WAIT_T,SECONDS_IN_WAIT,STATE from v$session_wait where sid = '&sid' ;

select username,t.used_ublk,t.used_urec , t.START_TIME from v$transaction t,v$se ssion s where t.addr=s.taddr and s.sid='&sessionid'; USERNAME USED_UBLK USED_UREC START_TIME ------------------------------ ---------- ---------- -------------------APPS 1 1 08/17/09 11:18:14

Waiting session details ======================== set head on column seq# format 99999 column EVENT format a30 column p2 format 9999999 column STATE format a10 column WAIT_T format 9999 select SID,SEQ#,EVENT,P1,P2,WAIT_TIME WAIT_T,SECONDS_IN_WAIT,STATE from gv$session_wait where sid = '&sid' ;

safer to clear process with following ====================================== If STATUS:Inactive Last Call Et:(more than 1 hr) SQL Hash Value:0 wait event Associated With This Session is "SQL*Net message from client,its s afe to clear the session. Action..........: FRM

================================================================================ ================

Lokesh given ============

set linesize150 column sess format A20 SELECT substr(DECODE(request,0,'Holder: ','Waiter: ')||sid,1,12) sess, id1, id2, lmode, request, type, inst_id FROM GV$LOCK WHERE (id1, id2, type) IN (SELECT id1, id2, type FROM GV$LOCK WHERE request>0) ORDER BY id1, request;

queries ==========

col PROGRAM for a20 col EVENT for a20 col USERNAME for a8 col WAIT_CLASS for a10 set lines 200 select inst_id, SID, serial#, BLOCKING_SESSION, BLOCKING_INSTANCE, rpad(WAIT_CLA SS,8) WAIT_CLASS,SECONDS_IN_WAIT,PROGRAM, MODULE , EVENT ,username from gv$session where BLOCKING_SESSION is not null order by BLOCKING_SESSION,PRO GRAM;

column sess format A20 SELECT substr(DECODE(request,0, Holder: , Waiter: )||sid,1,12) sess, id1, id2, lmode, request, type, inst_id FROM GV$LOCK WHERE (id1, id2, type) IN (SELECT id1, id2, type FROM GV$LOCK WHERE request>0) ORDER BY id1, request;

**************************************** Incase of RAC node we can use the following query to kill the session ===================================================================== SQL> alter system kill session '3071,9579' immediate;

System altered. SQL> alter system kill session '1032,6305,@1' immediate; System altered. SQL> alter system kill session '3008,11477,@1' immediate; System altered.

Вам также может понравиться