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)是 ...
随机推荐
- free -m内存使用详解
第一部分Mem这行:total -> 内存总数: 32014M=32Gused -> 已经使用的内存数: 7665Mfree -> 空闲的内存数: 24349Mshared -> ...
- CentOS6.5安装php7+nginx+mysql实现安装WordPress
安装php7+nginx参考该博客http://blog.csdn.net/whatday/article/details/50645117 安装php7参考http://blog.csdn.net/ ...
- 1Java开发环境
1 下载 1.1 oracle官方网站 http://www.oracle.com/index.html 1.2 点击DOWNLOADS http://www.oracle.com ...
- NSObject常用方法和反射
// 类的反射 NSString *str = @"Person"; Class class = NSClassFromString(str); Pers ...
- Java代理(二)
前面说到了java的静态代理,这次来看看动态代理. 假设有如下接口和实现方法: package proxy; public interface Subject { public void reques ...
- Maven配置私服仓库
首先就是,最基本的打开maven的配置文件,上面是我自己的习惯,多留一个以备不坏 打开setting配置文件,来修改路径(本人不习惯将所有软件放在C盘,一般都是单独存放盘) 接下来就是公司给你的账户和 ...
- 移动web模拟客户端实现多方框输入密码效果
不知道怎么描述标题,先看截图吧,大致的效果就是一个框输入一位密码. 最开始实现的思路是一个小方框就是一个type为password的input,每输入一位自动跳到下一位,删除一位就自动跳到前一位,an ...
- CSS属性之attr()
attr()准确的说,不应该是一个属性,而是一个CSS的函数,我们先看看MDN上的介绍吧: Summary The attr() CSS function is used to retrieve th ...
- <Android 基础(二十六)> 渐变色圆角Button
简介 总结下之前看的自定义View的内容,结合一个简单的例子,阐述下基本用法和大致的使用流程,这个例子比较简单,更复杂的自定义View,随着自己的学习,后面再慢慢添加.作为一个Android开发者,这 ...
- Spring Boot—17MongoDB
在MongoDB中插入如下的数据 db.baike.insert( { _id: 'freemark', desc: '新一代模板语言', tag: [ 'IT', '模板语言' ], comment ...