Flashback query on the v$transaction

hi All,
if i know the SCN just before the transaction commit, after the transaction is commit, I can use flashback query on the v$transaction to get the info about the transaction, such as undo segment number, used undo block.
Here comes the testcase, i use dbms_lock.sleep(6) because the smon_scn_time is updated every 6 seconds(Note ID: 281510.1)
the problem is that the flashback query on the v$transaction doest not work, no rows return at the last line.
any advice?
sys@SID10G> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE     10.2.0.4.0     Production
TNS for MacOS X Server: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
sys@SID10G> drop table t purge;
Table dropped.
sys@SID10G>
sys@SID10G> create table t as select * from all_objects where rownum <= 1000;
Table created.
sys@SID10G>
sys@SID10G> exec dbms_lock.sleep(6);
PL/SQL procedure successfully completed.
sys@SID10G>
sys@SID10G> update t set object_name = lower(object_name);
1000 rows updated.
sys@SID10G>
sys@SID10G> --save the current scn for later flashback query
sys@SID10G> col scn new_value _scn
sys@SID10G>
sys@SID10G> select dbms_flashback.get_system_change_number scn from dual;
       SCN
   6397848
sys@SID10G>
sys@SID10G> select xidusn, xidslot, xidsqn, used_ublk from v$transaction;
    XIDUSN    XIDSLOT     XIDSQN  USED_UBLK
         8         12       4725          8
sys@SID10G>
sys@SID10G> select dbms_flashback.get_system_change_number scn from dual;
       SCN
   6397848
sys@SID10G>
sys@SID10G> commit;
Commit complete.
sys@SID10G>
sys@SID10G> exec dbms_lock.sleep(6);
PL/SQL procedure successfully completed.
sys@SID10G> select xidusn, xidslot, xidsqn, used_ublk from v$transaction as of scn &_scn;
old   1: select xidusn, xidslot, xidsqn, used_ublk from v$transaction as of scn &_scn
new   1: select xidusn, xidslot, xidsqn, used_ublk from v$transaction as of scn    6397848
no rows selectedEdited by: Sidney Chen on Aug 7, 2011 3:33 PM

Please see,
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17125/adfns_flashback.htm#g1703502
You cannot retrieve past data from a dynamic performance (V$) view. A query on such a view always returns current data.Aman....

