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

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.

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

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

  • Using Oracle Flashback Query

    So, this is a very powerfull tool, but useless if you have a 3-tire application and using a persistent connection feature.
    So in most cases you'll have only one Oracle user used to connect. It would be great if the flashback_transaction_query view can be extended with a CLIENT_INFO or CLIENT_IDENTIFIER fields from the session. Hope, this is not too hard to code... This information is VERY usefull in case you have invistigation of who, why and what for had changed some information.

    But want to check if the same concepts works incase of 'TRUNCATE' commandWhy not to check then ?
    SQL> select * from t;
           TID I
             1 A
             1 B
             1 D
             2 A
             2 C
             2 C
             2 B
             3 A
             3 C
             4 A
             4 B
             4 C
             5 A
             6 A
             7 A
    15 rows selected.
    SQL> select DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER from dual;
    GET_SYSTEM_CHANGE_NUMBER
                     5228349
    SQL> truncate table t;
    Table truncated.
    SQL> select * from t as of scn 5228349;
    select * from t as of scn 5228349
    ERROR at line 1:
    ORA-01466: unable to read data - table definition has changedMoreover, the answer is described in the documentation:
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14220/consist.htm#sthref2174
    Flashback Query does not work through DDL operations that modify columns, or drop or truncate tables
    Rgds.

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

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

  • What is a pre query and in what circumstances it is used?

    Please explain what is a pre query in BW mean,and when is it used...thank you for your answers...

    Hi,
    There is also a possibility to feed a variable with replacement path with a query result and use this variable for restriction in another query:
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/579b3c494d8e15e10000000a114084/frameset.htm
    Best regards,
    Eugene

  • A simple query in My SQL what is the similer query for that in Oracle ???

    hello friends
    In My Sql if i have 1000 records in a table and i want to get the records from 400 to 550 then it is posible by giving the following query
    Select * from Table a , table b where condition "List 400,550" gives the records from 400 to 550
    what is the coresponding query for this in oracle database
    any one help me pls
    mail me to [email protected]

    Genericly, if you want records N through M from a SELECT statement, there's a wonderful article on asktom.oracle.com
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:127412348064
    Justin

  • 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

  • If we run a query,what all happens in background/what are phases of query processesing.?

    Hi Friends,
    if we run a query,what all happens in background/what are phases of query processesing.?
    Many thanks
    Shashikala

    It has to go through
    Parsing-on this stage it perform basic check on code (T-SQL,
    Binding(Algebrizer Stage)-on this stage does more parsing and perform query tree,
    Optimize- on this stage take query tree from Binding and parsing and find a better way to return the result that you need so cost might apply here and then
    Execute 
    To know about transaction Log we have to know first how Transaction log file internally works: when you are trying to make change in data as Insert, Update, Delete requests
    from applications using T-SQL or on object explorer, SQL Server will load (load) to the corresponding page data memory where we call this memory area as DATA CACHE.  Then the data in the data cache are changed which is also known as known as DIRTY PAGE.
    Next all changes we made by running query will be recorded in the transaction log file so they called the write-ahead log. At final stage, a process known as CHECK POINT PROCESS will check and write all the transaction has been committed AND completed to your
    hard drive by flushing the page.
    So simply put here are the steps
    Data modification sent by application
    Data pages are located in or read into, cache and modified
    Modification is recorded in transaction log on DISK
    Checkpoint writes committed transactions to database
    I hope this helps a bit in answering your question good luck.

  • What is a Pre-query?

    What is a Pre-query?
    Regards,

    Check if these links help:
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/95/b27f425b595551e10000000a1550b0/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/579b3c494d8e15e10000000a114084/frameset.htm
    Pre-Query

Maybe you are looking for

  • How can I use the Apple remote to view photos on my macbook?

    When I try to use the remote, it launches iTunes and will only control iTunes. I would like to use the remote to do other things on my computer!

  • Microsoft Arc Mouse not working with my Windows Xp home computer

    I bought the MS Arc Mouse yesterday and plugged the USB into my home computer and nothing happened. I didn't get a popup saying "new hardware recognized" or anything and the mouse did not work. I tried the mouse in my mom's laptop and it worked insta

  • Cache connect to any DB

    hi, The cache connect supports only for oracle. Is this a strategic limitation or the cache connect to any db is in the development queue? Coz we find we loose many deals since timesten can't coexist with databases other than oracle. (Its true that t

  • VTFL - control determine export parameter

    Hello, In VTFL for creating billing doc's from deliveries, we are using the copy routine '003' and determine export parameter of 'B'. Now we would like to control this parameter 'B' setting based on the sales org or plant. For example, use setting 'A

  • How to don't display dialog after send data on BPC for Excel?

    Dear experts, I don't want to display dialog after send data on BPC for Excel, how can I do that? OS: MS XP SP2 OFFICE : 2003 BPC : 7.5 NW