Flashback query

Hi
When i use flashback_transaction_query to retrive undo sql it shows it does not exit. Can anyone guide me.
Imran

Imankhan wrote:
Hi
When i use flashback_transaction_query to retrive undo sql it shows it does not exit. Can anyone guide me.
ImranDear Imran
From which user you query the table and which privileges are granted to the user?

Similar Messages

  • 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.

  • Error in Flashback Query

    while trying to execute flashback query i am getting an error
    CREATE TABLE flashback_query_test (
    id NUMBER(10)
    desc flashback_query_test
    SELECT current_scn, TO_CHAR(SYSTIMESTAMP, 'YYYY-MM-DD HH24:MI:SS') FROM v$database;
    INSERT INTO flashback_query_test (id) VALUES (1)
    COMMIT;
    SELECT COUNT(*) FROM flashback_query_test
    SQL> SELECT COUNT(*)
    2 FROM
    3 flashback_query_test
    4 AS OF
    5 TIMESTAMP TO_TIMESTAMP('2010-02-01 16:58:43', 'YYYY-MM-DD HH24:MI:SS');
    flashback_query_test
    ERROR at line 3:
    ORA-01466: unable to read data - table definition has changed
    pls help me out!................

    The SCN to TIMESTAMP conversion only has a granularity of approximately 3 seconds if I remember correctly. So my guess is that you are getting this error because you are trying to flashback to the same time that the table was created putting you in that 3 second window of SCN to TIMESTAMP ambiguity.
    You can see this ambiguity by using the SCN_TO_TIMESTAMP or TIMESTAMP_TO_SCN functions as shown below:
    SQL> COLUMN TSTAMP NEW_VALUE T;
    SQL> SELECT CURRENT_SCN, TO_CHAR(SYSTIMESTAMP,'YYYY-MM-DD HH24:MI:SS') AS TSTAMP FROM V$DATABASE;
             CURRENT_SCN TSTAMP
           9080346377361 2010-02-01 07:13:12
    SQL> SELECT TIMESTAMP_TO_SCN(TO_TIMESTAMP('&T','YYYY-MM-DD HH24:MI:SS')) FROM DUAL;
    old   1: SELECT TIMESTAMP_TO_SCN(TO_TIMESTAMP('&T','YYYY-MM-DD HH24:MI:SS')) FROM DUAL
    new   1: SELECT TIMESTAMP_TO_SCN(TO_TIMESTAMP('2010-02-01 07:13:12','YYYY-MM-DD HH24:MI:SS')) FROM DUAL
    TIMESTAMP_TO_SCN(TO_TIMESTAMP('2010-02-0107:13:12','YYYY-MM-DDHH24:MI:SS'))
                                                                  9080346377360See how the SCNs are different?
    Now if you allow some time to pass between table creation and INSERT, you should be able to get the results as shown:
    SQL> CREATE TABLE FLASHBACK_QUERY_TEST(id NUMBER(10));
    Table created.
    SQL> EXEC DBMS_LOCK.SLEEP(3);
    PL/SQL procedure successfully completed.
    SQL> COLUMN TSTAMP NEW_VALUE T;
    SQL> SELECT CURRENT_SCN, TO_CHAR(SYSTIMESTAMP,'YYYY-MM-DD HH24:MI:SS') AS TSTAMP FROM V$DATABASE;
             CURRENT_SCN TSTAMP
           9080346377430 2010-02-01 07:15:30
    SQL> INSERT INTO FLASHBACK_QUERY_TEST(ID) VALUES(1);
    1 row created.
    SQL> COMMIT;
    Commit complete.
    SQL> SELECT COUNT(*) FROM FLASHBACK_QUERY_TEST;
                COUNT(*)
                       1
    SQL> SELECT COUNT(*) FROM FLASHBACK_QUERY_TEST AS OF TIMESTAMP TO_TIMESTAMP('&T','YYYY-MM-DD HH24:MI:SS');
    old   1: SELECT COUNT(*) FROM FLASHBACK_QUERY_TEST AS OF TIMESTAMP TO_TIMESTAMP('&T','YYYY-MM-DD HH24:MI:SS')
    new   1: SELECT COUNT(*) FROM FLASHBACK_QUERY_TEST AS OF TIMESTAMP TO_TIMESTAMP('2010-02-01 07:15:30','YYYY-MM-DD HH24:MI:SS')
                COUNT(*)
                       0HTH!

  • Flashback query works, but not flashback versions query

    This is a test database (Oracle10g 10.1.0.5), not in archivelog mode. I deleted one row 2 hours ago. I can still use flashback query:
    select * from tm_instances as of timestamp to_timestamp('STARTTIME_HERE') to view this row. But I can't use the following flashback versions query:
    SELECT versions_startscn, versions_starttime,
    versions_endscn, versions_endtime,
    versions_xid, versions_operation from tm_instances VERSIONS BETWEEN TIMESTAMP to_timestamp('STARTTIME_HERE') and MAXVALUE
    It gave the following error:
    ORA-30052: invalid lower limit snapshot expression
    So I guess flashback query works better than flashback versions query?
    undo_retention is set to 900 by default here.
    Thanks,
    Hai

    currently function returns all mydate rows, i just want mydesired date rowsCheck if there is a column in the table with the same name as the function parameter. It's the most probable reason of such DML operations behaviour in PL/SQL procedures and function.
    Rgds.

  • Flashback query vs. flashback versions query

    I have noticed that I can do a regular flashback query as far back as I have UNDO data available for the query, as long as long as the table definition has not changed. Flashback versions query, however, is limited to the UNDO retention parameter.
    So, for example, if my UNDO_RETENTION parameter is set to the default 900 seconds, I can only go back 15 minutes in time, even if the regular flashback query shows data in the table from 1 hour ago.
    Why does Oracle hold to the the retention parameter for versions query, but let you go back farther for the regular query?

    Flashback query shows 7th Nov value and the next query shows 8th nov value..
    thanks,
    baskar.l

  • 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....

  • 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....

  • Flashback query to get back a old table with data.

    Hi,
    By mistake i drop one table 20 days before so is it possible to get that table back using flashback query.
    if yes , can you give me some idea for that query.
    thanks for your support...

    Hi,
    Flashback is a 10g new Feature. The only solution in your case will be recover the table from a backup. If you have an exp backup just import the table back to the DB, if you have a RMAN backup you can perform an incomplete recovery (point-in-time recovery) to the time just
    before the drop in an auxiliary DB and exp/imp back the table to your DB.
    Cheers,
    Francisco Munoz Alvarez
    http://www.oraclenz.com

  • Flashback Query ORA-01555

    Gurus,
    I'm receiving an ora-01555 error when attempting to run a flashback query. How can I get this resolve as I need to recover records that were deleted!
    SQL> show parameter undo
    NAME TYPE
    VALUE
    undo_management string
    AUTO
    undo_retention integer
    604800
    undo_tablespace string
    UNDOTBS1
    Undo Tablespace is 6GB!
    select count(*) from bld as of timestamp (sysdate-5);
    ORA-01555: snapshot too old: rollback segment number 19 with name "_SYSSMU19_1281712960$" too small
    01555. 00000 - "snapshot too old: rollback segment number %s with name \"%s\" too small"
    *Cause:    rollback records needed by a reader for consistent read are
    overwritten by other writers
    *Action:   If in Automatic Undo Management mode, increase undo_retention
    setting. Otherwise, use larger rollback segments
    All help is greatly appreciated.

    Based on what you have posted you are toast. The data you are trying to read is no longer in the undo tablespace and therefore is unavailable to you.
    Why you might ask? I suspect you would find great value in reading the most current issue of Oracle magazine: Especially Tom Kyte's article where he specifically addresses this issue.
    SQL> select 604800/86400 from dual;
    604800/86400
               7Your undo retention exceeds 5 days ... thus all you have accomplished is to waste disk space.

  • 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

  • Flashback Versions Query vs  Flashback Querya

    Hi,
    When I run the following Flashback Query, it shows that employee number 101 has salary of 17000 at "2009-11-07 11:30:00":
    SQL> SELECT employee_id, department_id, salary FROM employees
    AS OF TIMESTAMP
    TO_TIMESTAMP ('2009-11-07 11:30:00 PM', 'YYYY-MM-DD HH:MI:SS AM')
    WHERE employee_id=101;
    EMPLOYEE_ID DEPARTMENT_ID     SALARY
            101            90      17000However, when I run the following Flashback Versions Query on the same row,
    it doesn't show the row status when the salary was 1700.
    SELECT
    VERSIONS_STARTTIME AS START_TIME,
    VERSIONS_ENDTIME AS END_TIME,
    versions_operation AS OPERATION,
    last_name,
    salary
      FROM EMPLOYEES
      VERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE
      WHERE employee_id = 101;
    START_TIME            END_TIME              O LAST_NAME           SALARY
    08-NOV-09 09.45.59 AM                       U Kochhar              19500
    08-NOV-09 09.45.38 AM 08-NOV-09 09.45.59 AM U Kochhar              19000
                          08-NOV-09 09.45.38 AM   Kochhar              18000
    Why the Flashback Versions Query doesn't display status of the rows retreived by the Flashback Query although both of them depend on the Undo?
    Thanks in advance.

    Flashback query shows 7th Nov value and the next query shows 8th nov value..
    thanks,
    baskar.l

  • Flashback query gives an error

    We're on version 10.1.0.4, having upgraded from 10.1.0.3, and Flashback Query stopped working:
    SQL> create table test_flashback (d date);
    Table created.
    SQL> begin
      2    for i in 1 .. 10
      3    loop
      4      insert into test_flashback values (sysdate);
      5      commit;
      6      dbms_lock.sleep(60);
      7    end loop;
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SQL> select * from test_flashback;
    D
    12-FEB-09
    12-FEB-09
    12-FEB-09
    12-FEB-09
    12-FEB-09
    12-FEB-09
    12-FEB-09
    12-FEB-09
    12-FEB-09
    12-FEB-09
    10 rows selected.
    SQL> alter table test_flashback enable row movement;
    Table altered.
    SQL> select * from test_flashback AS OF TIMESTAMP
      2     TO_TIMESTAMP('2009-02-12 08:29:00', 'YYYY-MM-DD HH:MI:SS');
    select * from test_flashback AS OF TIMESTAMP
    ERROR at line 1:
    ORA-00600: internal error code, arguments: [kdsgrp1], [], [], [], [], [], [], []I looked through METALINK, & while this particular error isn't listed, it does mention that there was a reported problem with using Flashback and "AS OF TIMESTAMP". The solution was to use Flashback with an SCN.
    So, my question is, how do you know which SCN is associated with that particular time frame? When someone says, I dropped a record about an hour ago, could you get it back for me ... how do I get the SCN for "about an hour ago"?
    Thanks,
    Chuck

    Oracle maintains a mapping of SCNs to timestamps with a granularity of a few seconds (the exact number depends on the Oracle release-- I believe in 10.2 it's +/- 3 seconds) automatically, and uses this map to find the closest SCN to the timestamp you specify. That map should be maintained (again automatically) far longer than your 25 hour window.
    If you need something that goes back months or years, it may make sense to save that data off into your own table.
    Justin

  • FLASHBACK QUERY - Range based - Doubt - Help needed -URGENT

    Hi,
    I want to user the flashback query facility to capture the history of versions for a day (i.e) i want to get the data versions from morning 10 a.m to 6.pm.
    How to get the versions by using the time range for a day.
    I used the query as
    select a.eno,
              b.eno,
              a.ename,
              b.ename
    from emp a, emp as of timestamp
    to_timestamp('08-NOV-2006 06:32:21.999999 AM','DD-MON-RRRR HH:MI:SS.ff6 AM') b
    where a.eno=b.eno
    The above query will fetch only one versions for the specified timestamp.
    How could i implement the range based search through flashback query.
    Please suggest any methods to implement the same.
    Thanks in advance.

    You'll want to read the documentation about Oracle Flashback Version Query.<br><br>
    Regards,
    Rob.

  • What is a flashback query

    dear friends,
    they asked me these question in an interview and i dont know the answers.
    can any one help me with this?
    1.what is a flashback query?
    2.list out five major differences between pl/sql functions and procedures?
    3.how to declare a global variable in plsql.
    with regards
    raghu.

    Flashback query:
    http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_flashback.htm#sthref1459
    PL/SQL:
    http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14261/toc.htm

  • 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.

Maybe you are looking for

  • Hp probook 4530s BIOS password recovery

    I forgot my bios password after changing my operating system from windows 7 pro to windows 8.1 64 bit. I would like to change some settings in my laptop though currently lam completely locked out. Please help me out.

  • Standard LOV Customization through CUSTOM.pll HELP

    Hello, I am currently trying to override the LOV dropdown of an Oracle 11.5.10 form using the custom.pll. The example I am using is as follows: procedure event(event_name varchar2) is form_name      varchar2(30) := name_in('system.current_form');    

  • Clearing GR/IR

    whats the Tcode to clear GR/IR with differences?

  • Apache POI  -  xssf und ss missing from package

    Hi Everybody, I have downloaded the Apache POI 3.2 from http://www.apache.org/dyn/closer.cgi/poi/release/ (mid5 checksum says download is complete) and then placed the jars in my classpath variable (under win XP). Then I have tried to run a demo prog

  • Mini Bridge is Gone in CS6 on my machine

    Not just turned off, apparently, but gone completely -- Photoshop is kind enough to tell me it is not installed. I tried restoring the CS6 folders from a backup taken 12 days ago when I know it was working because I actually used it after that point,