Professional Documents
Culture Documents
PLSQL Script To Find and Kill Blocking Sessions Objects
PLSQL Script To Find and Kill Blocking Sessions Objects
CONTACT
By Shailender Thallam | July 9, 2013 | 738 views | Category: AOL and SYSADMIN AOL SQL Scripts
0 Comments
Categories
Advanced Collections (2)
Alerts (2)
AOL and SYSADMIN (36)
AOL SQL Scripts (23)
APIs (7)
Costing (1)
Extensions (1)
HRMS (5)
Interview Questions (10)
Inventory (7)
iRecruitment (1)
iStore (1)
OAF (8)
/*********************************************************
*PURPOSE: To findout blocking sessions and kill them
*
*AUTHOR: Shailender Thallam
*
**********************************************************/
-DECLARE
CURSOR c
IS
SELECT c.owner,
c.object_name,
c.object_type,
b.SID
,
b.serial#
,
b.status
,
b.osuser
,
b.machine
FROM v$locked_object a,
v$session b
,
dba_objects c
WHERE b.SID
= a.session_id
AND a.object_id = c.object_id
--AND b.osuser
= 'shailender.thallam'
--and c.object_name in ('JSW_CRM_C_HR_COIL_INFO','T_SPCL_BARCODE_CRS2')
;
-CURSOR d
IS
SELECT
SID,
PDFmyURL - online
url to
pdf conversion
OPM (4)
Oracle Apps Basics (20)
Oracle Learning Management (4)
Oracle SQL (18)
Order Management (15)
Payables (3)
Payments (6)
Personalizations (4)
PL/SQL (19)
Prole Options (6)
Purchasing (5)
Receivables (8)
Reports (2)
Scripts (8)
SELECT SID,
serial#
FROM v$session s
WHERE s.blocking_session IS NOT NULL
--AND osuser
= 'shailender.thallam';
-c_row c%ROWTYPE;
d_row d%ROWTYPE;
-l_sql VARCHAR2(100);
BEGIN
OPEN c;
LOOP
FETCH c INTO c_row;
EXIT
WHEN c%NOTFOUND;
dbms_output.put_line('in c '||c_row.SID);
l_sql := 'alter system kill session '''||c_row.SID||','||c_row.serial#||''''
EXECUTE IMMEDIATE l_sql;
COMMIT;
END LOOP;
CLOSE c;
---OPEN d;
LOOP
FETCH d INTO d_row;
EXIT
WHEN d%NOTFOUND;
dbms_output.put_line('in d '||d_row.SID);
l_sql := 'alter system kill session '''||d_row.SID||','||d_row.serial#||''''
EXECUTE IMMEDIATE l_sql;
COMMIT;
END LOOP;
CLOSE d;
END;
/
--
Security (1)
Shipping Execution (2)
Trade Mangement (1)
Uncategorized (2)
Unix / Shell Scripts (2)
WIP Jobs (1)
Workows (21)
XMLP (12)
AdChoices
AdChoices
AdChoices
C Script
User Script
Bi Oracle
Program Script
Script Open
WOW! Did you like this post? We'll send more interesting posts like PL/SQL script to find and
Kill Blocking Sessions/Objects to you!
Enter your Email Address:
Enter your email address
Subscribe Me!
Excel Output
0 Comments
Recommend
OracleAppsDNA
Sort by Oldest
Share
Subscribe
Login
Privacy
Basics of Business
Events and step by...
Developing XML
Publisher Reports...