#!/bin/bash
#Author:chipengfei
#Date: 2013-02-23
#Mail: chipengfei@7500.com.cn
#Desc: rollback force the abnormal distribute locks
#Usage: bash rollback_dist_lock.sh
#Date: 2013-02-23
#Mail: chipengfei@7500.com.cn
#Desc: rollback force the abnormal distribute locks
#Usage: bash rollback_dist_lock.sh
. /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;
select 'exit;' from dual;
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;
select 'exit;' from dual;
exit;
EOF
sqlplus -S / as sysdba @roll.sql