ITPub博客

首页 > 数据库 > Oracle > Enqueue

Enqueue

原创 Oracle 作者:nwpu053871 时间:2016-04-07 21:54:26 0 删除 编辑
BL, Buffer Cache Management 
CF, Control File Transaction 
CI, Cross-instance Call Invocation 
CU, Bind Enqueue 
DF, Data File 
DL, Direct Loader Index Creation 
DM, Database Mount 
DX, Distributed TX Recovery 
FS, File Set 
IN, Instance Number 
IR, Instance Recovery 
IS, Instance State 
IV, Library Cache Invalidation 
KK, Redo Log "Kick" 
L[A-P], Library Cache Lock 
MR, Media Recovery 
N[A-Z], Library Cache Pin 
PF, Password File 
PI, Parallel Slaves 
PR, Process Startup 
PS, Parallel Slave Synchronization 
Q[A-Z], Row Cache 
RT, Redo Thread 
SC, System Change Number 
SM, SMON 
SN, Sequence Number 
SQ, Sequence Number Enqueue 
ST, Space Management Transaction 
SV, Sequence Number Value 
TA, Transaction Recovery 
TM, DML Enqueue 
TS, Temporary Segment (also TableSpace) 
TT, Temporary Table 
TX, Transaction 
UL, User-defined Locks 
UN, User Name 
US, Undo segment, Serialization 
WL, Being written Redo Log 
XA, Instance Attribute Lock 
XI, Instance Registration 


Enqueue and Lock Names
BL, Buffer Cache Management 
CF, Control File Transaction 
CI, Cross-instance Call Invocation 
CU, Bind Enqueue 
DF, Data File 
DL, Direct Loader Index Creation 
DM, Database Mount 
DX, Distributed TX Recovery 
FS, File Set 
IN, Instance Number 
IR, Instance Recovery 
IS, Instance State 
IV, Library Cache Invalidation 
KK, Redo Log "Kick" 
L[A-P], Library Cache Lock 
MR, Media Recovery 
N[A-Z], Library Cache Pin 
PF, Password File 
PI, Parallel Slaves 
PR, Process Startup 
PS, Parallel Slave Synchronization 
Q[A-Z], Row Cache 
RT, Redo Thread 
SC, System Change Number 
SM, SMON 
SN, Sequence Number 
SQ, Sequence Number Enqueue 
ST, Space Management Transaction 
SV, Sequence Number Value 
TA, Transaction Recovery 
TM, DML Enqueue 
TS, Temporary Segment (also TableSpace) 
TT, Temporary Table 
TX, Transaction 
UL, User-defined Locks 
UN, User Name 
US, Undo segment, Serialization 
WL, Being written Redo Log 
XA, Instance Attribute Lock 
XI, Instance Registration 
This appendix provides detailed definitions of enqueues and locks. It includes the following sections: 
BL, Buffer Cache Management
CF, Control File Transaction
CI, Cross-instance Call Invocation
CU, Bind Enqueue
DF, Data File
DL, Direct Loader Index Creation
DM, Database Mount
DX, Distributed TX Recovery
FS, File Set
IN, Instance Number
IR, Instance Recovery
IS, Instance State
IV, Library Cache Invalidation
KK, Redo Log "Kick"
L[A-P], Library Cache Lock
MR, Media Recovery
Q[A-Z], Row Cache
N[A-Z], Library Cache Pin 
PF, Password File
PI, Parallel Slaves
PR, Process Startup
PS, Parallel Slave Synchronization
SC, System Change Number
SM, SMON
SN, Sequence Number
SQ, Sequence Number Enqueue
ST, Space Management Transaction
SV, Sequence Number Value
TA, Transaction Recovery
TM, DML Enqueue
TS, Temporary Segment (also TableSpace)
TT, Temporary Table
TX, Transaction
UL, User-defined Locks
UN, User Name
US, Undo Segment, Serialization
WL, Being Written Redo Log
XA, Instance Attribute Lock
XI, Instance Registration 


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


BL, Buffer Cache Management
When Used:
When accessing database blocks. All are acquired in null mode by each instance's LCKn processes when an instance is started. Converted up and down to different modes by LCKn processes in response to requests from user foreground processes and instance background processes. 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 


