Top Banner
Presented by: Shawn Lee, University of Illinois Monday, November 4, 2013 Session #149 Blocking Lock Killer co•he•sion noun \kō-ˈhē-zhən\ 1 : the act or state of sticking together t
36

Blocking Lock Killer - CoHEsion Nashville 2013

Jun 29, 2015

Download

Career

leeknay

The database blocking lock killer utility developed within Ellucian Self-Service Banner coded with Oracle PL/SQL. Also overview database transaction scheduling, how locks in the database are generated, and how the University of Illinois actively monitors and triages database locks to provide quality customer service to Banner users.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Blocking Lock Killer - CoHEsion Nashville 2013

Presented by: Shawn Lee, University of Illinois

Monday, November 4, 2013Session #149

Blocking Lock Killer

co•he•sion noun \kō-ˈhē-zhən\ 1 : the act or state of sticking together tightly; especially: unity

Page 2: Blocking Lock Killer - CoHEsion Nashville 2013

2

TopicsDatabase transactions and locking mechanisms

Blocking locks in Banner

Monitoring & triaging blocking locks

University of Illinois’ blocking lock killer tool

CoHEsion Summit

Page 3: Blocking Lock Killer - CoHEsion Nashville 2013

CoHEsion Summit3

Audience Participation Test!

Page 4: Blocking Lock Killer - CoHEsion Nashville 2013

Overview of database transactions and locking mechanisms

Concepts

Page 5: Blocking Lock Killer - CoHEsion Nashville 2013

5

What is a transaction?A single execution within the database

A series of reads and writes of database objects

Final action – commit or abort

Committed transactions must be durable

Aborted transactions must be undone

CoHEsion Summit

Page 6: Blocking Lock Killer - CoHEsion Nashville 2013

6

ACIDTransactions have four essential properties:

1) atomicity

2) consistency

3) isolation

4) durability

CoHEsion Summit

Page 7: Blocking Lock Killer - CoHEsion Nashville 2013

7

Motivation for ConcurrencyTransactions can be executed in serial, but…that’s ineffiecient

DBMS improves performance by interleaving the actions of different transactions so they can run concurrently

Only serializable schedules are generated

CoHEsion Summit

Page 8: Blocking Lock Killer - CoHEsion Nashville 2013

8

Issues with ConcurrencyThree problems that can arise:

Dirty Reads (WR conflict) – a transaction reads a value written by another uncommitted transaction

Unrepeatable Reads (RW conflict) – a transaction reads the value of the same object twice; another transaction modifies that value in between the two reads

CoHEsion Summit

Page 9: Blocking Lock Killer - CoHEsion Nashville 2013

9

Issues with Concurrency (cont.)Lost Updates (WW conflict) – Two transactions update the value of the same object, before either of them have committed

CoHEsion Summit

Page 10: Blocking Lock Killer - CoHEsion Nashville 2013

10

Data Locking MechanismsShared Locks – acquired when reading data without making modifications; shared with other transactions that only need to read, not write

Exclusive Locks – acquired when modifying data, prevents any other transaction from accessing the data

The amount of data locked can vary

CoHEsion Summit

Page 11: Blocking Lock Killer - CoHEsion Nashville 2013

11

More on lockingTwo-Phase Locking (2PL) – common protocol used to make it easier for DBMS to schedule serializable transactions

# of locks acquired by transaction grows (phase 1) then shrinks (phase 2)

Deadlocks – when two transactions are stuck waiting on each other; Oracle detects and handles these automatically

CoHEsion Summit

Page 12: Blocking Lock Killer - CoHEsion Nashville 2013

Database Locks in BannerCauses of blocking locks and their

effects

Page 13: Blocking Lock Killer - CoHEsion Nashville 2013

13

The effect of locks in BannerDatabase locks are commonLocks can last for seconds, minutes, or hours depending on what the root blocker is doingThe “blocker” and “blockee” could be a batch job, or a user.If the blockee is a user, an extensive lock can result in a poor experience

CoHEsion Summit

Page 14: Blocking Lock Killer - CoHEsion Nashville 2013

14

Common CausesUsers blocking themselves

SOAHOLD (placing student holds)PEALEAV (employee leave balances/accruals)FZAREQN (custom form for multiyear POs)

Peak processing times (start of term activities, grade roll, payroll deduction runs)

Scheduled jobs (Appworx, a.k.a. UC4)

CoHEsion Summit

Page 15: Blocking Lock Killer - CoHEsion Nashville 2013

CoHEsion Summit15

Poll

Page 16: Blocking Lock Killer - CoHEsion Nashville 2013

Triaging Blocking LocksHow we handle them

Page 17: Blocking Lock Killer - CoHEsion Nashville 2013

17

It starts with active monitoringHP SiteScopeselect count(*) from v$session a, v$session b where 10 <= round(a.seconds_in_wait/60,1) and a.blocking_session_status = 'VALID’ and a.wait_class = 'Application’ and a.blocking_session=b.sid and b.username not like 'APPWORX%'

CoHEsion Summit

Page 18: Blocking Lock Killer - CoHEsion Nashville 2013

18

Our triage processMagic number = 10 minutesIdentify the root blockerDuring business hours, call user firstIf can’t make phone contact, kill sessionExtra care for jobsub processesSelf-service sessions killed immediatelyOutside business hours, kill immediately then communicate immediately

CoHEsion Summit

