How to Determine The Lock Type and Mode from an Enqueue Wait
2017-06-15 09:04
691 查看
Applies to:
Oracle Server - Enterprise Edition -Version: 8.1.7.4 to 10.2.0.4Information in this document applies to any platform.
Goal
Determining the type of enqueue and the mode its beingheld is key to investigating enqueue wait bottlenecks. This isstraightforward in 10g or higher, but requires more analysis in earlierversions. This note will show you how to analyze 10046 / TKProf andAWR /statspack reports to determine the lock type and mode held.
@ This note doesn't add much beyond others such as note<34566.1> but is written specifically for use in the PerformanceDiagnostic Guide. Hopefully, its of some use outside of it as well.
Solution
TKProfThis technique will show you the lock type and mode held aswell as the top SQL statements that are seeing these waits.
In the "Overall Totals" section, look for wait events with high elapsed times for "enq:" (10g) or "enqueue" (pre-10g) events (Overall Totals, recursive and non-recursive)
In the "Overall Totals" section, determine which call type is associated with the highest elapsed time: parse, execute, or fetch
Generate a new TKProf report sorted by the call type found for the highest elapsed times. For example:
Execute calls:
tkpof trace_file_name output_file sort=exeela
Fetch calls:
tkpof trace_file_name output_file sort=fchela
Choose a few of the top cursors in this new TKProf report and find them in the original trace file.
Oracle 10g+: Examine the waits for the statement and see which "enq" wait it is. E.g.,
enq: TX - row lock contention
Oracle versions prior to 10g: Older versions of Oracle had less detail for some enqueue types like TX; 10g gives precise reasons for the TX enqueue. The following steps show how to decode the enqueue type and mode:
Look at the lines with "WAIT #" for the enqueue event corresponding to the cursor and find the value of the "P1" field. This field corresponds to the
enqueue type and mode.
Convert the P1 value to hexadecimal from decimal
The first four digits can be separated as 2 pairs of hex numbers. Each pair is an ASCII code for the lock type.
For example:
4. WAIT #1: nam='enqueue' ela= 3007866 p1=1414332419 p2=30152 p3=0
The P1 value is 1414332419 which in hex is544D0003, the first four digits are: 54 and 4D.
54 hex = "T" in ASCII
4D hex = "M" in ASCII
So, this is a "TM" lock type.
The last digit is the lock mode that is being requested. The modes are:
0 - none
1 - null (NULL)
2 - row-S (SS)
3 - row-X (SX)
4 - share (S)
5 - S/Row-X (SSX)
6 - exclusive (X)
Iin this case, the requested lock mode is 3 or Row-X (row exclusive lock).
Now, you can get an idea of which enqueue types and modes are causing most of the waits. .
AWR or statspack report
An AWR or statspack report will give you an idea of whichenqueue is causing problems but you will not know the mode its held or exactlywhich SQL statement is associated with the waits. Nevertheless, here aresome helpful tips:
10g or higher; the enqueue wait will include which enqueue is causing the wait and why. E.g.,
enq: TX - row lock contention
9.0.x - 9.2.x, the wait will be enqueue. You'll have to visit the
Enqueue Activities section and find the enqueue with the highest wait times.
相关文章推荐
- 转载:how to automate Microsoft Excel and return the values from a multi-cell range to an array
- usb_modeswitch How to sniff the messageContent and MessageEndpoint?
- How to project an icon to the map taken from gps at com port
- How To Get Application Path,And How To Get The Path's Directory,File Name,And Type Info(如何得到运行程序的路径,以及如何得到路径的文件夹,文件名,以及类型等等信息)
- [quote] How to determine what target is given in Makefile from the make command-line?
- How To Enumerate OLE and VB Controls from an OLE Control
- From an inner class, "this" points to the inner object. How do I get a "this" pointer to the enclosing object?
- How to easily open files and URLs from the command line
- How to solve the problem "A project with an Output Type of Class Library cannot be started directly "
- How to Determine the Blocking Session for Event: 'cursor: pin S wait on X' (文档 ID 786507.1)
- How to determine CPU and memory consumption from inside a process
- how to use a SQLite database in a standalone program with an HTML interface and VBScript as the programming language
- How To Retrieve the URL of a Web Page from an ActiveX Control
- Siebel Tools: How To Invoke Script from a Siebel Button At the Business Component and Applet Levels
- How to Copy an Assembly From the GAC to the File System
- This tip shows how to extract the width and height from a bitmap source file on disk.
- How do I lock the orientation to portrait mode in a iPhone Web Application?
- Siebel Tools: How To Invoke Script from a Siebel Button At the Business Component and Applet Levels
- In an iOS 5 Storyboard, how do you push a new scene to the original view controller from a Popover?
- How to snap an OpenGL client and send it to the clipboard