Flashback Database Flash Back

Source: Internet
Author: User
Tags log log

One, Flashback Database description


The Flashback Database function is very similar to the incomplete recovery of RMAN, which can put the entire
The database is rolled back to the state at some point in the past, and this feature relies on the Flashback log log. Than
RMAN is faster and more efficient. So Flashback Database can be seen as an alternative to incomplete recovery
Technology. But it also has some limitations:
(1) Flashback Database cannot resolve Media Failure, this error RMAN recovery still
is the only option.
(2) If you delete a data file or use Shrink technology to reduce the size of the data file, you do not
can use Flashback Database technology back to the state before the change, this time must first use
RMAN takes a backup of the files before or after the deletion to restore, and then uses the Flashback
Database executes the remaining Flashback datbase.
(3) If the control file is recovered from the backup, or is a rebuilt control file, it is not
can use Flashback Database.
(4) The earliest SCN that can be recovered by using the Flashback Database lock depends on the earliest SCN recorded in the Flashback log.


Second, Flashback Database structure


Flashback Database The entire schema includes a process recover Writer (RVWR) background process,
Flashback Database log logs and Flash Recovery area. Once the database is enabled
Flashback Database, the RVWR process will start and the process will be to Flash Recovery area
Write Flashback database log, which includes the "front image of the data block (before
Image) ", which is why Flashback Database technology does not completely recover blocks.


Third, Flashback Database operation Flow:


1. Configure Flash Recovery Area
Sql> Show Parameter Db_recovery_file
Sql> alter system set DB_RECOVERY_FILE_DEST_SIZE=10G Scope=both;


2. The database must already be in archive mode
sql> archive log list;


3. Open Flashback database in Mount state
sql> shutdown immediate;
sql> startup Mount;
Sql> ALTER DATABASE flashback on;
sql> ALTER DATABASE open;
Sql> select flashback_on from V$database;


flashback_on
------------------
YES


4. Querying the current SCN
Sql> SELECT CURRENT_SCN from V$database;


Current_scn
-----------
3450135


5. Query the current time
Sql> Select To_char (sysdate, ' yy-mm-dd hh24:mi:ss ') time from dual;


Time
-----------------
15-03-12 16:40:55


6. Simulating business operations
Sql> CREATE TABLE Flashback as SELECT * from Dba_objects;


Table created.


Sql> commit;


Commit complete.


7. Restart DB to mount
sql> shutdown Immediate
Sql> Startup Mount


8. Perform recovery: Timestamp or SCN
Sql> Flashback database to SCN 3450135;


Flashback complete.


or (choose both)
sql> Flashback Database to timestamp to_timestamp (' 15-03-12 16:40:55 ', ' yy-mm-ddhh24:mi:ss ');


9. Open the Database
sql> ALTER DATABASE open resetlogs;


Description
After executing the Flashback database command, Oracle provides two ways for you to repair your databases:
1). Direct ALTER DATABASE open Resetlogs opens the databases, of course, specifies the SCN or
The data generated after the timestamp time point is lost.
2). Execute the ALTER DATABASE open read Only command, opening the database in Read-only mode.
And then immediately through the way of logical export to the error operation involving the data export table, and then execute recover
Database command to re-apply the redo generated by the database to the flashback
State before the operation, and then re-import the table that was previously mistakenly manipulated by the logical import, so
The impact on existing data is minimal and there is no data loss.


10. Verifying the success of the flashback operation
Sql> select * from Flashback;
SELECT * FROM Flashback
*
ERROR at line 1:
Ora-00942:table or view does not exist


11. Turn off the Flashback database feature
sql> shutdown immediate;
sql> startup Mount;
Sql> ALTER DATABASE flashback off;
sql> ALTER DATABASE open;
Sql> select flashback_on from V$database;


flashback_on
------------------
NO




Add:
--See if the Flashback database feature is enabled
Sql> select flashback_on from V$database;


--Check the flashback time for Flash back support
sql> Select Oldest_flashback_scn os, to_char (Oldest_flashback_time, ' yy-mm-dd hh24:mi:ss ') OT,
Retention_target rt,flashback_size FS, estimated_flashback_size ES
From V$flashback_database_log;


Flashback The earliest time the Database can fall back to, depending on the Flashback of the reservation
Database Log, the view can see a lot of useful information.
Oldest_flashback_scn/oldest_flashback_time: These two columns are used to record the time that can be restored to the earliest
Flashback_size: Records the size of the currently used Flash Recovery area space
Retention_target: System-defined policies
Estimated_flashback_size: Estimated amount of space required based on policy


--View the amount of activity in the flashback database
Sql> alter session set nls_date_format= ' Hh24:mi:ss ';
Sql> select * from V$flashback_database_stat;


This view is used to make finer-grained records and estimates of the Flashback log space situation. This one
View records the amount of activity of a database per unit time in hours
Flashback_data represents Flashback log generation number,
Db_date represents the number of data changes,
Redo_date represents the number of logs,

These 3 quantities reflect the activity characteristics of the data, and more accurately anticipate the space requirements of the Flash Recovery area

Thanks to Dave the great God, have reference to Dave Teacher's notes.

Flashback Database Flash Back

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.