Oracle EBS 加锁解锁程序
Posted jenrry
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle EBS 加锁解锁程序相关的知识,希望对你有一定的参考价值。
FUNCTION request_lock(p_lock_name IN VARCHAR2) RETURN BOOLEAN IS l_lock_name VARCHAR2(128); l_lock_ret INTEGER; l_ret_val BOOLEAN := TRUE; l_lock_handle VARCHAR2(240); BEGIN IF p_lock_name IS NOT NULL THEN --增加数据库锁,以保证一个批次同时只运行一次 l_lock_name := p_lock_name; dbms_lock.allocate_unique(lockname => l_lock_name, lockhandle => l_lock_handle); g_lock_handle := l_lock_handle; --获取数据库锁 l_lock_ret := dbms_lock.request(lockhandle => l_lock_handle, lockmode => 6, timeout => 10, release_on_commit => FALSE); IF l_lock_ret <> 0 THEN --状态不为(成功) l_ret_val := FALSE; END IF; ELSE l_ret_val := FALSE; END IF; cux_conc_utl.log_msg(‘request lock‘); RETURN l_ret_val; END request_lock;
PROCEDURE release_lock(p_lock_name IN VARCHAR2) IS l_lock_name VARCHAR2(128); l_lock_handle VARCHAR2(128); l_lock_ret INTEGER; BEGIN IF g_lock_handle IS NOT NULL THEN l_lock_ret := dbms_lock.release(g_lock_handle); ELSE l_lock_name := p_lock_name; dbms_lock.allocate_unique(lockname => l_lock_name, lockhandle => l_lock_handle); l_lock_ret := dbms_lock.release(l_lock_handle); g_lock_handle := l_lock_handle; END IF; cux_conc_utl.log_msg(‘release_lock: ‘ || l_lock_ret); END release_lock;
以上是关于Oracle EBS 加锁解锁程序的主要内容,如果未能解决你的问题,请参考以下文章
浅谈AQS锁实现机制(含ReentrantReadWriteLock读写锁加锁解锁相关源码分析)
linux C语言 多线程竞争(加锁解锁 pthread_mutex_tpthread_mutex_lock()pthread_mutex_unlock() 可解决)
REDIS10_Redission的入门案例多主案例搭建分布式锁进行加锁解锁底层源码解析
linux C语言 多线程竞争(加锁解锁 pthread_mutex_tpthread_mutex_lock()pthread_mutex_unlock() 可解决)