Similar Messages

  • Flashback query to view table transactions

    I am on 11g DB and have a requirement to view a set of tables transactional events that occurred every 5-10 minutes. The events for each table must be viewed in the order they occurred. From there a may need to write that information to another table. I was looking to use the flashback quey feature (as I see it is enabled on my DB) to do this. What is the best way to do this with flashback query and are there any performance considerations to consider querying the flashback tables on a regular interval?
    Thanks
    Edited by: bobmagan on Feb 6, 2013 4:43 AM

    Hi,
    refer ,
    http://www.oracle-developer.net/display.php?id=320
    Simply , you can use below query to get records as of desired TS from any table of the database, However oldest timestamp that you can query depends on your UNDO retention
    SELECT count(1) FROM <table_name> AS OF TIMESTAMP to_timestamp('13-MAY-11 19:00:00','DD-MON-YY HH24:MI:SS');Thanks,
    Ajay More
    http://www.moreajays.com

  • Flashback query on the destination

    Hi all,
    I read carefully this doc: http://download.oracle.com/docs/cd/B19306_01/server.102/b14228/man_gen_rep.htm#i1011204 but I cannot reapply captured message after a flashback query.
    Could someone explain me how can I reapply changes from master to the slave after a FB? The scenario is:
    at 00:00 Master = slave = restore point GOOD_DATA
    during the day I replicate the master to the slave
    at 15:00 I use flashbash on the slave to recover the data to the restore point GOOD_DATA
    At this point, what must I do to reapply all changes done on the master since the point GOOD_DATA and how to continue the replication?
    Thanks by advance to save my life ;-)

    Please see,
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17125/adfns_flashback.htm#g1703502
    You cannot retrieve past data from a dynamic performance (V$) view. A query on such a view always returns current data.Aman....

  • Privilege for flashback query

    I am using Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi.
    Documentation says"
    ◦For Flashback Query and Flashback Version Query, grant _FLASHBACK_ and SELECT privileges on specific objects to be accessed during queries or grant the FLASHBACK ANY TABLE privilege to allow queries on all tables. "
    However, I do not see flashback privilege, but I am still able to use flashback query if the table is in same schema.
    All the following select yeields - no rows found.
    select * from user_tab_privs where privilege like '%FLASHBACK%'
    select * from USER_SYS_PRIVS where privilege like '%FLASHBACK%'
    select * from role_tab_privs where privilege like '%FLASHBACK%'
    select * from role_sys_privs where privilege like '%FLASHBACK%'
    What privilege do we need to use flashback query? +Why I am able to use flashback query ( select * from <tablename> as of SCN ...) without the privilege?
    +Note: Flashback_on in V$database table is NO
    Edited by: spur230 on Mar 11, 2011 1:39 PM

    Ganesh Srivatsav wrote:
    Do your research using this
    select * from dict where table_name like '%PRIV%'G.Went through all of them but did not find how schema owner has flashback privilege.

  • [Execute SQL Task] Error: Executing the query failed with error: "The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION."

    I have an package with source , data flow and destination to execute on begin and commit.
    in the below i have just used for questioning purpose with diagram removing my Data Flow task explaining my problem
    on execution, i get error as
    [Execute SQL Task] Error: Executing the query "COMMIT TRAN DimCompanyCode" failed with the following error: "The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.". Possible failure reasons: Problems with the query, "ResultSet"
    property not set correctly, parameters not set correctly, or connection not established correctly.
    as mentioned , i have checked the ResultSet, parameters , connection establish.. all are fine.
    Kindly advice on what has to be done.
    ShanmugaRaj

    To avoid this error, the RetainSameConnection property should set to 'True' for the Connection Manager - Application_DB.
    Narsimha

  • JDBC query in the course of a separate EJB transaction

    Hi all,
    I am implementing a web application that let user upload file and send it to the backend for processing,which involves EJB level transaction(many read+write operations),say transaction L .The processing time may last for 10 minutes. Meanwhile the user can view the history of the files he uploaded and CURRENT STATUS of the file he submitted for processing,we call it file upload history summary (they are from direct JDBC query to the upload history table,say table U in the database,since they are read only data).
    My problem is: the user can not see his LATEST file upload status UNTIL the backend processing transaction is completed,although the row for latest file he just submits in Table U was created during the course of the transaction L by an EntityBean UEJB.
    I am using Jboss server,do u guys have any idea so that I can see the new file status once it's created by the UEJB even before the transaction L is completed?Thanks

    You can achieve this by using JMS and MDB. Because once your file is uploaded, the server is busy in loading the data to the database. So it is not sending you back the response as you are doing a synchronous communication. You have to use Asynchronuous communication to achieve this. This way the client will not wait for the response and the transaction to finish.
    While uploading you a send the file as a message object using JMS and MDB. Let the MDB call the other EJB to load the data to the database. Then you can refresh the status browser automatically in certain periods to retrieve data using other EJB like simple access. The browser will automatically submit itself and get the data from EJB while the other EJB uploading the data to the database.
    Hope this helps. If you are still not clear write again. I will explain it again.
    Thanks
    Amit

  • Flashback Query, Versions and Transactions

    My flashback question pertains to recovering from a deleted row that was committed. To recover the row using flashback would I use flashback query embedded in an UPDATE statement? Or would I query FLASHBACK_TRANSACTION_QUERY to get the undo_sql then take the statement(s) and apply them to restore the row?
    Matt

    If the row was deleted you'd have to insert it.
    ME_XE?delete temp;
    100 rows deleted.
    Elapsed: 00:00:00.04
    ME_XE?insert into temp select * from temp as of timestamp sysdate-1 where col1 = 1;
    1 row created.
    Elapsed: 00:00:00.46
    ME_XE?commit;
    Commit complete.
    Elapsed: 00:00:00.01
    ME_XE?select * from temp;
                  COL1 SOME_DATE
                     1 22-JUL-2008 03 25:17
    1 row selected.
    Elapsed: 00:00:00.00
    ME_XE?Edited by: Tubby on Nov 7, 2008 1:38 PM

  • How to get the procedure/query details for the corresponding transaction id

    Hi,
    Is it possible to know the transaction details like (procedure/query) from the correcponding local transaction ID? (for eg:10.10.50935)
    I am working on ORA-01591 issue (lock held by in-doubt distributed transaction) and got the details of in-doubt transactions from dba_2pc_pending view. Further I would like to get additional details about the procedure name and query who is triggering the issue.
    Thanks

    Hi Sybrand,
    The response is not of much help. Can you please tell me in more detail.
    Suppose a transaction is completed long back (say 5 days ago) and I have a transaction id with me. I would like to know the correcponding procedure/query associated with that transaction id.
    Is it really possible to find out old transaction details from any view?

  • Cancel the query which uses full transaction log file

    Hi,
    We have reindexing job to run every week sunday. During the last run, the transaction log got full and the subsequent transactions to the database got errorred out stating 'Transaction log is full'. I want to restrict the utilization of the log file, that
    is, when the reindexing job reaches the utilization of the log file to a certain threshold automatically the job should get cancelled. Is there any way to get it.

    Hi,
    We have reindexing job to run every week sunday. During the last run, the transaction log got full and the subsequent transactions to the database got errorred out stating 'Transaction log is full'. I want to restrict the utilization of the log file, that
    is, when the reindexing job reaches the utilization of the log file to a certain threshold automatically the job should get cancelled. Is there any way to get it.
    Hello,
    Instead of Putting limit on trn log it would be good to find out cause causing high utilization.Even if you find that your log is growing because of some transaction it would be a blunder to rollback its little easy to do it for Index rebuild but if you
    cancel for some delete operation you would end up in mess.Please don't create a program to delete or kill running operation.
    You can create custom job for alert for trn log file growth.That would be good.
    From 2008 onwards Index rebuild is fully logged so sometimes it causes trn log issue.To solve this either you run index rebuild for specific tables or for selective tables.
    Other option is widely accepted Ola Hallengren script for index rebuild.I suggest you try this
    http://ola.hallengren.com/
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • Why Am I able to view flashback query longer than undo_retention?

    Hi
    this is what I did
    SQL> select sysdate from dual;
    SYSDATE
    2008-11-23 16:55:39
    --to find out the lower transaction end
    SQL> exec :v_lower_timestamp:='2008-11-23 15:55:39';
    --adjust the timestamp to a lower value than will overshot the undo_retention
    SQL> update emp set sal=sal*2 where empno=:v_empno;
    1 row updated.
    SQL> commit;
    Commit complete.
    SQL> select sysdate from dual;
    SYSDATE
    2008-11-23 16:59:14
    SQL> exec :v_upper_timestamp:='2008-11-23 16:59:14';
    SQL> SELECT * FROM emp AS OF TIMESTAMP TO_TIMESTAMP(:v_lower_timestamp, :v_date_ format) WHERE empno=:v_empno;
    EMPNO ENAME JOB MGR HIREDATE SAL
    COMM DEPTNO
    7934 MILLER CLERK 7782 1982-01-23 00:00:00 650
    10
    SQL> SELECT * FROM emp AS OF TIMESTAMP TO_TIMESTAMP(:v_upper_timestamp, :v_date_ format) WHERE empno=:v_empno;
    EMPNO ENAME JOB MGR HIREDATE SAL
    COMM DEPTNO
    7934 MILLER CLERK 7782 1982-01-23 00:00:00 1300
    10
    but when I try to do that for flashback transaction query
    SQL> SELECT versions_startscn, versions_endscn, versions_xid, versions_operation ,
    ename, sal
    FROM emp
    VERSIONS BETWEEN TIMESTAMP
    TO_TIMESTAMP(:v_lower_timestamp, :v_date_format)
    AND TO_TIMESTAMP(:v_upper_timestamp, :v_date_format)
    WHERE empno=:v_empno;
    2 3 4 5 6 7 FROM emp
    ERROR at line 3:
    ORA-30052: invalid lower limit snapshot expression
    --but the moment I raise the lower timestamp limit
    SQL> exec :v_lower_timestamp:='2008-11-23 16:55:39';
    VERSIONS_STARTSCN VERSIONS_ENDSCN VERSIONS_XID V ENAME SAL
    619162 0300250051010000 U MILLER 1300
    619162 MILLER 650
    flashback transaction works, this is understandable.
    but my question is why flashback query does allow the snapshot to be capture even longer than the undo_retention specified by but not flashback version query?
    thanks a lot!

    Select 10 files and open the files, then select and open the next 10 files.

  • Performance Issue with Webi report uses SAP BI Query as the data source

    Hello.
    I have created a Webi ad-hoc report which connects to a SAP BI query through BO OLAP universe.
    The layout of Webi is the exactly the same as the BI query.  There are filters in the Webi to restrict the number of data extraction, but even with data result of 5000 rows, it took about 30 seconds.
    If I execute the BI query with the same filter restriction, it tooks less than 10 seconds.
    It seems that large percentage of time is consumed at the MDX part.
    Is there any tuning method that could speed up the process time of MDX?
    Thank you.
    Justine
    Edited by: Justine Liu on Mar 18, 2009 6:59 AM

    Hi,
    please take a look here:
    [https://service.sap.com/sap/support/notes/1142664] (Look under related notes)
    It includes references to various performance improvements of the MDX interface. From what I saw there it is advisable to upgrade your SAP BI (7.0)  up to at least Support Package 21 (you are currently on SP 15).
    This may also be interesting for you: There is a new Fix Pack 1.4 coming out for BOBJ XI 3.1. Combined with the related SAP Enh.Pack (not sure about the version of this one) should also improve WebI performance. This fix pack is not yet officially released though but it should not take look.
    I recommend that you try the upgrade to Support Package 21 first.
    BTW it is also advisable to take a look in the results of your MDX query (e.g using the MDXTEST transaction). You should make sure that your query is indeed restricted as expected. Sometimes the results you see in SAP native reporting tools (e.g. BEx Analyzer) differ from those returned from the MDX component, depending on the way variables/restrictions where defined in the query designer. It is all about making sure that there is no apples/oranges comparison here.
    Regards,
    Stratos

  • How to get the last transaction in a row in SQL Developer?

    What syntax would I use to get the last transaction of a row in SQL developer?
    The way I have my query set-up currently it is not returning the correct data, here is my current syntax:
    select ssn, max(tran_id), chng_type,tran_id
    from pda_tran
    where ssn = 'xxx-xxx-0011'
    and chng_type = 'C'
    group by ssn, chng_type,tran_id;
    It returns a 'C' chng_type but it is not the last one. when I query on this ssn this is what I get:
    ssn tran_id chng_type
    xxx-xxx-0011 001 A
    xxx-xxx-0011 002 E
    xxx-xxx-0011 003 C
    xxx-xxx-0011 004 S
    xxx-xxx-0011 005 C
    xxx-xxx-0011 006 T
    I only want to return the ssn's with a last transaction chng_type of 'C'. How can I get the correct information returned. Please advise.

    From what I see and read... there is one to many group by
    You wrote
    select ssn, max(tran_id), chng_type,tran_id
    from pda_tran
    where ssn = 'xxx-xxx-0011'
    and chng_type = 'C'
    group by ssn, chng_type,tran_id;
    If you want the max(tran_id), remove it from the "group by"
    select ssn, chng_type, max(tran_id)
    FROM
    (SELECT 'xxx-xxx-0011' ssn, '001' tran_id, 'A' chng_type FROM DUAL UNION
    SELECT 'xxx-xxx-0011' ssn, '002' tran_id, 'E' chng_type FROM DUAL UNION
    SELECT 'xxx-xxx-0011' ssn, '003' tran_id, 'C' chng_type FROM DUAL UNION
    SELECT 'xxx-xxx-0011' ssn, '004' tran_id, 'S' chng_type FROM DUAL UNION
    SELECT 'xxx-xxx-0011' ssn, '005' tran_id, 'C' chng_type FROM DUAL UNION
    SELECT 'xxx-xxx-0011' ssn, '006'tran_id, 'T' chng_type FROM DUAL )
    where ssn = 'xxx-xxx-0011'
    and chng_type = 'C'
    group by ssn, chng_type;

  • Error When Opening the Setup/Transactions/ Sources Window

    Hi All,
    in Oracle E-Business Suite R12 Version
    Error When Opening the Setup/Transactions/ Sources Window
    APP-FND-01388: Cannot read value for profile option FND_DEVELOPER_MODE in routine &ROUTINE.
    ORA-01403: no data found
    FRM-40735: WHEN-CREATE-RECORD trigger raised unhandled exception ORA-06502.

    Amr,
    Please see the suggested solutions in these docs.
    App-Fnd-01388: Cannot Read Value For Profile Option Fnd_developer_mode In Routine [ID 563884.1]
    R12: How To Avoid The Error Message APP-FND-01388 On Drilldown [ID 556668.1]
    R12 APXINWKB Error APP-FND-01388 When Trying To Query Invoice [ID 864195.1]
    APP-FND-01388 Cannot Read Profile Option FND_DEVELOPER_MODE In Benefits Service Center Form [ID 422182.1]
    Thanks,
    Hussein

  • Initial load of small target tables via flashback query?

    A simple question.
    Scenario: I’m currently building a near real time warehouse, streaming some basic facts and dimension tables between two databases. I’m considering building a simple package to "reset" or reinitialize the dimensions an all-round fix for variety of problem scenarios (since they are really small, like 15 000 rows each). The first time I loaded the target tables I utilized data pump with good success, however since streams transforms data on the way a complete reload is somewhat more complex.
    Considered solution: Ill just write a nice flashback query via db-link fetching data from a specific (recent) SCN and then I reinitialize the table on that SCN in streams...
    Is this a good idea? Or is there something obvious like a green and yellow elephant in the gift shop that I overlooked? Why I’m at all worried is because in the manuals this solution is not mention among the supported ways to do the initial load of a target table and I’m thinking there is a reason for this?

    I have a series of streams with some tranformations feeding rather small dimensional tables, I want to make this solution easy to manage even when operations encounter difficult replication issues, so Im developing a PL/SQL package that will:
    1) Stop all streams
    2) Clear all errors
    3) Truncate target tables
    4) Reload them including transformation (using a SELECT AS OF "ANY RECENT SCN" from target to source over dblink)
    5) Using this random recent SCN I will re-instantiate the tables
    6) Start all streams
    As you see datapump even if it works is rather difficult to utilize when you tranform data from A to B, using AS OF I not only get a constant snapshot from the source, I also get the exact SCN for it.
    What do you think? Can I safely use SELECT AS OF SCN instead of datapump with SCN and still get a consisten sollution?
    For the bigger FACT tables im thinking about using the same SELECT AS OF SCN but there with particular recent paritions as targets only and thus not having to reload the whole table.
    Anyways this package would ensure operations that they can recover from any kind of disaster or incomplete recovery on both source and target databases, and just re-instantiate the warehouse within minutes.

  • How to get the date of the last transaction in a mounted standby database?

    Hello,
    Could you tell me how to get the date of the last transaction recorded in a MOUNTED standby database?
    The following query doesn't work...because the database is not open...
    select scn_to_timestamp(current_scn) from v$database;
    Thanks

    Hi,
    You should be able to run the following command in mounted mode on standby database.
    select current_scn from v$database;
    then run the following to convert it to timestamp.
    select scn_to_timestamp(99999999) from dual; *<-- Replace here the SCN value you got above. This needs to be run on the primary database due to standby database in mount mode.*
    Alternatively you can also check at the alert.log file to find the last scn which has been applied.
    Regards
    Edited by: skvaish1 on Jan 19, 2010 11:15 AM

Maybe you are looking for

  • PhotoSmart dont work with Windows 7 ??

    I have the following: HP PSC 1610 All-In-One Printer & a Photosmart M525 Camera and the software that came with it. On the older dell this worked great and but with the new Dell with windows 7 it dont download.  So I cant use the Photosmart system fo

  • ITunes files missing after MacBook Pro software restore

    After my MacBook slowed to a crawl, I decided to restore the system software (OS and Applications) and ended up with much improved responsiveness and performance. I keep my ITunes files on an external hard drive. When the restore was completed, I set

  • [SOLVED] Arch freezes after scanning LVM VGs at boot

    Hi there, recently ArchLinux started printing some udev errors at boot. After an update the system freezes at startup after detecting the LVM volume groups (3 lvm volumes found in volume group "Laptop" or something similar). This is my hard disk conf

  • Schedule Programming (Jobs)

    Hi What is Schedule Programming (Jobs?) How to set the Schedule Programming (Jobs) please give me the detailed program Thanks Mahesh

  • Mighty mouse freezing my system

    I have accidently pressed down on the front of my mouse, near the trackball, and the system has completely frozen. I had to use the power off button to shut down and restart. I have stopped using the Mighty Mouse and gone to a wireless mouse.