DBA_2PC_PENDING中的分布式锁-解锁
运行shell脚本后,会生成 roll.sql文件。
只需要运行roll.sql就会解除dba_2pc_pending 中的分布式锁。
注意:根据情况决定shell脚本中是否需要where 条件,比如过滤status 是prepare的,还是其他的,还是全部的。
----------------------shell脚本-------------------------
#!/bin/bash
. /home/oracle/.profile
sqlplus -S / as sysdba < roll.sql
set heading off pagesize 0 echo off linesize 200 feedback off trimspool on
select 'rollback force ''' || LOCAL_TRAN_ID || ''';' || chr(10) ||
'execute DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY(''' || LOCAL_TRAN_ID
|| ''');' || chr(10) || 'commit;' from DBA_2PC_PENDING;
exit;
EOF
set heading off pagesize 0 echo off linesize 200 feedback off trimspool on
select 'rollback force ''' || LOCAL_TRAN_ID || ''';' || chr(10) ||
'execute DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY(''' || LOCAL_TRAN_ID
|| ''');' || chr(10) || 'commit;' from DBA_2PC_PENDING;
exit;
EOF
------------------------上述sh生成的roll.sql文件格式-----------------------
rollback force '1506.7.4851';
execute DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY('1506.7.4851');
commit;
execute DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY('1506.7.4851');
commit;
rollback force '84.4.6215898';
execute DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY('84.4.6215898');
commit;
execute DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY('84.4.6215898');
commit;
标题名称:DBA_2PC_PENDING中的分布式锁-解锁
链接地址:http://pwwzsj.com/article/jjsjig.html