Database Reference
In-Depth Information
Resource Types
There are two categories of global resource types.
1.
BL resource: BL (Buffer Lock) resources are at the heart of cache fusion processing and
protect buffer cache buffers in the SGA from concurrent modifications by multiple
instances at any given time. Before a buffer of a database block is modified, lock on a BL
resource is acquired in a specific lock mode. GCS layer manages BL resources.
2.
Non-BL resources: Resources such as TX, TM, SQ, etc., are few examples of non-BL
resources. GES layer manages non-BL resources.
There are subtle differences between the implementation of these two types of resources, and I will discuss
non-BL resources in this chapter. BL resource specifics are discussed in Chapter 10.
Let me explain the locking scheme with an example. Consider a table T1 with object_id of 11984883. Before
altering table T1 with a DDL statement, such as dropping a column from the table or locking the table in exclusive
mode, a lock on a TM resource must be acquired. A TM resource is allocated to protect this table T1 and uniquely
represents table T1, as id1 attribute of that resource is set to object_id of the table.
In the following code, table T1 is locked in exclusive mode. A lock structure is visible in gv$lock view with id1
column value set to 11984883. Also, note that locking mode of the resource is set to 6 (exclusive mode). The following
output indicates single-instance locking scheme.
REM First let us lock a small table in exclusive mode.
SQL> LOCK TABLE t1 IN exclusive MODE;
Table locked.
REM Query gv$lock to review single-instance locks.
SQL> SELECT sid, type, id1, id2, lmode, request FROM gv$lock WHERE type='TM';
SID TY ID1 ID2 LMODE REQUEST
---------- -- ---------- ---------- ---------- ----------
4 TM 11984883 0 6 0
In RAC, single-instance resources and locks are globalized as global resources. In Listing 11-2, a global resource
is seen in gv$ges_resource with a resource name [0xb6dff3][0x0],[TM] to protect table T1. This resource_name is
coined using object_id of the table, providing a one-to-one mapping between the resource and the table T1. Resource
name is a string concatenated with three components: [0xb6dff3] is object_id in hexadecimal representation, the
second component [0x0] is not applicable to TM resource type (set to zero), and the third component [TM] is a string
identifying resource type.
Listing 11-2. Resource Name in ges_resource
REM Global resource is created with an unique resource name referring to
REM object_id of the table.
SQL> SELECT inst_id, resource_name, master_node, on_convert_q, on_grant_q
FROM gv$ges_resource WHERE resource_name LIKE '[0xb6dff3]%TM%' ;
INST_ID RESOURCE_NAME MASTER_NODE ON_CONVERT_Q ON_GRANT_Q
---------- ------------------------------ ----------- ------------ ----------
1 [0xb6dff3][0x0],[TM][ext 0x0,0 0 0 1
 
Search WWH ::




Custom Search