Session Wait Events
Session Wait Events
Session Wait Events
1.0 Introduction
Since Oracle7 version 7.0.12, there is a new wait interface that keeps track of the waits of all
sessions/processes in an instance. The names of these views are v$system_event, v$session_event and
v$session_wait.
The v$session_wait view shows the events that sessions have just completed waiting for or are currently
waiting on. The v$system_event shows the total number of times all the sessions have waited on the
events in that view. The v$session_event is similar to v$system_event, but is shows all the waits for
events broken down by session.
For each event we document the name, wait time, parameters (p1, p2 and p3) and optionally advise on
how to tune this event.
The following SQL statement will display all the events in an Oracle7 release:
select *
from v$event_name;
Here follow the fixed view definitions for the views mentioned before in for Oracle7:
v$session_event
sid
number
Session id (v$session).
event
varchar2(64)
The name of the event that the session has been waiting for.
total_waits
number
total_timeouts
number
time_waited
number
average_wait
number
sid
number
Session id (v$session).
seq#
number
event
varchar2(64)
The name of the event that the session is waiting for or just
completed waiting for (depends on state).
p1text
varchar2(64)
p1
number
p1raw (7.2)
raw(4)
p2text
varchar2(64)
v$session_wait
03/21/96
Page 1
Page 2
p2
number
p2raw (7.2)
raw(4)
p3text
varchar2(64)
p3
number
p3raw (7.2)
raw(4)
wait_time
number
varchar2(19)
-2
-1
>0
v$system_event
event
varchar2(64)
total_waits
number
total_timeouts
number
time_waited
number
average_wait
number
These fixed views are based on fixed tables and normally do sorting (sort-merge joins). On systems with
1
a lot of contention on the ST enqueue , querying these tables may take a long time. Querying the
underlying fixed tables may improve performance. Here follows a list of the underlying fixed tables:
x$ksles, x$ksled
v$system_event
x$kslei, x$ksled
Remember these fixed tables are owned by SYS and can change without any notice from release to
release. In Oracle7 version 7.3, sort segments can almost completely reduce contention on the ST
enqueue for sorting (sort-merge join).
How to use these event views ?
The following query gives a quick and but not complete look at the overall system:
1
03/21/96
Page 2
Page 3
P2
P3
name|mode
id1
id2
name|mode
id1
id2
name|mode
id1
id2
type|mode
id1
id2
mode
options
type|mode
id1
options
options
Event Name
DFS db file lock
id2
Null event
PL/SQL lock timer
duration
driver id
break?
driver id
break?
driver id
#bytes
driver id
#bytes
driver id
#bytes
driver id
#bytes
driver id
#bytes
driver id
#bytes
driver id
#bytes
driver id
#bytes
03/21/96
Page 3
Page 4
file#
block#
id
buffer deadlock
dba
class*10+mode
flag
buffer#
dba
state*10+mode
latch addr
chain#
file#
block#
two-task?
driver-id
files
blocks
requests
file#
block#
blocks
file#
block#
blocks
file#
block#
blocks
files
blocks
requests
file#
block#
blocks
file#
block#
blocks
file#
block#
blocks
descriptor address
first dba
name|mode
id1
id2
file#
block#
set-id#
tries
debugger command
direct loader I/O/direct access I/O
dispatcher shutdown
waited
dispatcher timer
sleep time
dba
enqueue
session#
waited
rootdba
level
childdba
instance recovery
undo segment#
waited
layer
value
kcl bg acks
count
loops
latch activity
address
number
process#
latch free
address
number
tries
object address
lock address
10*mask+namespace
handle address
lock address
10*mode+namespace
handle address
pin address
10*mode+namespace
file#
block#
lenum
file#
block#
lenum
03/21/96
Page 4
Page 5
files
blocks
requests
log#
block#
blocks
log#
block#
blocks
buffer#
log switch/archive
thread#
nservers
sleeptime
enqueue
queue/reason
sleeptime
passes
function
sleeptime
qref
nalive
sleeptime
loop
serial
error
nbusy
scans
pipe get
handle address
buffer length
timeout
pipe put
handle address
record length
timeout
process#
waited
pmon timer
process startup
duration
type
queue wait
rdbms ipc message
timeout
from_process
timeout
cache id
mode
secondary event
event #
wait time
entry#
sequence# lock op
entry#
request
single-task message
smon timer
sleep time
failed
timer in sksawat
trace continue
delay time
trace unfreeze
trace writer I/O
03/21/96
Page 5
Page 6
transaction
wrap#
segment#
segment#
segment#
circuit#
status
file#
block#
by thread#
our thread#
count
tx flags
id
03/21/96
Page 6
Page 7
Controlfile Transaction
CI
CU
Bind Enqueue
DF
Data File
DL
Direct Loader
DM
Database Mount
DR
Distributed Recovery
DX
Distributed Transaction
FS
File Set
IN
Instance Number
IR
Instance Recovery
IS
Instance State
IV
JQ
Job Queue
KK
L[A-P]
MM
Mount Definition
MR
Media Recovery
N[A-Z]
PF
Password File
PI
Parallel Slaves
PR
Process Startup
PS
Q[A-Z]
RT
Redo Thread
SC
SM
SMON synchronization
SN
Sequence Number
SQ
Sequence Enqueue
SR
Synchronous Replication
.\tThere was a bug in 7.0 and 7.1 that could cause the lock name to be corrupted. So if a weird name
shows up, you are most likely running in this bug. It was supposed to be fixed in 7.1.6, but that is not
true for all platforms.
03/21/96
Page 7
Page 8
SS
Sort Segment
ST
SV
TA
Transaction Recovery
TM
DML Enqueue
TS
TT
Temporary Table
TX
Transaction
UL
User-defined Locks
UN
User Name
US
WL
XA
XI
mode
The mode will be stored in the low order bytes of P1 or P1RAW. The mode will be one of the
following values:
TABLE 4. Lock Modes
Mode
Meaning
1
Null mode
2
Sub-Share
Sub-Exclusive
Share
Share/Sub-Exclusive
Exclusive
With the following SQL statement one can find the name of the lock and the mode of the lock
request:
select chr(bitand(p1,-16777216)/16777215)||
chr(bitand(p1, 16711680)/65535) Lock,
bitand(p1, 65535) Mode
from v$session_wait
where event = DFS enqueue lock acquisition;
id1
P2 or P2RAW will give the first identifier of the enqueue. See chapter 3 for the meaning of that
identifier, it will depend on the name (P1).
id2
P3 or P3RAW will give the second identifier of the enqueue. See chapter 3 for the meaning of
that identifier, it will depend on the name (P1).
Advise
03/21/96
Page 8
Page 9
So much depends on the on the name of the enqueue that you are trying to get. The following
statistics from v$sysstat are related:
global lock gets (non async)
This statistics gets incremented when the get lock operation has finished and the operation was a
get (mode is 0).
global lock get time
The time it took to complete the synchronous lock get.
global lock converts (non async)
This statistics gets incremented when the synchronous convert lock operation has finished.
global lock convert time
The time it took to complete the synchronous lock convert.
With the following SQL statement one can see the complete enqueue request that sessions are waiting
for or have just waited for:
select chr(bitand(p1,-16777216)/16777215)||
chr(bitand(p1, 16711680)/65535) Lock,
bitand(p1,65535) Mode, p2 id1, p3 id2
from v$session_wait
where event = DFS enqueue lock acquisition;
And with the following SQL statement that needs to be executed on each instance one can find the
current owner(s) of the enqueue that this session is waiting for:
select l.*
from v$lock l, v$session_wait s
where type = chr(bitand(p1, -16777216)/16777215)||
chr(bitand(p1, 16711680)/65535)
and event = DFS enqueue lock acquisition
and lmode > 0;
There are also two internal tables that keep track of enqueues (local or global):
x$ksqrs
This fixed table shows all outstanding enqueues with an additional flag. It basically shows the
same information as the v$lock table.
TABLE 5. ksqrsflg column of X$KSQRS fixed table.
KSQRSFLG
Meaning
0x01
Lock is global
0x02
Not free
0x04
0x08
0x10
0x20
x$ksqst
This fixed table shows the number of gets and waits on each enqueue resource identified by type
in v$lock and name in the DFS enqueue lock ... events.
03/21/96
Page 9
Page 10
03/21/96
Page 10
Page 11
Wait time
Basically we keep on waiting until we have gotten the lock. There is a tight loop here we wait half a
second (0.5 second) each time.
Parameters
type
See DFS enqueue lock acquisition name for a description.
mode
See DFS enqueue lock acquisition mode for a description.
id1
See DFS enqueue lock acquisition id1 for a description.
id2
See DFS enqueue lock acquisition id2 for a description.
Advise
The following statistics in the v$sysstat table are related to this event:
global lock gets (non async)
This statistics gets incremented when the synchronous get lock operation has finished and the
operation was a get (mode is 0).
global lock get time
The time it took to complete this operation. This doesnt include the wait time for the global
lock gets (async).
global lock gets (async)
This statistics gets incremented for the async lock operations
0x04
03/21/96
Page 11
Page 12
0x08
0x10
0x20
0x40
0x80
0x100
0x200
0x400
Advise
Mostly useful on debugging the type of resource and type of operation that is being waited on. One
3
can see converts (on the SC instance lock ) by looking at the 0x10 and 0x20 flag in options parameter
(P2/P2RAW).
03/21/96
Page 12
Page 13
options
The following values for options may be anded together to the value for P1:
TABLE 7. DFS Lock Release Options.
Value
Meaning
0x2
Write Lock Value
0x4
0x8
Advise
If a session is hanging in this operation the problem would normally be with the DLM. Check the
DLM to see if it is still working.
03/21/96
Page 13
Page 14
Parameters
duration
The duration that the user specified in the dbms_lock.sleep or user_lock.sleep procedures.
Advise
Check user PL/SQL functions and procedures for use of these procedures.
03/21/96
Page 14
Page 15
The number of bytes received by the server (foreground process) from the client.
Advise
Check network delays and connections.
03/21/96
Page 15
Page 16
03/21/96
Page 16
Page 17
03/21/96
Page 17
Page 18
= file#
and lowb
<= block#
.\tThis view is defined in ?/rdbms/admin/catparr.sql in Oracle7 Release 7.2. This is a view that gives a
more accurate view of that the table ext_to_obj, but is slower.
03/21/96
Page 18
Page 19
1007
1010
1012
1012 (dup.) Trying to access a CURRENT block, but a modification has started on
the buffer that has not yet been completed.
1013
1014
1016
Advise
The fixed view v$waitstat contains information on per block class basis:
select *
from v$waitstat;
There is also an internal fixed view that shows the waits per file (x$kcbfwait):
select name, count
from x$kcbfwait, v$datafile
where indx + 1 = file#;
The file that has loads of waits should be checked for the objects in that file. The objects should be
checked for the kind of operations that are performed on them (select, insert, update and delete). If
there is any concurrent update, delete or insert taking place, check the number of freelists on your
object. Also checking the pctfree and pctused. Setting a higher initial initrans could also help
concurrency. A large db_block_size may increase the number of buffer busy waits, because there is
more information in the block that is accessed in parallel by many different processes.
To reduce buffer busy waits on:
data blocks
Change pctfree and/or pctused. Check for right-handindexes (indexes that get inserted into at the same point by
many processes). Up initrans. Reduce number of rows per
block.
segment header
freelist blocks
undo header
undo block
03/21/96
Page 19
Page 20
Save Undo
7 + (n * 2)
8 + (n * 2)
If n is 0, the class is pointing at the system rollback segment. The following query will display
the class of the block:
select trunc(p2/10)
from v$session_wait
where event=buffer deadlock;
mode
The mode of the block tells in what mode the block is owned.
TABLE 10. Block/Buffer modes
Mode Means
0
NULL
1
03/21/96
Page 20
Page 21
0x4
0x8
0x10
0x20
Called by sort which will get the block and modify it directly (Mode is
New or Exclusive)
0x40
0x80
0x100
0x200
0x400
Not used.
0x800
Internal flag
0x1000
Internal flag
0x2000
0x4000
dba
This is the dba of the block that we deadlock on:
select name, kind
from ext_to_obj_view
5
where file#
= data_block_address_file(dba)
and lowb
<= data_block_address_block(dba)
.\tThe data_block_address_file procedure needs to be prefixed with the package name dbms_utility. The
package is defined in ?/rdbms/admin/dbmsutil.sql. These procedures exists in Oracle version 7.2 or
higher. Before 7.3 Production you may run into problem into bug 314564, add pragma
restrict_references (data_block_address_file, WNDS, RNDS ...) into dbmsutil.sql.
03/21/96
Page 21
Page 22
= data_block_address_file(dba)
and lowb
<= data_block_address_block(dba)
mode
Mode refers to the lock mode held by the users of the buffer. The mode can be one of the
following:
TABLE 13. Buffer Lock Modes.
Mode
Meaning
0
NULL
1
Current Share
Current Exclusive
03/21/96
Page 22
Page 23
Consistent Read
buffer#
The buffer# is the index in the x$bh table:
select *
from x$bh
where indx = buffer#;
Advise
Some processes is still modifying the buffer. Find the name of the object and see which
process/session is accessing this object. You can do this by doing a systemstate dump. You will find
the buffer handle SO, which will point to the process SO. This happens mostly with a hot block that
needs checkpointing. In normal circumstances, user processes will not wait under this event; rather
they will wait for log file space/switch. However during shutdown and user checkpoint, this event is
used, in conjunction with checkpoint completed, when a buffer needs to be written to disk. This
event is most likely to occur when we have a hot block which needs checkpointing.
03/21/96
Page 23
Page 24
Advise
This is only a problem for dumping trace information. So ignore this event unless a process is hanging
on this event.
= file#
and lowb
<= block#
03/21/96
Page 24
Page 25
Oracle7 starts a controlfile transaction (to make sure that the controlfiles are up to date if Oracle7
would crash before committing the controlfile transaction).
When changing a generic entry in the controlfile, write the new value to all controlfiles.
Wait time
The wait time is the time it takes for all writes to all controlfiles to finish.
Parameters
files
This indicates the number of controlfiles that Oracle7 is writing in parallel too.
blocks
This indicates the number of controlfiles that Oracle7 is writing in parallel too.
requests
This indicates the number of controlfiles that Oracle7 is writing in parallel too.
03/21/96
Page 25
Page 26
Advise
Basically files, blocks and requests all will have the same value and it is the number of real requests
that will be written in parallel.
03/21/96
Page 26
Page 27
block#
Blocknumber in the controlfile from where we are starting to write. The blocksize is the as the
physical blocksize of the port (normally 512 bytes, some UNIX ports have 1 Kilobytes or 2
Kilobytes).
blocks
The number of blocks that we are trying to read.
Advise
If the wait time is too long (more than average I/O speed), check if the controlfiles are not a disk that
is too busy. This could really impact Parallel Server performance as some of the synchronization
between instances is done through the controlfiles.
03/21/96
Page 27
Page 28
requests
This indicates the total number of I/O requests, which will be the same as blocks.
Advise
If the waiting is too long, it could indicate that there is some kind of I/O bottleneck on the system.
Compare the wait time with other I/O times on the system. Also to speed the wait time it may be a
good idea to put the database files on different devices, so that the write will happen in parallel to
these devices. The total wait time should be divided by the number of devices. Also the internal write
batch could be too big, try reducing the _db_block_write_batch.
= file#
and lowb
<= block#
03/21/96
Page 28
Page 29
Parameters
file#
This is the file# of the file that Oracle7 is currently reading from. With the following SQL
statement one can find the name of the file:
select *
from v$datafile
where file# = file#;
block#
This is the number of the block that Oracle7 is currently writing. If the block number is not 1
(indicates Oracle7 File Header Block), use the following SQL statement to find the object that
the block belongs to:
select name, kind
from ext_to_obj_view
where file#
= file#
and lowb
<= block#
= file#
and lowb
<= block#
03/21/96
Page 29
Page 30
Advise
The fileheader of a Oracle7 file is always block 1. The platform specific header is block 0. If the
block number is not 1, it points to a block in an object.
03/21/96
Page 30
Page 31
Parameters
sleep time
This is the intended sleep time, dispatcher will return sooner to work if it is posted by either data
arriving on the network or by a post from a shared server process to send data back to the client.
Advise
If there are a lot of time-outs on this event, it basically means that the dispatcher is not very busy. If
on the other hand the number of time-outs is low, it could mean that the dispatchers are (very) busy.
= data_block_address_file(dba)
and lowb
<= data_block_address_block(dba)
2.43 enqueue
Oracle7 is waiting for a local (vs. global) enqueue (vs. latch). The wait is dependent on the name of the
enqueue (See Chapter 3).
Wait time
Depends on name.
Parameters
name
The name of enqueue is always two characters. These enqueues are used internally by Oracle7 to
synchronize access to internal resources. Look in table 4 for an overview of possible names
(DFS lock enqueue acquisition). With the following SQL statement one can find the name of the
enqueue that the sessions are trying to get:
select chr(bitand(p1, -16777216)/16777215)||
chr(bitand(p1,16711680)/65535) Enqueue
from v$session_wait
where event = enqueue;
03/21/96
Page 31
Page 32
mode
The mode is the requested mode by the session. See table 3 for an overview of all possible lock
modes. With the following SQL statement one can determine the lock mode:
select bitand(p1, 65535)
from v$session_wait
where event = enqueue;
id1
P2 will give the first identifier of the enqueue. See chapter 3 for the meaning of that identifier, it
will depend on the name of the enqueue.
id2
P3 will give the second identifier of the enqueue. See chapter 3 for the meaning of that
identifier, it will depend on the name of the enqueue.
Advise
enqueue conversions
enqueue deadlocks
enqueue releases
enqueue requests
enqueue time-outs
Latch: enqueue_resources
enqueue_hash
int.ora: enqueues
_enqueue_locks
_enqueue_hash
_enqueue_debug_multi_instance
All buffer gets have been suspended. This could happen when a file was read-only and is now readwrite. All the existing buffers need to be invalidated since they are not linked to lock elements
(needed when mounted parallel (shared)). So cache buffers are not assigned to dbas until the
invalidation is finished.
This could also happen when you need a buffer from the SGA for a block in CR, READING or any of
the recovery modes. Basically you will post the DBWR to make some free buffers.
This also happens after inspecting free buffers inspected buffers. If no free buffer was found,
Oracle7 waits for one second and will try to get the buffer again (depends on the context).
Wait time
1 Second.
Parameters
file#
This the file in which Oracle7 is trying to get a free block. The name of the file can be
determined with the following SQL statement:
select *
from v$datafile
where file# = file#;
03/21/96
Page 32
Page 33
block#
This is the block# in the file that Oracle7 is trying to read into a buffer that currently is not
available. With the following SQL statement one can determine to which object the block
belongs:
select name, kind
from ext_to_obj_view
where file# = file#
and lowb <= block#
and highb >= block#;
Advise
The DBWR is not writing enough buffers to disk. Make sure that the I/O load is evenly distributed
across all disks, use O/S monitor tools or look at v$filestat:
select name, phyrds, phywrts
from v$filestat a, v$datafile b
where a.file# = b.file#
Also look for files that have full table scans:
select name, phyrds, phyblkrd, phywrts
from v$filestat a, v$datafile b
where a.file# = b.file#
and phyrds != phyblkrd
Check your application to make sure that is what you intended and that you dont miss an index.
Always try to use the O/S striping software to distribute database files over as many disks as one can.
Disk Sorts are known to cause a flood of dirty buffers that will need to written out. It is important to
stripe the datafiles belonging to the TEMP tablespace to over many different disks. Also during a
checkpoint the SORT blocks are not checkpointed and they are thus only written in the normal write
batch. If the write batch is full with SORT blocks, the other dirty blocks cant be written and
foregrounds will have to wait for free buffers.
03/21/96
Page 33
Page 34
alive. If there are dead processes, PMON will clean them up and make the process slot available to new
processes. The waiting process will then rescan the process table to find the new slot.
Wait time
1 Second.
Parameters
None.
Advise
If this happens often, one should consider increasing the size of the process table (processes init.ora
parameter).
Switching sessions
If a time-out period has been specified, then wait that amount of time for the session to be detached
from another process.
Killing sessions
From either kill session or internal request. Having posted a session that it should kill itself, wait for
up to 1 minute for the session to die.
Wait time
1 Second.
Parameters
session#
This is the number of the inactive session. One can find the session with the following SQL
statement:
select *
from v$session
where sid = session#;
waited
This is the total amount of time Oracle7 has waited for this session to die.
Advise
If the session cant be killed an Oracle error 31 will be signalled. A process can only be killed or
switched if the user call that it was executing has finished.
03/21/96
Page 34
Page 35
= data_block_address_file(rootdba)
and lowb
<= data_block_address_block(rootdba)
= data_block_address_file(childdba)
and lowb
<= data_block_address_block(childdba)
03/21/96
Page 35
Page 36
Wait time
The amount of time depends on the amount of time the action takes (amount of recovery to do).
Parameter
layer
This value can be 1 or 2. If 1, it means that the transaction layer wants transaction recovery to be
performed. If 2, it means that cache recovery will be performed.
value
This value can be 0 (disable) or 1 (enable).
waited
This is the number of seconds waited so far.
Advise
The instance state change are the result of a alter database command (like open, close etc.).
lock recovery
initializing the locks (start-up)
finalizing the locks (shutdown).
Wait time
10 Seconds.
Parameters
count
The count is the number of LCK processes that have finished.
loops
The loops is the number times the process had to wait for the LCK processes to finish what they
were doing.
Advise
Check the number of gc_lck_procs:
select value
from v$parameter
where name = gc_lck_procs
03/21/96
Page 36
Page 37
select *
from v$latchname
where latch# = number;
process#
If this is 0, it is the first phase of the in-flux tests.
Advise
Check for dead processes. There could also be an issue that processes get preempted a lot by
processes trying to acquire a latch.
03/21/96
Page 37
Page 38
archive control
The archive control latch protects the archive destination string in the SGA. If a session wants to
update or read the archive destination, it will get this latch to make sure that the session gets a
consistent view.
cache buffer handles
This latch protects the State Objects that are needed by a process to make a change to a
block/buffer. Before the change a buffer handle is acquired either from the process private pool
or the global pool if none are present. The access to the global pool is protected by this latch.
cache buffer chains
Before modifying a buffer the foregrounds need to get a latch to protect the buffer from being
updated by multiple users. Several buffers will get hashed to the same latch. The buffers get
hashed to a cache buffer chain latch depending on the DBA of the block that is in the buffer.
cache buffer lru chain
Protects the Least Recently Used list of cache buffers. For moving buffers around on this list the
Oracle7 kernel needs to get this latch.
cache protection latch
During the cloning of a buffer the buffer header is atomically updated to reflect the new position
in the buffer cache. Only one buffer at the time may be cloned, as it is protected by this latch. A
lot of contention on this latch would indicate that there is a lot of concurrent cloning going on.
cached attr list
This latch protects a cache of attributes that are only used in Parallel Server. The attributes that
are cached are for example the instance number. It also keeps track of the instance map (which
instances are up and running). By caching this information it becomes available (relatively) to
whole instance.
cost function
The cost function latch protects the resource limit table in the SGA. If multiple sessions would
execute the alter resource cost statement , the new cost values would need to be protected when
copied into the SGA.
dml lock allocation
This latch protects the list of State Objects (dml locks). Every time a transaction modifies a
table, a DML lock is gotten and released when the change is committed. The number of State
Objects for dml locks is determined by the init.ora parameter dml_locks.
enqueue hash chains
_enqueue_hash_chain_latches (default number of CPUs or cpu_count). Protects the individual
hash buckets
enqueues
This latch is used to add and remove the enqueue State Object to a parent Object State. It is also
used if there are no free state objects on enqueue hash chain. The hash chain is calculated by:
((type[0] << 5) + type[1] + id1 + id2) % # buckets.
error message lists
Used by the Parallel Query Option to signal errors to the Query Coordinator.
global transaction
This latch is used to control the setting of a savepoint in a transaction control block (stored in the
SGA).
global tx freelist
Only used when the Distributed Database Option is enabled.
global tx hash mapping
03/21/96
Page 38
Page 39
03/21/96
Page 39
Page 40
redo allocation
The redo allocation latch is used to allocate the redo buffers in the redo log buffer. It is also
gotten we Oracle7 needs to advance to SCN as part of a checkpoint. This way we can make sure
that nobody can use the new SCN number.
redo copy
When a redo buffer has been allocated and the size of the redo is larger than
log_small_entry_max_size, the kernel will allocate a redo copy latch. The number of redo copy
latches is controlled by the init.ora parameter log_simultaneous_copies (defaults to the number
of CPUs). The LGWR will get all the redo copy latches before it will write redo to make sure
that nobody is writing in redo buffers that are currently written.
row cache objects
This latch protects the access of the datadictionary cache in the SGA. When loading, referencing
and freeing objects in the datadictionary cache you need to get this latch.
sequence cache
This latch protects the lists of State Objects that are used for sequence numbers. Allocating from
and Releasing to this freelist is protected with this latch.
session allocation
This latch is used for a lot of things. It protects the session State Object freelist. The size of this
freelist is determined by the init.ora parameter sessions. It also controls the updating of the
systemwide statistics (v$sysstat). Licensing information is also controlled by this latch. The
allocation of calls is also protected by this latch.
session idle bit
Every time the session starts to execute a call, the active bit will be set by the session and when
the session finishes the call, it will clear the active bit. The status field in v$session will change
from ACTIVE to INACTIVE (protected by this latch).
session switching
This latch protects the switching from sessions in XA.
shared pool
sort extent pool
This latch protects the sort extents in the SGA. There is a cache of extents and descriptors.
Access to these is protected by this latch. This latch will get used if a tablespace is marked
temporary.
system commit number
This latch protects the SCN in the SGA. Any reference to a SCN (Recent, Current) means that
you need to get this latch first.
trace latch
This latch protect the Trace State Objects in the SGA. The number of Trace State Objects is
equal to the number of processes.
transaction allocation
This latch protects the pool of transaction state objects in the SGA. The number of Transaction
State Objects is determined by the init.ora parameter transactions.
undo global data
This latch serializes the access to the Undo (aka Rollback) segment information in the SGA.
Every time a session wants to know about the state of the Undo Segments, it has to get this latch.
03/21/96
Page 40
Page 41
user lock
This latch protects the user. It makes sure that a user cant be dropped while logging on or while
logged on.
virtual circuit buffers
One latch per session
virtual circuit queues
This latch serializes the access to queues. Each dispatcher process has its own queue. There are a
total of mts_max_dispatcher + 2 queues. Basically the dispatcher will put a virtual circuit on a
queue that is going to be picked up by a shared server process.
virtual circuits
This latch protects the pools of Virtual Circuit State Objects. If the Dispatcher allocates a
Virtual Circuit, it is incoming. If a Shared Server process allocates a Virtual Circuit, it is
outgoing. Also the ownership of the Virtual State Circuit gets moved from the Dispatcher to
Shared Server and vice-versa.
0x04
0x08
0x10
0x20
0x40
0x80
data block 7
TABLE 15.
Namespace
0
Meaning
Cursor
namespace
03/21/96
Page 41
Page 42
table/view/sequence/synonym/class/set/procedure/
function/package
trigger
index
cluster
object
pipe
127
no namespace
Advise
?
03/21/96
Page 42
Page 43
= file#
and lowb
<= block#
03/21/96
Page 43
Page 44
select *
from v$datafile
where file# = file#;
block#
This is the block that the session wants a PCM lock for. With the following SQL statement one
can find out to which object this block belongs:
select name, kind
from ext_to_obj_view
where file#
= file#
and lowb
<= block#
03/21/96
Page 44
Page 45
Parameters
files
Number of files written to.
blocks
Number of blocks to be written.
requests
Number of I/O requests.
Advise
Check the average I/O time in v$system_event for this event. When the I/O time is too high check to
see if the disk that contains the log files is too busy.
03/21/96
Page 45
Page 46
blocks
The number of blocks written.
Advise
If this happens to often consider running with larger redo log files (does this make sense?).
03/21/96
Page 46
Page 47
1 Second.
Parameters
No Parameters.
Advise
03/21/96
Page 47
Page 48
Parameters
buffer#
This is the buffer# inside the log buffer. The log buffer consists of smaller buffers (of physical
block size).
Advise
Speed up the LGWR. Look at the average Redo Size per Commit.
03/21/96
Page 48
Page 49
03/21/96
Page 49
Page 50
sleeptime
The total sleeptime since Oracle7 started to wait on this event.
loop
The number of times Oracle7 has waited for this event.
Advise
?
03/21/96
Page 50
Page 51
Multi-threaded server
Dispatcher
process#
This is the process number of the process being started. It is the Oracle7 process number which
can be found in the v$process view:
03/21/96
Page 51
Page 52
select *
from v$process
where pid = process#;
waited
Cumulative time waited so for the process to start up.
Advise
If a lot of waits /timeouts show on this event, it could mean that the minimum number of processes
(either Parallel Query Slaves, Dispatchers and Shared Servers), is set to low. Increase the
corresponding init.ora parameters to set a higher minimum.
03/21/96
Page 52
Page 53
from_process
This parameter only exists in release 7.1 and higher. It is the process that the waiting process is
expecting a message from. With the following SQL statement one can get more information on
that process:
select *
from v$process
where pid = from_process;
timeout
This the amount of time in seconds that this process will wait for a reply.
Advise
Check to see if the from_process is still running.
03/21/96
Page 53
Page 54
03/21/96
Page 54
Page 55
This is the number of times SMON was posted or there was some kind of error.
Advise
?
03/21/96
Page 55
Page 56
Wait time
? Seconds.
Parameters
None.
Advise
?
2.98 transaction
Wait for a blocking transaction to be rolled back. Continue waiting until the transaction has been rolled
back.
Wait time
1 Second.
Parameters
undo seg#
select *
from v$rollstat
where usn = undo seg#
slot#
This is the slot# within the transaction table that is being used to store a transaction.
wrap#
Wrap or sequence number of the slot. For each new transaction increase this number.
count
Number of times that Oracle7 has waited on this transaction.
Advise
The waiting basically depends on the size of that transaction that is being rolled back. (Can we see
how much work was done and has to be rolled back?)
03/21/96
Page 56
Page 57
0x4
0x10
0x20
Advise
In Parallel Server mode the Global enqueue TA is acquired to recovery the transaction. If the TA lock
cant be obtained wait on this event and try again.
03/21/96
Page 57
Page 58
from x$kmcvc
where indx = circuit#;
status
Advise
Reason
Trying to renew the buffer, but it is currently being written. The
buffer is formatted in the cache for a new block (old block
discarded).
1027
1027
(dup)
1029
1030
1030 (dup)
1031
1033
1034
1035
Cross Instance Write: same as 1034, but the problem now is this
happens during a hot backup.
1035 (dup)
file#
select *
from v$datafile
where file# = file#;
block#
select name, kind
from ext_to_obj_view
Description of Oracle Wait Events and Enqueues
03/21/96
Page 58
Page 59
where file#
and lowb
= file#
<= block#
03/21/96
Page 59
Page 60
When accessing database blocks. All acquired in NULL mode by each instances LCK*
processes when an instance is started. Converted up and down to different modes by LCK*
processes in response to requests from user foregrounds and instance backgrounds. Each lock
covers a portion of the physical database on disk, by file and block range, in accordance with the
setting of gc_file_to_locks.
Id1, Id2 Combination:
Lock Element Number, Block Class
Lock Value Block:
Thread number of last change and SCN.
Init.ora Parameters:
gc_db_locks, gc_segments, gc_tablespaces, gc_save_rollback_locks, gc_rollback_segments,
gc_rollback_locks.
Scope:
Global Lock.
Deadlock Sensitive:
No.
Operation:
Asynchronous.
3.2
03/21/96
Page 60
Page 61
03/21/96
Page 61
Page 62
Id1
0
Id2
0
Meaning
Serialize Control file actions
Meaning
Flush buffers for reuse as new class
Test Call
03/21/96
Page 62
Page 63
10
11
12
13
14
15
16
Id2
1
03/21/96
Page 63
Page 64
unbound, in which case well verify that it was bound the way that we wanted it, or well go
ahead and bind it ourselves.
Id1, Id2 Combination:
Child Object Handle, 0.
Lock Value Block:
Not Used.
Init.ora Parameters:
max_open_cursors
Scope:
Local Enqueue.
Deadlock Sensitive:
Yes.
Operation:
Synchronous.
03/21/96
Page 64
Page 65
3.6
3.7
03/21/96
Page 65
Page 66
Id1
0
Id2
0
Meaning
Mount type. This is used to determine if the DB may be mounted
shared or exclusive. It is always nowait. Only acquired by
DBWR.
Open flag. This is used to verify that no other instance has the
database open or is in process of opening it. It is similar to the
hold open lock and is acquired and released at the same time.
This is a local enqueue rather then an instance lock. This is
separate of the hold open lock so that testing does not interfere
with deciding if this is the first instance to open. If one instance
was getting the hold lock just to see if the db was open any
where, another instance might think the database was already
opened.
03/21/96
Page 66
Page 67
RECOs
When Used:
Used to ensure that only one RECO is doing distributed transaction recovery actions at a time.
Id1, Id2 Combination:
Always 0, Always 0
Lock Value Block:
Not Used.
Init.ora Parameters:
distributed_transactions. (Distributed Database Option)
Scope:
Global Lock.
Deadlock Sensitive:
No.
Operation:
Synchronous.
3.9 DX, Distributed TX
How Many Resources:
1
How Many Locks:
1 per process that tries to do a distributed transaction.
How Many Users:
1/ instance
Who Uses:
RECOs
When Used:
Used to ensure that only one process is using a distributed transaction slot at a time.
Id1, Id2 Combination:
Slot Number (of distributed transaction table), Always 0
Lock Value Block:
Not Used.
Init.ora Parameters:
distributed_transactions. (Distributed Database Option)
Scope:
Local Enqueue.
Deadlock Sensitive:
Yes.
Operation:
Synchronous.
3.10
03/21/96
Page 67
Page 68
Do dictionary check.
3.11
03/21/96
Page 68
Page 69
Meaning
To serialize instance recoverers.
Scope
Local and Global
Enqueue
03/21/96
Page 69
Page 70
03/21/96
Page 70
Page 71
Who Uses:
LCK? and the process which wants to invalidate objects cached across all instances
When Used:
When a valid and existent database object is brought into the library cache, LCK? is asked to
acquire the lock in the correct mode (always S). It is held until the object becomes invalid or
non-existent or is aged out of the library cache. This lock is used to invalidate objects cached
across all instances. The process that wants to invalidate an object simply acquires the lock in X
mode on the object causing all instances to invalidate their cached objects responding to BASTs
and release their IV locks on their objects; then, the invalidating process immediately releases
the X lock.
Id1, Id2 Combination:
Object Number, Timestamp.
Lock Value Block:
Not Used.
Init.ora Parameters:
None.
Scope:
Global Lock.
Deadlock Sensitive:
No.
Operation:
Synchronous.
03/21/96
Page 71
Page 72
Yes.
Operation:
Synchronous.
03/21/96
Page 72
Page 73
All processes
Who Uses:
All processes
When Used:
When a database object (table, view, procedure, function, package, package body, trigger, index,
cluster, synonym) is referenced during parsing or compiling of a SQL (DML/DDL) or PL/SQL
statement, the process parsing or compiling the statement acquires the lock in the correct mode.
It is held until the parse or compilation completes (for the duration of the parse call). In V6,
these locks are known as parse or DDL locks except that in V6 these locks are held for the
duration of the cursor (i.e., until the cursor is closed); in Oracle7, these locks are held only
during the parse call.
Id1, Id2 Combination:
Lock Value Block:
Not Used.
Init.ora Parameters:
shared_pool
Scope:
Global Lock.
Deadlock Sensitive:
Yes.
Operation:
Synchronous.
3.18
03/21/96
Page 73
Page 74
Deadlock Sensitive:
No.
Operation:
Synchronous.
S - doing Recovery
File Access Enqueue, used to coordinate recovery.
3.20
03/21/96
Page 74
Page 75
03/21/96
Page 75
Page 76
3.22
03/21/96
Page 76
Page 77
group
When Used:
To synchronize the creation of new parallel slave servers and their addition to a parallel slave
group on behalf of a parallel query, a parallel index creation, or a parallel recovery session.
Id1, Id2 Combinations:
Lock Value Block:
Init.ora Parameters:
Scope:
Deadlock Sensitive:
No.
03/21/96
Page 77
Page 78
3.25
3.26
03/21/96
Page 78
Page 79
LGWR
Thread
DBWR
Thread
LCK0
Thread
LCK1
Thread
LCK2
Thread
LCK3
Thread
LCK4
Thread
LCK5
Thread
LCK6
Thread
10
LCK7
Thread
11
LCK8
Thread
12
LCK9
03/21/96
Page 79
Page 80
lock is released so that it may be granted to another instance. Processes get the SC lock once and
then use conversion operations to manipulate the lock value.
Id1, Id2 Combination:
TABLE 28.
Id1
Id2
Meaning
0
0
SCN Global lock
0
3.28
SM, SMON
03/21/96
Page 80
Page 81
3.29
03/21/96
Page 81
Page 82
Scope:
Deadlock Sensitive:
No.
Operation:
Synchronous.
03/21/96
Page 82
Page 83
When Used:
When sorting.
Id1, Id2 Combinations:.
Id1
Id2
tablespace id1
tablespace id2
TABLE 29.
Meaning
Local enqueue, to notify SMON to request some
action for tablespace identified by tablespace id.
Global enqueue, to release space for releasing space
in tablespace identified by tablespace id.
3.33
03/21/96
Page 83
Page 84
No.
Operation:
Synchronous.
3.35
03/21/96
Page 84
Page 85
transaction enqueue
object#
03/21/96
Page 85
Page 86
Local, Global.
Deadlock Sensitive:
No.
Operation:
Synchronous.
tablespace
number
03/21/96
Page 86
Page 87
03/21/96
Page 87
Page 88
3.40
3.41
03/21/96
Page 88
Page 89
03/21/96
Page 89
Page 90
03/21/96
Page 90
Page 91
03/21/96
Page 91
Page 92
No.
Operation:
Synchronous.
03/21/96
Page 92