- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
3#
发表于 2012-7-23 21:36:35
回复 2# 的帖子
8i service internal 对该参数有很具体的说明:
The requirements of dictionary locking for transactions and, in particular, the
maintenance of a history of lock conversions, is provided by DML locks in
conjunction with TM enqueues. Every transaction holding a DML lock also holds
a TM enqueue lock. The basic locking functionality is provided by the enqueue,
and the DML lock adds the maintenance of the conversion history.
The fixed array of DML lock structures is sized by the DML_LOCKS parameter.
Its free list is protected by the dml lock allocation latch , and the active slots are
visible in V$LOCKED_OBJECT . As with enqueue resources and locks, the
number of slots in the DML locks fixed array is unimportant to performance, as
long as you don't run out of free slots and get an ORA-55 error. Once again,
V$RESOURCE_LIMIT can be used to adjust your setting for DML_LOCKS to
ensure that this does not happen. Each slot only takes on the order of 116 bytes,
so having a generous number of slots is not a problem.
你可以理解DML LOCK为 TM enqueue lock
SQL> show parameter dml_lock
NAME TYPE VALUE
------------------------------------ -------------------------------- ------------------------------
dml_locks integer 748
SQL> select * from v$resource_limit;
RESOURCE_NAME CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_ALLOCATION LIMIT_VALUE
------------------------------ ------------------- --------------- ---------------------------------------- ----------------------------------------
processes 24 27 150 150
sessions 28 31 170 170
enqueue_locks 22 30 2300 2300
enqueue_resources 22 45 968 UNLIMITED
ges_procs 0 0 0 0
ges_ress 0 0 0 UNLIMITED
ges_locks 0 0 0 UNLIMITED
ges_cache_ress 0 0 0 UNLIMITED
ges_reg_msgs 0 0 0 UNLIMITED
ges_big_msgs 0 0 0 UNLIMITED
ges_rsv_msgs 0 0 0 0
gcs_resources 0 0 0 0
gcs_shadows 0 0 0 0
dml_locks 0 50 748 UNLIMITED
temporary_table_locks 0 0 UNLIMITED UNLIMITED
transactions 0 4 187 UNLIMITED
branches 0 0 187 UNLIMITED
cmtcallbk 0 1 187 UNLIMITED
sort_segment_locks 0 1 UNLIMITED UNLIMITED
max_rollback_segments 11 11 187 65535
max_shared_servers 1 1 UNLIMITED UNLIMITED
parallel_max_servers 0 2 40 3600
22 rows selected.
SQL> alter system set dml_locks=0 scope=spfile;
System altered.
SQL> startup force;
ORACLE instance started.
Total System Global Area 1048576000 bytes
Fixed Size 2101544 bytes
Variable Size 738201304 bytes
Database Buffers 301989888 bytes
Redo Buffers 6283264 bytes
Database mounted.
Database opened.
SQL> select * from v$resource_limit;
RESOURCE_NAME CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_ALLOCATION LIMIT_VALUE
------------------------------ ------------------- --------------- ---------------------------------------- ----------------------------------------
processes 24 25 150 150
sessions 26 27 170 170
enqueue_locks 22 28 2300 2300
enqueue_resources 22 22 575 UNLIMITED
ges_procs 0 0 0 0
ges_ress 0 0 0 UNLIMITED
ges_locks 0 0 0 UNLIMITED
ges_cache_ress 0 0 0 UNLIMITED
ges_reg_msgs 0 0 0 UNLIMITED
ges_big_msgs 0 0 0 UNLIMITED
ges_rsv_msgs 0 0 0 0
gcs_resources 0 0 0 0
gcs_shadows 0 0 0 0
dml_locks 0 0 0 UNLIMITED
temporary_table_locks 0 0 UNLIMITED UNLIMITED
transactions 0 4 187 UNLIMITED
branches 0 0 187 UNLIMITED
cmtcallbk 0 1 187 UNLIMITED
sort_segment_locks 0 1 UNLIMITED UNLIMITED
max_rollback_segments 11 11 187 65535
max_shared_servers 1 1 UNLIMITED UNLIMITED
parallel_max_servers 2 2 40 3600
22 rows selected.
当DML_LOCKS=0 意味着不能对表做 LOCK或 DDL操作
SQL> lock table tm_test in exclusive mode;
lock table tm_test in exclusive mode
*
ERROR at line 1:
ORA-00062: DML full-table lock cannot be acquired; DML_LOCKS is 0
SQL> alter table tm_test add t2 int;
alter table tm_test add t2 int
*
ERROR at line 1:
ORA-00062: DML full-table lock cannot be acquired; DML_LOCKS is 0
一般 自动控制的DML_LOCKS参数是足够的, 当然需要视乎你的系统的实际业务和表数目 |
|