Script:when transaction will finish rollback

简介:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
-------------------------------------------------------------------------------
--
-- 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
相关文章
|
5月前
The transaction associated with this command is not the connection‘s active
The transaction associated with this command is not the connection‘s active
70 0
|
2月前
|
SQL Oracle 关系型数据库
transaction
"transaction" 是一个计算机科学术语,通常指在计算机系统中执行的操作,以完成特定的任务或操作。在数据库系统中,"transaction" 是指一组操作,这些操作被设计为作为一个单元执行,以确保数据的一致性和完整性。
29 4
|
5月前
|
Java 关系型数据库 MySQL
定时任务Quzrtz:Failed to override connection auto commit/transaction isolation
定时任务Quzrtz:Failed to override connection auto commit/transaction isolation
【异常】svn: E200009: Commit failed (details follow)/both sides of the move must be committed together的解决办法
svn: E200009: Commit failed (details follow)/both sides of the move must be committed together的解决办法
475 0
|
11月前
|
缓存 Oracle 关系型数据库
Oracle中控制commit的三个参数 commit_write, commit_logging和 commit_wait
Oracle中控制commit的动作有三个参数 commit_write, commit_logging和 commit_wait,按重要性分别说明如下
139 0
|
Java 对象存储 Spring
【小家java】Spring事务嵌套引发的血案---Transaction rolled back because it has been marked as rollback-only(上)
【小家java】Spring事务嵌套引发的血案---Transaction rolled back because it has been marked as rollback-only(上)
|
Java Spring
【小家java】Spring事务嵌套引发的血案---Transaction rolled back because it has been marked as rollback-only(下)
【小家java】Spring事务嵌套引发的血案---Transaction rolled back because it has been marked as rollback-only(下)
【小家java】Spring事务嵌套引发的血案---Transaction rolled back because it has been marked as rollback-only(下)
|
开发工具 git
git commit 弹出编辑器后报错: Aborting commit due to empty commit message.
使用终端提交代码 "git commit" 能正常弹出 设置的编辑器,但是直接被空消息提交上来导致无效。 git commit 使用了插件 # git-extras 简化命令 gc == git commit 解决方法: $ git config --global core.editor "subl -w -f" "subl -f" 表示设置默认启动的编辑器,-w表示等待编辑器提交之后, -f 为一个参数 让它不要 fork。
5209 0
|
关系型数据库 Oracle Linux
[20180306]关于DEFERRED ROLLBACK2.txt
[20180306]关于DEFERRED ROLLBACK2.txt --//上午测试DEFERRED ROLLBACK针对表空间offline才有效,我测试回滚一定会写到DEFERRED ROLLBACK段.
975 0
|
Oracle 关系型数据库 测试技术
[20180306]关于DEFERRED ROLLBACK.txt
[20180306]关于DEFERRED ROLLBACK.txt --//在oracle数据库存在一种特殊的ROLLBACK段,叫DEFERRED ROLLBACK.
1060 0