Flashback tables
Can anyone please tell me; what is the difference between Flashback being enabled and Flashback logging? Flashback Logging has something to do with point in time recovery? I tried a flashback (from Enterprise Manager; in 10g), on particular tables, and at the end it told me that "the selected tables ...have been flashed back", but the data warehouse team member tells me the rows are not there. . . .
Additionally, from what I understand, because flashback is enabled, and UNDO_AUTO_RETENTION is set to 900, the limit of flashback is the undo recovery period (for me on the undo advisor graph - 143953 minutes {best possible}, or 5760 {auto tuned}); how do I know how long Flashback may last 'back till'.
If I have to perform a Whole Database Recovery; can I do it for only certain tables to a point in time? Thanks for any help, DW
You should check the Oracle Concept
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14220/high_av.htm#i36677
Overview of Oracle Flashback Features
If a major error occurs, such as a batch job being run twice in succession, the database administrator can request a Flashback operation that quickly recovers the entire database to a previous point in time, eliminating the need to restore backups and do a point-in-time recovery. In addition to Flashback operations at the database level, it is also possible to flash back an entire table. Similarly, the database can recover tables that have been inadvertently dropped by a user.
Oracle Flashback Database lets you quickly bring your database to a prior point in time by undoing all the changes that have taken place since that time. This operation is fast, because you do not need to restore the backups. This in turn results in much less downtime following data corruption or human error.
Oracle Flashback Table lets you quickly recover a table to a point in time in the past without restoring a backup.
Oracle Flashback Drop provides a way to restore accidentally dropped tables.
Oracle Flashback Query lets you view data at a point-in-time in the past. This can be used to view and reconstruct lost data that was deleted or changed by accident. Developers can use this feature to build self-service error correction into their applications, empowering end-users to undo and correct their errors.
Oracle Flashback Version Query uses undo data stored in the database to view the changes to one or more rows along with all the metadata of the changes.
Oracle Flashback Transaction Query lets you examine changes to the database at the transaction level. As a result, you can diagnose problems, perform analysis, and audit transactions.
Similar Messages
-
Situation:
we deleted all rows from table, then alter table <> shrink space, that worked without any errors.
Now we decided to flasback that table to a timestamp before delete happend and of course before shrink too.
Flashback table <> to timestamp....... ended without any errors messages.
BUT only a few rows are now in table. Timestamp definitly has been correctly set to a point before delete happend:
WHAT MISTAKE DID WE MAKE??????
I NEED not to know how to get those rows back i only want to know if anyone has a clue why flashback didn't work correctly.
Tanks to all
Joachim KreimesThere are two table Flashback technologies in Oracle:cFlashback to SCN or Timestamp is Flashback Table using Undo. Flashback to before drop uses the Recyclebin.
The following DDL operations change the structure of a table, so that you cannot subsequently use the TO SCN or TO TIMESTAMP clause to flash the table back to a time preceding the operation: upgrading, moving, or truncating a table; adding a constraint to a table, adding a table to a cluster; modifying or dropping a column; adding, dropping, merging, splitting, coalescing, or truncating a partition or subpartition (with the exception of adding a range partition). -
Hi All,
We are in Oracle 10.2 and have 2 instances.
I am using Flash back feature using the query on instance 1:
flashback table tax to scn 1324411234
Then it throws thse errors:
ORA-00604: error occurred at recursive SQL level 1
ORA-12801: error signaled in parallel query server P000, instance dd20bserver:T1DM2 (2)
ORA-01555: snapshot too old: rollback segment number 3 with name "_SYSSMU3$" too small
I executed the same on instance 2. But then also the same error came.
We have undo tblspace of 5GB which is enough.
How to get rid of these errors?
Thanks,
KishoreWe are in Oracle 10.2 and have 2 instances.Is this a RAC environment? Why do you say these are two instances?
I am using Flash back feature using the query on
instance 1:
flashback table tax to scn 1324411234
When in time is located this scn? Is is relatively recent so undo segment can build up the consistent image it requires?. Check the value of UNDO_RETENTION to verify this.
I executed the same on instance 2. But then also the
same error came.It is valid to execute this query if you are talking about the same database.
~ Madrid -
Flashback questions - particularly flashback table
Hi,
Oracle 10GR2
The docs state that flashback must be turned on in order to enable the functionality. Subsequently, a flashback logfile is started where designated. Now, for flashback table the docs also state that data comes from the UNDO iin order to restore. My first question is: What is kept in the flashback log and how does it fit in (given that the restore is done via UNDO)? The docs also state that if a flashback database is done that you should perform a resetlogs, but nothing is specified with respect to after a flashback table is done. I could see why you wouldn't want to but still wonder about the table that was flashed back and if it is in a vulnerable state.
I'm also interested in understanding the significance of flashback retention time vs undo_retention.
I guess I see some overlap here between the UNDO and FLASHBACK and want to understand the difference.
ThanksKnow that Flashback logs are not the only thing
stored in Flashback Recovery Area. Archived redo logs
and RMAN backups are also stored and they are used
for Flashback Table, Flashback Drop, Flashback
Versions Query, and Flashback Transaction Query
features.Hmm....this is news to me. Are you are sure about this????? Archived logs, backups are stored in the FRA, but it doesn't mean that they are used for Flashback table, Flashback drop, and FBQ or FTQ....
So yes, I would say, you need flashback on to
flashback a table.Again, NO, this is not required. You may like to review the facts associated with these technologies once again.
Thanks
Chandra -
Flashback table not responding
hi,
i am using oracle 10g R2 on linux X86. i have flashback feature set to true. one of my table was accidently truncated.
now i want it back.other tables are brought back with flashback technology.
but this one is generating error that "the table definition has been changed" i dont made any changes to table definition.
what might be the issue? even though i have backup,but still would like to know,and recover it with the help of flashback.
flashback retention target has been set to 900. and table was droped much before that.
plz help
thanks and regards
VDVikrant,
Why would I mind explaining?
Anyways, see below a small code.
SQL> create table aman_t (a number);
Table created.
SQL> desc dba_extents;
Name Null? Type
OWNER VARCHAR2(30)
SEGMENT_NAME VARCHAR2(81)
PARTITION_NAME VARCHAR2(30)
SEGMENT_TYPE VARCHAR2(18)
TABLESPACE_NAME VARCHAR2(30)
EXTENT_ID NUMBER
FILE_ID NUMBER
BLOCK_ID NUMBER
BYTES NUMBER
BLOCKS NUMBER
RELATIVE_FNO NUMBER
SQL> select segment_name,extent_id,blocks from dba_extents where segment_name='AMAN_T';
SEGMENT_NAME
EXTENT_ID BLOCKS
AMAN_T
0 8
SQL> begin
2 for i in 1..10000 loop
3 insert into aman_t values(i);
4 end loop;
5 commit;
6 end;
7 /
PL/SQL procedure successfully completed.
SQL> select segment_name,extent_id,blocks from dba_extents where segment_name='AMAN_T';
SEGMENT_NAME
EXTENT_ID BLOCKS
AMAN_T
0 8
AMAN_T
1 8
AMAN_T
2 8
SQL> commit;
Commit complete.
SQL> exec dbms_stats.gather_table_stats(user,'AMAN_T');
PL/SQL procedure successfully completed.
SQL> select segment_name,extent_id,blocks from dba_extents where segment_name='AMAN_T';
SEGMENT_NAME
EXTENT_ID BLOCKS
AMAN_T
0 8
AMAN_T
1 8
AMAN_T
2 8
SQL> delete from aman_t;
10000 rows deleted.
SQL> exec dbms_stats.gather_table_stats(user,'AMAN_T');
PL/SQL procedure successfully completed.
SQL> select segment_name,extent_id,blocks from dba_extents where segment_name='AMAN_T';
SEGMENT_NAME
EXTENT_ID BLOCKS
AMAN_T
0 8
AMAN_T
1 8
AMAN_T
2 8
SQL> truncate table aman_t;
Table truncated.
SQL> exec dbms_stats.gather_table_stats(user,'AMAN_T');
PL/SQL procedure successfully completed.
SQL> select segment_name,extent_id,blocks from dba_extents where segment_name='AMAN_T';
SEGMENT_NAME
EXTENT_ID BLOCKS
AMAN_T
0 8
SQL>You should be able to see that when I issued a delete command, the number of allocated extents are the same.Which does mean that though the blocks are empty but the HWM is still pointing towards those blocks.I gathered stats just to ensure that you won't come back and say that aafter gathering them,things would be different.
When I gave truncate, you can see that oracle came back to the initially allocated first extent only. This is table definition change and this did happen with my last demo and with your original scenerio as well.
Now just to confuse you a little more, even gathering of stats would be called as definition change. See below,
SQL> drop table aman_t purge;
Table dropped.
SQL> create table amna_t( a char);
Table created.
SQL> exec dbms_stats.gather_table_stats(user,'AMNA_T');
PL/SQL procedure successfully completed.
SQL> alter table amna_t enable row movement;
Table altered.
SQL> flashback table amna_T to timestamp(sysdate - 1/24/60);
flashback table amna_T to timestamp(sysdate - 1/24/60)
ERROR at line 1:
ORA-01466: unable to read data - table definition has changed
SQL>So I hope you should be clear now that you can't get back the data with Flashback as this relies over the Undo data and can only get back the logical changes , not the structural changes over the object.
HTH
Aman.... -
Dear Members,
I am doing FLASHBACK TABLE as sys user. I know that FLASHBACK TABLE can not be used for user SYS ,
still I successfully execute this command with to before drop clouse and
when i execute this command with to timestamp clouse , I get error.
Can some one please tell me why this is happening ?
ORACLE : 11gR2
OS : FEDORA 14
$ sqlplus / as sysdba
SQL> insert into t11 values('k');
1 row created.
SQL> !date;
Wed May 30 15:45:13 IST 2012
SQL> insert into t11 values('z');
1 row created.
SQL> drop table t11;
Table dropped.
SQL> select * from dba_recyclebin;
OWNER OBJECT_NAME ORIGINAL_NAME OPERATION TYPE TS_NAME CREATETIME DROPTIME DROPSCN PARTITION_NAME CAN CAN RELATED BASE_OBJECT PURGE_OBJECT SPACE
SYS BIN$wT5v1Gw96zbgQGSsOaoM4g==$0 T11 DROP TABLE NISHANT 2012-05-30:14:47:37 2012-05-30:15:45:36 17728226 YES YES 85115 85115 85115 8
SQL> flashback table "BIN$wT5v1Gw96zbgQGSsOaoM4g==$0" to timestamp to_time('30/05/2012 15:45:13','dd/mm/yyyy hh24:mi:ss');
flashback table "BIN$wT5v1Gw96zbgQGSsOaoM4g==$0" to timestamp to_time('30/05/2012 15:45:13','dd/mm/yyyy hh24:mi:ss')
ERROR at line 1:
ORA-08185: Flashback not supported for user SYS
SQL> flashback table "BIN$wT5v1Gw96zbgQGSsOaoM4g==$0" to before drop;
Flashback complete.Hi,
As far as i know, recyclebin doesn't work for SYS schema. The same i have tested on my 11.2.0.3 test database -
18:12:22 SQL> select * from dba_recyclebin;
no rows selected
18:12:23 SQL> show user
USER is "SYS"
18:12:27 SQL>
18:12:28 SQL> create table a (x number);
Table created.
18:12:35 SQL> insert into a values (1);
1 row created.
18:12:36 SQL> insert into a values (2);
1 row created.
18:12:36 SQL> insert into a values (3);
1 row created.
18:12:37 SQL> select * from a;
X
1
2
3
18:12:38 SQL> commit;
Commit complete.
18:12:39 SQL> drop table a;
Table dropped.
18:12:46 SQL> select * from recyclebin;
no rows selected
18:12:48 SQL> select * from dba_recyclebin;
no rows selected
18:13:00 SQL>Can you please check back again.
Edited by: Anand.. on May 30, 2012 6:19 PM --> Update --> It was my mistake, didn;t check the ts_name column. The object is created in non-system tablespace. -
All dependent objects are retrieved when you perform a Flashback Drop, just as the objects are all added to the Recycle Bin when the base table is dropped.
Emp is dependent on dept table , here i go
SQL> drop table dept cascade constraints
2 /
Table dropped.
SQL> flashback table dept to before drop
2 /
Flashback complete.
SQL> select * from dept
2 /
DEPTNO DNAME LOC
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL> insert into emp values (7935,'JERRY','DBA',7782,sysdate,8000,null,50)
2 /
1 row created.Above insertion is not validating its parent key why? I dropped the dept table and then flashbacked.The PK should also be flashbacked and it is..
SQL> alter table dept add primary key (deptno)
2 /
alter table dept add primary key (deptno)
ERROR at line 1:
ORA-02260: table can have only one primary keySo whats wrong , dropping and flashbacking parent table can cause to dependent table references?
SQL> alter table emp add foreign key (deptno) references dept
2 /
alter table emp add foreign key (deptno) references dept
ERROR at line 1:
ORA-02298: cannot validate (SCOTT.SYS_C005461) - parent keys not foundFlashingback to parentes table mess up the PK and FK.This is expected behaviour. Your CASCADE CONSTRAINTS dropped the constraint on EMP before dropping the table DEPT. They are implemented as separate operations, and the drop of the constraint is not protected by flashback. Then dropping DEPT renamed the table and all its dependent objects including the primary key (remember what is going on here: from 10.x, DROP is re-implemented as a RENAME), and the flashback recovered them.
If you think about it, this is good behaviour: it would be absurd to have a constraint based on a relationship with a dropped table. -
Flashback table does not work in 10.2?
I thought that you can undo a drop and recover any table with FLASHBACK TABLE feature which comes with 10.2 by default (i.e. not special setting up is required). But I get this error when I try to do it.
ORA-00439: feature not enabled: Flashback Table
I used FLASHBACK TABLE <table name> BEFORE DROP;Ahmer Mansoor wrote:
Dear Channa,
Please make sure that the parameter recyclebin is on, if not then do the following.
SQL> ALTER SYSTEM SET RECYCLEBIN=ON SCOPE=BOTH;
Well, you must check before posting a statement that whether its working or not. Your reply is actually wrong in every manner. First, the parameter is a static parameter and can't be changed by the option BOTH. It has to be spfile and will be requiring a restart of the db. Please see below,
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> alter system set recyclebin=off;
alter system set recyclebin=off
ERROR at line 1:
ORA-02096: specified initialization parameter is not modifiable with this
option
SQL> alter system set recyclebin=off scope=both;
alter system set recyclebin=off scope=both
ERROR at line 1:
ORA-02096: specified initialization parameter is not modifiable with this
option
SQL> alter system set recyclebin=off scope=spfile;
System altered.
SQL> startup force
ORACLE instance started.
Total System Global Area 263639040 bytes
Fixed Size 1373964 bytes
Variable Size 205523188 bytes
Database Buffers 50331648 bytes
Redo Buffers 6410240 bytes
Database mounted.
Database opened.
SQL> show parameter recyclebin
NAME TYPE VALUE
recyclebin string OFF
SQL>Second, there is no relation between the parameter's value being OFF/On and the message that the OP is receiving. If the parameter is set to OFF, this would be the message,
SQL> conn aman/aman
Connected.
SQL> create table test_tab(a number);
Table created.
SQL> drop table test_tab;
Table dropped.
SQL> flashback table test_tab to before drop;
flashback table test_tab to before drop
ERROR at line 1:
ORA-38305: object not in RECYCLE BIN
SQL> show parameter recyclebin
NAME TYPE VALUE
recyclebin string OFF
SQL> select * from V$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL>HTH
Aman.... -
Oracle 10 OEM, flashback table
Hi:
This is my first time to do the flashback table in OEM. I had updated wrong information to the table now I want to flashback. I did the first step of 7 steps which is pick a table. Now I don't understand what I should do for 'Choose Columns' and 'Blind the Row Value'. Would some one help me?
Many thanks in advance.QAQA wrote:
Hi:
This is my first time to do the flashback table in OEM. I had updated wrong information to the table now I want to flashback. I did the first step of 7 steps which is pick a table. Now I don't understand what I should do for 'Choose Columns' and 'Blind the Row Value'. Would some one help me?I never used EM for the flashback of a table as likementioned by another poster. I use the Flashback command from the sql prompt. I just tried to the flashback of a table using EM for your question based on SCN and time. I was not asked anything that you have mentioned. All I did was , choose the table, pick the Flashback Table option, chose SCN based flasback ( the same happened with time also) , and I was at the submit button to submit it. That's all! From where you are getting these options?
HTH
Aman.... -
Hi all,
I've got a new database 11G, I've not used flashback before, but my retention time is a day...I have a time that the developer did a massive update to a table to corrupt it.
How do I find the SCN for that time so I can attempt to flashback that table?
Thank you,
cayenneThank you..I also found this works:
SQL> select timestamp_to_scn(to_timestamp('20140103152000','YYYYMMDDHH24MISS')) scn from dual;
SCN
98344246
Well that might NOT work all of the time. But that is just what Oracle does when you give it a timestamp to flashback to: it converts the timestamp to an SCN and then restores data based on that SCN.
See Flashback Table in the SQL Language doc
http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_9012.htm
TO TIMESTAMP Clause
Specify a timestamp value corresponding to the point in time to which you want to return the table. The expr must evaluate to a valid timestamp in the past. The table will be flashed back to a time within approximately 3 seconds of the specified timestamp.
That 'approximately 3 seconds' accuracy is due to that conversion to SCN - Oracle uses its internal table.
SCN is accurate if you know it but you usually don't.
Read, and heed, these warnings in the advanced app dev guide
http://docs.oracle.com/cd/B28359_01/appdev.111/b28424/adfns_flashback.htm
Guidelines for Oracle Flashback Query
If a possible 3-second error (maximum) is important to Oracle Flashback Query in your application, use an SCN instead of a timestamp. See General Guidelines for Oracle Flashback Technology.
General Guidelines for Oracle Flashback Table
To query past data at a precise time, use an SCN. If you use a timestamp, the actual time queried might be up to 3 seconds earlier than the time you specify. Oracle Database uses SCNs internally and maps them to timestamps at a granularity of 3 seconds.
For example, suppose that the SCN values 1000 and 1005 are mapped to the timestamps 8:41 AM and 8:46 AM, respectively. A query for a time between 8:41:00 and 8:45:59 AM is mapped to SCN 1000; an Oracle Flashback Query for 8:46 AM is mapped to SCN 1005.
Due to this time-to-SCN mapping, if you specify a time that is slightly after a DDL operation (such as a table creation) Oracle Database might use an SCN that is just before the DDL operation, causing error ORA-1466. -
i want to implement flashback table.
for doing this i have tried with the following:
alter system set undo_retention=90000 scope=both;
ALTER TABLESPACE UNDOTBS1 RETENTION GUARANTEE;
FLASHBACK TABLE test TO TIMESTAMP (NOV-05-2006, 12:04:00);
it returns:
SQL> FLASHBACK TABLE test TO TIMESTAMP (NOV-05-2006, 12:04:00);
SP2-0552: Bind variable "04" not declared.
what is the problem?
thanks.try this
sql>alter session set nls_date_format = 'dd-mon-yyyy hh24:mi:ss'; -
If you flashback a table that has associated foreign key constraints with other tables, will Oracle flaskback all associated tables as well or will it give an error?
The foreign key constraints in another table won't flashback.
There are two situations:
1) drop a child table. and when doing flashback the constraint is gone.
2) drop a parent table (with cascade cosntraint) and the referential integrity is gone with doing flashback. However, the child table will be retrieved from recyclebin
Regards,
Amir -
Duplicate Entries in Flashback Table when queried using as of timestamp
Hi All,
Oracle Version : Oracle Server - Enterprise Edition 11.1.0.7
OS: HP-UX PA-RISC (64-bit)
We have a table name DIRECTORY_LISTING_GROUP with HEADER_KEY as primary key.
So when i query like this
SELECT * FROM DIRECTORY_LISTING_GROUP AS OF TIMESTAMP TO_TIMESTAMP('05-NOV-12 10:00:00','DD-MON-YY HH24:MI:SS') WHERE HEADER_KEY=#
Ideally i should get only one row but i m getting two rows which are exactly the same.
Please advicePeter vd Zwan wrote:
Hi,
Maybe it is a primary key now but are you sure it was a primary key at 05-NOV-12 10:00:00 ?If it was not primary key at 05-NOV-12 10:00:00, and now it is,
which implies primary key constraint was added using ALTER TABLE command.
But using ALTER TABLE command would invalidate the undo data for that table. And using the flashback query would generate exception something like "table definition has changed". -
11g Express Edition Wishlist - Flashback Table
After this thread - Oracle Database 11g XE
and referencing the Express Edition Licensing Information guide - http://download.oracle.com/docs/cd/B25329_01/doc/license.102/b25456/toc.htm
if this one is also on your wish list, just send a reply and support this thread.
Best regards.+1
-
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 AMHi,
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
Maybe you are looking for
-
When I attempt to open my trial version of Adobe Illustrator CC I get an appcrash error. I have the diagnostics. Any thoughts?
-
Hi all, I am Trying to do file to RFC Scenario where i have to post multiple invoices in a single bapi. I am using proxy in my scenario In such case can i do multi mapping and post the data to R/3 could you please suggest. Thanks in advance
-
I have been using MacTowerG4 (PowerPC) and started having problems (some we pages cannot be opned becuase I do not have an updated version of plug-in). I am thinking to purchse a replacement. Candidates are mini or iMac. Becuase I have a Cinema Di
-
Can't read old mail after new Tiger install
I recently installed Tiger (and archived my old system) as an upgrade from 10.3.9. Since then, I can't read old messages in Mail. The original messages are deleted from my isp server once the messages are downloaded by Mail. When I open any message i
-
Hi, In BASIS, i know the t-codes for user-administration. Please tell me, how to use the t-codes after entering into that. and also tell me all details about User admin..