Script:when transaction will finish rollback
-------------------------------------------------------------------------------
--
-- Script: rolling_back.sql
-- Purpose: to predict when transactions will finish rolling back
-- For: 9.0+
--
-- Copyright: (c) Ixora Pty Ltd
-- Author: Steve Adams
--
-------------------------------------------------------------------------------
@save_sqlplus_settings set serveroutput on
set feedback off
prompt
prompt Looking for transactions that are rolling back ...
prompt declare
cursor tx is
select
s.username,
t.xidusn,
t.xidslot,
t.xidsqn,
x.ktuxesiz
from
sys.x$ktuxe x,
sys.v_$transaction t,
sys.v_$session s
where
x.inst_id = userenv('Instance') and
x.ktuxesta = 'ACTIVE' and
x.ktuxesiz > 1 and
t.xidusn = x.ktuxeusn and
t.xidslot = x.ktuxeslt and
t.xidsqn = x.ktuxesqn and
s.saddr = t.ses_addr;
user_name varchar2(30);
xid_usn number;
xid_slot number;
xid_sqn number;
used_ublk1 number;
used_ublk2 number;
begin
open tx;
loop
fetch tx into user_name, xid_usn, xid_slot, xid_sqn, used_ublk1;
exit when tx%notfound;
if tx%rowcount = 1
then
sys.dbms_lock.sleep(10);
end if;
select
sum(ktuxesiz)
into
used_ublk2
from
sys.x$ktuxe
where
inst_id = userenv('Instance') and
ktuxeusn = xid_usn and
ktuxeslt = xid_slot and
ktuxesqn = xid_sqn and
ktuxesta = 'ACTIVE';
if used_ublk2 < used_ublk1
then
sys.dbms_output.put_line(
user_name ||
'''s transaction ' ||
xid_usn || '.' ||
xid_slot || '.' ||
xid_sqn ||
' will finish rolling back at approximately ' ||
to_char(
sysdate + used_ublk2 / (used_ublk1 - used_ublk2) / 6 / 60 / 24,
'HH24:MI:SS DD-MON-YYYY'
)
);
end if;
end loop;
if user_name is null
then
sys.dbms_output.put_line('No transactions appear to be rolling back.');
end if;
end;
/ prompt
@restore_sqlplus_settings
Script:when transaction will finish rollback的更多相关文章
- mysql事务,START TRANSACTION, COMMIT和ROLLBACK,SET AUTOCOMMIT语法
http://yulei568.blog.163.com/blog/static/135886720071012444422/ MyISAM不支持 START TRANSACTION | BEGIN ...
- Sqlserver的Transaction做Rollback的时候要小心(转载)
仔细研究了下,发现sql server里面的explicit transaction(显示事务)还是有点复杂的.以下是有些总结: Commit transaction 会提交所有嵌套的transact ...
- The transaction log for database 'xxxx' is full due to 'ACTIVE_TRANSACTION'
今天查看Job的History,发现Job 运行失败,错误信息是:“The transaction log for database 'xxxx' is full due to 'ACTIVE_TRA ...
- Fescar: Fast & Easy Commit And Rollback
Fescar is an easy-to-use, high-performance, java based, open source distributed transaction solution ...
- ApexSQL Log中的Redo Script跟原始SQL不一致问题
最近遇到一个误更新数据的问题,使用ApexSQL Log做挖掘事务日志的时候,发现ApexSQL Log生成的Redo Script跟原始SQL是有区别的.它们并不是完全一致的.只是逻辑上等价而已.如 ...
- [转]oracle中使用set transaction设置事务属性
本文转自:http://yedward.net/?id=24 set transaction语句允许开始一个只读或者只写的事务,建立隔离级别或者是为当前的事务分配一个特定的回滚段.需要注意的是,set ...
- [转]How to nest transactions nicely - "begin transaction" vs "save transaction" and SQL Server
本文转自:http://geekswithblogs.net/bbiales/archive/2012/03/15/how-to-nest-transactions-nicely---quotbegi ...
- mysql_commit() COMMIT ROLLBACK 提交 回滚 连接释放
MySQL :: MySQL 8.0 Reference Manual :: 28.7.7.6 mysql_commit() https://dev.mysql.com/doc/refman/8.0/ ...
- [转]sql server transaction
本文转自: http://www.2cto.com/database/201208/146734.html sql事务(Transaction)用法介绍及回滚实例 事务(Transaction)是 ...
随机推荐
- Chapter 3 Phenomenon——4
My truck seemed to have no problem with the black ice that covered the roads. 看起来我的卡车在结冰的路面上面行驶没什么问题 ...
- Go语言学习笔记九: 指针
Go语言学习笔记九: 指针 指针的概念是当时学C语言时了解的.Go语言的指针感觉与C语言的没啥不同. 指针定义与使用 指针变量是保存内存地址的变量.其他变量保存的是数值,而指针变量保存的是内存地址.这 ...
- python单元测试pytest
1.pytest简介 pytest是Python的一种单元测试框架,与python自带的unittest测试框架类似,但是比unittest框架使用起来更简洁,效率更高. 执行测试过程中可以将某些测试 ...
- python mysql uitl
from traceback import format_exc import pymysql as MySQLdb class MySQLUtils(object): def get_db_conn ...
- HihoCoder - 1478 水陆距离
水陆距离 描述 给定一个N x M的01矩阵,其中1表示陆地,0表示水域.对于每一个位置,求出它距离最近的水域的距离是多少. 矩阵中每个位置与它上下左右相邻的格子距离为1. 输入 第一行包含两个整数, ...
- PTA (Advanced Level) 1027 Colors in Mars
Colors in Mars People in Mars represent the colors in their computers in a similar way as the Earth ...
- C语言理论知识
C语言-----理论部分 一:软件开发概述1.程序语言的发展:机器语言-->汇编语言-->高级语言.2.软件开发的基本步骤与方法:分析问题,建立数学模型-->确定数据结构和算法- ...
- Nginx使用记录
配置常见解释: ########### 每个指令必须有分号结束.################# #user administrator administrators; #配置用户或者组,默认为no ...
- Behave 基础
在你使用behave或其他BDD框架之前, 你应该选择一个断言库. python有很多这方面的第三方库.例如: hamcrest,nose.tools, should-dsl, sure, comp ...
- vb.net的String类型和Bytes转换(C#也适用)
1.Bytes---->StringSystem.Text.Encoding.Unicode.GetString(bytes, 0, bytes.Length) 2.String----> ...