Page 19: Blocking Lock Killer - CoHEsion Nashville 2013

19

After the killThe database rolls back the transaction

User may lose work

Forms users screen may go blank and/or they will get network errors

Impact to self-service users will be less due to web session persistence

Communication and follow-up are keyCoHEsion Summit

Page 20: Blocking Lock Killer - CoHEsion Nashville 2013

The Tool The old and the new

Page 21: Blocking Lock Killer - CoHEsion Nashville 2013

21 CoHEsion Summit Session ID# 149

The Old Tool

Page 22: Blocking Lock Killer - CoHEsion Nashville 2013

22 CoHEsion Summit Session ID# 149

The Old Tool (cont.)

Page 23: Blocking Lock Killer - CoHEsion Nashville 2013

23 CoHEsion Summit Session ID# 149

The New Tool

Page 24: Blocking Lock Killer - CoHEsion Nashville 2013

24 CoHEsion Summit Session ID# 149

Session Table

Page 25: Blocking Lock Killer - CoHEsion Nashville 2013

25 CoHEsion Summit Session ID# 149

Contact Info

Page 26: Blocking Lock Killer - CoHEsion Nashville 2013

26 CoHEsion Summit Session ID# 149

Details and Kill Now options

Page 27: Blocking Lock Killer - CoHEsion Nashville 2013

27 CoHEsion Summit Session ID# 149

Session Details

Page 28: Blocking Lock Killer - CoHEsion Nashville 2013

28 CoHEsion Summit Session ID# 149

After the Kill

Page 29: Blocking Lock Killer - CoHEsion Nashville 2013

29 CoHEsion Summit Session ID# 149

Tool Permissions

WebTailor user roles

System Admin – Can Kill Sessions

System Monitor – “Kill” option not visible

Page 30: Blocking Lock Killer - CoHEsion Nashville 2013

30

Database procedures-- FILE NAME..: pkg_banner_monitoring_tools.pkg-- OBJECT NAME: UILLINOIS.pkg_banner_monitoring_tools-- USAGE......: Banner monitoring tools, including new blocking lock utility to replace the blocking lock utility from the-- Triage site that was written by Mike Cornell

procedure P_ShowSessionDetails (sid_in IN v$session.sid%TYPE, serial_in IN v$session.serial#%TYPE);

procedure P_ShowSessionsAndBlocks (dispinfo IN VARCHAR2 DEFAULT 'DEFAULT');

procedure P_KillSession (sid_in IN v$session.sid%TYPE, serial_in IN v$session.serial#%TYPE, username_in IN v$session.username%TYPE);

CoHEsion Summit

Page 31: Blocking Lock Killer - CoHEsion Nashville 2013

31

Noteworthy components

CoHEsion Summit

Database cursor – blocker and blockee information in each rowV$LOCK, V$SESSION, V$PROCESSContact info retrieved from GOBEACC, SPRIDEN, SPRTELE, SPRADDR, GOREMAL

Page 32: Blocking Lock Killer - CoHEsion Nashville 2013

32

Noteworthy components

CoHEsion Summit

Row coloring:CASE WHEN rblock.blockee_minutes_in_wait > 10 THEN rowcolor:='#FF0000'; --red WHEN rblock.blockee_minutes_in_wait > 3 THEN rowcolor:='#F4FA58'; --yellow ELSE rowcolor:='#80FF00'; --greenEND CASE;htp.tableRowOpen(cattributes=>'bgcolor="' || rowcolor || '"');

Control display of “Kill” link:if twbkwbis.f_validlink('pkg_banner_monitoring_tools.P_KillSession') then

Page 33: Blocking Lock Killer - CoHEsion Nashville 2013

33

Noteworthy components

CoHEsion Summit

Page refresh:twbkwbis.P_OpenDoc ('pkg_banner_monitoring_tools.P_ShowSessionsAndBlocks', refresh_delay => 30, refresh_url => OWA_UTIL.get_cgi_env ('REQUEST_PROTOCOL') || '://' || OWA_UTIL.get_cgi_env ('HTTP_HOST') || ':' || OWA_UTIL.get_cgi_env ('SCRIPT_NAME') || '/pkg_banner_monitoring_tools.P_ShowSessionsAndBlocks' );

Result = https://ui2web1.apps.uillinois.edu/BANPROD1/pkg_banner_monitoring_tools.P_ShowSessionsAndBlocks

Page 34: Blocking Lock Killer - CoHEsion Nashville 2013

34

Noteworthy components

CoHEsion Summit

Kill session: oracle.killsession(sid_in,serial_in,username_in,dbname,result); -- check the result CASE WHEN result LIKE '%auditname parameter not provided%' THEN P_ShowSessionsAndBlocks('NOKILL_NODB'); WHEN result LIKE '%This is a privileged ID%' THEN P_ShowSessionsAndBlocks('NOKILL_PRIVID'); WHEN result LIKE '%did not match with username%' THEN P_ShowSessionsAndBlocks('NOKILL_USRMTCH'); WHEN result LIKE '%alter system kill session%' THEN P_ShowSessionsAndBlocks('KILLED'); END CASE;

Page 35: Blocking Lock Killer - CoHEsion Nashville 2013

CoHEsion Summit35

Poll

Page 36: Blocking Lock Killer - CoHEsion Nashville 2013

36

Thank You!

Shawn Lee, University of [email protected]

Please complete the session evaluation form

Session ID #149

CoHEsion Summit