CF, Control File Transaction
When Used:
When switching log files; held exclusive.
When updating checkpoint information for data files; held exclusive.
When opening a log file for redo reading during recovery; held shared.
When getting information to perform archiving; held shared.
When performing crash recovery; held exclusive.
When performing instance recovery; held exclusive.
When performing media recovery; held exclusive.
When dumping log file history; held shared.
When updating archiving information, then exclusive.
When creating a database; held exclusive.
When mounting a database; held shared.
When closing a database; held shared.
When adding a log file or log file member; held exclusive.
When dropping a log file or log file member; held exclusive.
When checking information about log file group members; held shared.
When adding a new data file; held exclusive.
When dropping a data file; held exclusive.
When re-creating (as empty) an existing database file; held shared to find the file; held exclusive to perform the update to the file entry in the control file when the zeroing task is complete.
When identifying or re-identifying database files; held shared.
When setting a set of data files OFFLINE; held exclusive twice in a two-step process.
When setting a set of data files ONLINE; held exclusive, and then again when the transaction subsystem completes applying save undo to the online files; a two-step process.
When marking a set of data files READONLY; held exclusive twice in a two-step process.
When marking a set of READONLY data files READWRITE; held exclusive twice in a two-step process.
When formatting a new control file, that is, CREATE control file; held exclusive.
When beginning a hot backup; held exclusive.
When ending a hot backup; held exclusive.
When checking to see, after a crash, whether data files are in hot backup mode; held shared, then exclusive.
When executing a ALTER DATABASE BACKUP control file TO TRACE; held shared.
When opening the database (control file); held exclusive by first instance to open, shared by subsequent instances.
When renaming data files or log files; held exclusive.
When marking a control file as valid and mountable; held exclusive.
When handling an error encountered in the control file; held exclusive.
When validating data dictionary entries against matching control file records for file entries; held exclusive.
When updating control file format after a software upgrade; held exclusive.
When scanning for log file information by log sequence number; held shared.
When finding the highest-in-use entry of a particular control file record type; held shared.
When getting information about the number of log entries and their lowest and highest sequence number and log file numbers; held shared.
When looking up a control file record matching a given filename; held shared.
When retrieving or updating a control file record; held shared for retrieval, exclusive for update.
When making a backup control file; held exclusive for the duration of the copy.
When dumping the contents of the control file during debugging; held shared.
When dumping contents of a current redo log file during debugging; held shared.
When dumping contents of redo log headers; held shared.
When dumping contents of data file headers; held shared.
When updating MAC security mode in Trusted Oracle; held exclusive.
When reading shared information from the control file; held exclusive until shared information is written back updated, or until finished looking at it. Shared information is read and updated infrequently and is used primarily for instances to agree on compatibility and modes of operation, and for system commit number housecleaning in instance recovery situations.
Id1, Id2 Combinations: Id1 Id2 Meaning 0 0 serialize control file actions 0 1 shared information access Table E - 1. Id1, Id2 Combinations for CF Resource 


CI, Cross-instance Call Invocation
When Used:
Used to invoke specific actions in background processes on a specific instance or all instances. Examples include checkpoint, log switch, shutting down, identifying or re-identifying data files, and so forth. All in all, there is a small number (10s) of predefined cross-instance call types. Id1, Id2 Combinations: 
Id1 Meaning 0 Flush buffers for reuse as new class 1 LGWR checkpointing and hot backup 2 DBWR synchronization of SGA with control file 3 Log file add/drop/rename notification 4 Write buffer for CR read 5 Test call 6 Invalidate KCK cache in all instances 7 Alter rollback segment optimal 8 Signal query servers/coordinator 9 Create remote parallel query server 10 Set global partitions 11 Stop disk writes 12 Drop sort segments 13 Release unused space from sort segments 14 Instance recovery for parallel operation group 15 Validate parallel slave lock value 16 Check transaction state objects Table E - 2. Id1 for CI Resource 
Id2 Meaning 1 Pass in parameters 2 Invoke the call in background process 3 Foreground process has not returned yet 4 Used to allocate the CI call 5 Used to queue up interested clients Table E - 3. Id2 for CI Resource 


