鎖定表操作

2021-06-17 15:16:58 字數 853 閱讀 9648

1.se11鎖物件查詢或者建立鎖物件,形式為e+表名等,如eytsn02,對應產生鎖定函式enqueue_eytvin、解鎖函式equeue_eytvin

2.呼叫函式鎖定表,並進行表操作,操作完成解鎖表

* lock table ytvin

call

function

'enqueue_eytvin'

exporting

mandt          = sy-mandt

exceptions

foreign_lock   = 

1system_failure = 

2others         = 

3.if sy-subrc <> 

0.* table lock error.

message e398(

00) 

with

'資料庫鎖定出錯! 出錯**'

sy-subrc.

endif.

ytvin-field = value.

insert ytvin.

if sy-subrc = 

0.commit

work.

else.

rollback

work.

* record updated fail

message s398(

00) 

with

'記錄更新失敗'.

endif.

* 更新操作完畢, 解鎖

call

function

'dequeue_eytvin'

exporting

mandt = sy-mandt.

解除oracle表鎖定

首先查詢阻塞的使用者 select rule s.username,decode l.type,tm table lock tx row lock null lock level,o.owner,o.object name,o.object type,s.sid,s.serial s.termina...

解決Oracle 表鎖定

select b.owner,b.object name,a.session id,a.locked mode from v locked object a,dba objects b where b.object id a.object id select b.username,b.sid,b.s...

mysql鎖定某個庫 mysql 表鎖定,庫鎖定

今天在解決資料庫同步異常的時候用到了flush tables with read lock 這個命令,於是順便就學習了下鎖表的相關知識。1.flush tables with read lock 這個命令是全域性讀鎖定,執行了命令之後所有庫所有表都被鎖定唯讀。一般都是用在資料庫聯機備份,這個時候資料...