Remaining Time of oracle detection rollback

Source: Internet
Author: User

When oracle detects rollback for the remaining time to operate the oracle database, a large transaction needs to be rolled back, which is very slow. It depends on how long it takes to roll back. Find the following SQL statement on the Internet:

select * from v$transaction;

 

But when I run it, return: ORA-00942: The table or view does not exist. It is like this: the view v $ is not visible under a common user, and the conn/as sysdba is just fine. Execute the return statement again: you can find a segment under the unselected row to see how long it will take to roll back.
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_settingsset serveroutput onset feedback offpromptprompt Looking for transactions that are rolling back ...promptdeclare  cursor tx isselect  s.username,  t.xidusn,  t.xidslot,  t.xidsqn,  x.ktuxesizfrom  sys.x$ktuxe  x,  sys.v_$transaction  t,  sys.v_$session  swhere  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_usnnumber;  xid_slot   number;  xid_sqnnumber;  used_ublk1 number;  used_ublk2 number;begin  open tx;  loopfetch tx into user_name, xid_usn, xid_slot, xid_sqn, used_ublk1;exit when tx%notfound;if tx%rowcount = 1then  sys.dbms_lock.sleep(10);end if;select  sum(ktuxesiz)into  used_ublk2from  sys.x$ktuxewhere  inst_id = userenv('Instance') and  ktuxeusn = xid_usn and  ktuxeslt = xid_slot and  ktuxesqn = xid_sqn and  ktuxesta = 'ACTIVE';if used_ublk2 < used_ublk1then  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  thensys.dbms_output.put_line('No transactions appear to be rolling back.');  end if;end;/prompt@restore_sqlplus_settings

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.