CU, Bind Enqueue
When Used:
This keeps the process from hanging on the exclusive pin if somebody else sets the bind types and gets the shared-pin for the execute before the process gets the exclusive pin for bind (which would be unnecessary at that point). Once the process gets the enqueue, it will check whether the cursor is still unbound, in which case it will verify that it was bound in the desired way. Otherwise the process itself will go ahead and bind it. Id1, Id2 Combination: Child object handle, 0 


DF, Data File
When Used:
Obtained shared by DBWR in every instance as the instance comes up, or upon request of a re-identify request. It is held shared for the life of the instance, and is used to notice changes like a file being offlined on another instance. It is also held exclusive when bringing a file online. Id1, Id2 Combination: Always 0, File Number 


DL, Direct Loader Index Creation
When Used:
When initializing to do a direct load of a table; held shared by every direct loader session loading that object for the duration of the load. Acquired and held shared exclusive when creating an index on the table. Id1, Id2 Combination: Object Number, Always 0 


DM, Database Mount
When Used:
When mounting or opening a database. If the database is being mounted exclusive, then one lock is acquired to ensure no other instances can successfully mount it. If the database is being mounted shared, all five locks are used to ensure that all processes attempting to mount or open on all instances have a consistent view of the mount or open state of the database. Id1, Id2 Combinations: 
Id1 Id2 Meaning 0 0 Mount type. This is used to determine if the database may be mounted shared or exclusive. It is always nowait. Only acquired by DBWR. 0 1 Mount gate. This is used to serialize checking for the first instance to mount. It is only acquired by foreground processes attempting to mount the database. 0 2 Hold mount. This is held to indicate that the database is mounted by some instance somewhere. Its lock value contains enough information to validate that the correct control files are opened. The first foreground process gets it shared. After the database is successfully mounted, the DBWR holds this lock shared until the database is dismounted. 1 0 Open flag. This is used to verify that no other instance has the database open or is in the 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. It is separate from the hold open lock so that testing does not interfere with deciding if this is the first instance to open. If one instance is getting the hold lock just to see if the database was open anywhere, another instance might think the database is already open. 1 1 Open gate. This functions identically to the mount gate except that it is used for database open. 1 2 Hold open. This functions identically to hold mount except that it is used for database open, and its lock value is not used. Table E - 4. Id1, Id2 Combinations for DM Lock 


DX, Distributed TX Recovery
When Used:
Used to ensure that only one RECO process at a time is performing distributed transaction recovery actions. Id1, Id2 Combination: Always 0, Always 0 


FS, File Set
When Used:
The first lock is used to hold the set consistent for actions such as dropping or renaming a data file. The second is used when validating control file information regarding files with information stored in the data dictionary. Id1, Id2 Combinations: 
Id1 Id2 Meaning 0 0 take offline 0 1 do dictionary check Table E - 5. Id1, Id2 Combinations for FS Lock 


IN, Instance Number
When Used:
Used to ensure that the INSTANCE_NUMBER parameter, used for freelist management, is unique for every instance accessing a database. Id1, Id2 Combination: Always 0, Instance Number 


IR, Instance Recovery
When Used:
Used to ensure that only one SMON process or ALTER DATABASE OPEN statement performs instance recovery at any given time. Id1,Id2 Combination: Always 0, Always 0 


IS, Instance State
When Used:
Processes intended to modify the instance state acquire the locks in exclusive mode. Processes that want to hold the instance in a particular mode acquire them shared. Id1, Id2 Combinations: 
Id1 Id2 Meaning 0 0 background instance state lock 0 1 changing mount or open state of the database on this instance 0 3 modify cache size Table E - 6. Id1, Id2 Combinations for IS Lock 


IV, Library Cache Invalidation
When Used:
When a valid existing database object is brought into the library cache, LCKn acquires 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. this causes 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 


KK, Redo Log "Kick"
When Used:
Used to keep online redo logs archiving off of idle instances, while other active instances generate redo and archive online logs. The intent is to keep archive streams from all participating instances close to each other in time, so that a set of archived logs for all redo streams and instances can easily be identified and managed for backup or recovery. Also used in executing the ALTER SYSTEM ARCHIVE LOG CURRENT command, which causes all instances to archive their current logs. Id1, Id2 Combination: Always 0, Thread Number 


L[A-P], Library Cache Lock
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 Oracle V6, these locks are known as parse or DDL locks except that they are held for the duration of the cursor (that is,, until the cursor is closed). In Oracle7, these locks are held only during the parse call. 


MR, Media Recovery
When Used:
Held shared by any process performing media recovery to prevent any other process from performing an ALTER DATABASE OPEN RESETLOGS statement. The file access locks are held shared by online users of a particular data file to prevent recovery actions from taking place. They are held exclusive by processes performing recovery actions on that file. Id1, Id2 Combinations: 
Id1 Id2 Meaning o o Media Recovery Enqueue X - doing reset logs S - doing recovery file# 0 File Access Enqueue, used to coordinate recovery Table E - 7. Id1, Id2 Combinations for MR Lock 


N[A-Z], Library Cache Pin
When Used:
Used when pinning "object" parts of database objects (see above) in an instance's library cache. Held until the "object" part is flushed or aged out (for example, as the result of another object needing cache space, and the object to be flushed is not pinned or in use). Prior to Oracle Server release 7.3, this was named P[A-Z]. 


PF, Password File
When Used:
Acquired exclusive to read or update the password file. 


PI, Parallel Slaves
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. 


PR, Process Startup
When Used:
Acquired exclusive to serialize creation of background or MTS server processes. Id1, Id2 Combination: 0, 0 


PS, Parallel Slave Synchronization
When Used:
Used to control execution flow of parallel slaves for parallel query, parallel index creation, and parallel recovery. Id1, Id2 Combinations: Instance ID, Server ID Instance ID << 16, Server ID 


Q[A-Z], Row Cache
When Used:
Used to keep row cache entries coherent across instances. Row cache entries are caches of recently used data dictionary information. 


RT, Redo Thread
When Used:
Used to detect the death of an instance after a BL lock is found to be invalid. Each is acquired exclusive by the associated process of each instance. If ever they can all be granted for a given set of processes associated with a particular instance, then instance failure can be inferred. Id1, Id2 Combinations: 
Id1 Id2 Meaning thread 0 mount enqueue for that thread thread 1 LGWR thread 2 DBWR thread 3 LCK0 thread 4 LCK1 thread 5 LCK2 thread 6 LCK3 thread 7 LCK4 thread 8 LCK5 thread 9 LCK6 thread 10 LCK7 thread 11 LCK8 thread 12 LCK9 Table E - 8. Id1, Id2 Combinations for RT Lock 


SC, System Change Number
When Used:
The System Change Number (SCN) is used to serialize time within a single instance, and across all instances. This lock resource caches the current value of the SCN. The value is incremented in response to many database events, but most notably COMMIT WORK. Access to the SCN lock value to get and store the SCN is batched on most cluster implementations, so that every process that needs a new SCN gets one and stores a new value back on one instance, before the SCN 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 Combinations: 
Id1 Id2 Meaning 0 0 SCN global lock 0 2 local SCN batching enqueue Table E - 9. Id1, Id2 Combinations for SCN 


SM, SMON
When Used:
Used whenever an SMON process wakes up to see if there is work to do. Acquired when SMON processes are started in null mode, and converted to exclusive and back when checking for work to do--currently every five minutes. Id1, Id2 Combination: Always 0, Always 0 


SN, Sequence Number
When Used:
When using sequence number generators. Id1, Id2 Combination: Always 0, Object Number 


SQ, Sequence Number Enqueue
When Used:
When using sequence number generators. Id1, Id2 Combination: Always 0, Object Number 


ST, Space Management Transaction
When Used:
Used to serialize space transactions across all instances. These are executed within a transaction when space requires allocation or deallocation. Also acquired by SMON or foreground processes when two or more physically adjacent free extents are coalesced back into one extent. Id1, Id2 Combination: Always 0, Always 0 


SV, Sequence Number Value
When Used:
When using sequence number generators. Id1, Id2 Combination: Always 0, Object Number 


TA, Transaction Recovery
When Used:
An SMON process acquires locks exclusive to do instance recovery. LGWR processes hold the locks shared and/or exclusive for in-use/online rollbacks segments. Held exclusive by foreground processes when bringing rollback segments online. Id1, Id2 Combinations: 
Id1 Id2 Meaning 1 undo seg# instance lock on undo segment 2 0 instance lock on instance existence 3 undo seg# instance lock on undo segment 4 0 mutual-exclusive lock starting up 5 0 transaction enqueue Table E - 10. Id1, Id2 Combinations for TA Lock 


TM, DML Enqueue
When Used:
The instance lock is used when an instance attempts to mount the database to ensure that all participating instances either have DML_LOCKS = 0 or DML_LOCKS != 0. If not, ORA-61 is returned and the mount attempt fails. The per table locks are acquired during the execution of a transaction when referencing a table with a DML statement so that the object is not dropped or altered during the execution of the transaction, if and only if the DML_LOCKS parameter is non-zero. Id1, Id2 Combinations: 
Id1 Id2 Meaning 0 0 check if the instances have DML_LOCKS=0 0 object# global lock on table identified by object# Table E - 11. Id1, Id2 Combinations for TM lock 


TS, Temporary Segment (also TableSpace)
When Used:
The two temporary segment locks are used for two different purposes on each temporary segment. The first use is to serialize the "high water mark" or where the highest allocated point of the segment is. The second is used to serialize creation, use, and deletion of a temporary segment. It is acquired by LCKn. The tablespace enqueue is acquired either when dropping that tablespace or when creating a rollback segment in it. The purpose is to avoid deadlocks that can occur on resources in the row cache (dictionary cache). Id1, Id2 Combinations: 
Id1 Id2 Meaning segment dba 0 Serialize access to the high water mark. segment dba 1 Create, use, delete temporary segment. tablespace number 2 Prevent deadlock during CREATE ROLLBACK SEGMENT and CREATE TABLESPACE. Table E - 12. Id1, Id2 Combinations for TS 


TT, Temporary Table
When Used:
Used after recovery of an instance at instance startup to allocate and initialize private and public rollback segments to the instance being started. Acquired exclusive for the duration of the operation. Id1, Id2 Combination: Always 0, Always 0 


TX, Transaction
When Used:
Acquired exclusive when a transaction initiates its first change and held until the transaction does a COMMIT or ROLLBACK. Also acquired exclusive by SMON when doing recovery (undo) of a transaction. Used as a queueing mechanism for processes waiting for something locked by a transaction's change to become available again. Id1, Id2 Combination: Undo Segment Number << 16 | slot, sequence 


UL, User-defined Locks
When Used:
Used in accordance with the client application's use of the DBMS_LOCK package in PL/SQL. Id1, Id2 Combination: Application Dependent, Application Dependent 


UN, User Name
When Used:
During login, locks are acquired shared to ensure that no other process does a DROP USER of that particular user's information in the dictionary. Acquired exclusive during DROP USER. Id1, Id2 Combination: User Number, Always 0 


US, Undo segment, Serialization
When Used:
To serialize DDL on a given undo segment (rollback segment). It serializes the following operations: 
CREATE ROLLBACK SEGMENT
DROP ROLLBACK SEGMENT
ALTER ROLLBACK SEGMENT ONLINE
ALTER ROLLBACK OFFLINE
ALTER ROLLBACK SEGMENT SHRINK
ALTER ROLLBACK SEGMENT STORAGE
Offlining PENDING OFFLINE RBS by SMON
SMON - abortive offline cleanup
STARTUP
Id1, Id2 Combination: Undo Segment#, Always 0 


WL, Being written Redo Log
When Used:
Used to determine whether or not a log file is available for archiving. (It is unavailable if some other process is already archiving it.) Acquired shared to do the test, and acquired exclusive by the process actually doing archiving. Id1, Id2 Combination: Log Number, Always 0 


XA, Instance Attribute Lock
When Used:
Used to store attribute values. Read when a process wants to know a certain attribute of another process. 


XI, Instance Registration 
When Used:
Used to assign unique instance numbers to instances. Also used to notify instances about system reconfigurations (instances coming up or down).

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22818880/viewspace-2077096/,如需转载,请注明出处,否则将追究法律责任。

上一篇: RMAN相关
下一篇: Index Contention等待
请登录后发表评论 登录
全部评论

注册时间:2009-11-03

  • 博文量
    39
  • 访问量
    51903