First, flash back technology
To enable the database to recover quickly from any logical misoperation, Oracle exits the flash back technology. This technology can restore the data of row-level and transaction-level, reduce the time of data recovery, and the operation is simple, the data can be recovered by SQL statement, and the efficiency of database recovery is greatly improved. Flashback technology is a major advance in the history of database recovery technology, fundamentally changing data recovery.
Flash back technology includes the following:
1) Flashback queries (flashback query): Queries the data information in the table in the past at a certain point in time or at the value of a SCN (System change number).
2) Flash back version query (Flashback version queries): Queries for changes in the data in a table in the past or in a SCN segment.
3) Flashback transaction query (Flashback transaction query): View the changes that a transaction or all transactions have made to the data over time.
4) Flashback Database (Flashback): Restores the database to a previous point in time or an SCN value.
5) Flashback Delete (Flashback drop): Restores the deleted tables and associated objects to their pre-deleted state and works with the Recycle Bin
6) The Flashback table (Flashback table): Restores the table to a previous point in time or to the state of an SCN value.
# #SCN: A number that accumulates incrementally when an Oracle database is updated with automatic maintenance by the DBMS. Each SCN identifies the status of this database.
Specific Flashback Technical table:
Ii. Flash Back Recovery area
Oracle uses the Flashback recovery area as the default location for storing backup and recovery-related files. Essentially the equivalent of storing all copies of the data copy. But his storage will be identified by time-point and SCN, all of which can flash back to the entire database in seconds.
Main files in the Flashback zone:
1) Control file
2) Archive log files
3) Flash back log
4) Automatic backup of control files and SPFile
5) Backup of Rman
6) Backup of data files
Setting and management of the flashback area size
1) Db_recovery_life_dest: Specify the location of the flash back area
2) Db_recovery_file_dest_size: Specify the space of the flash back area
3) Db_flashback_retention_target: Control the time of data retention in the flashback log
Third, the operation
Set up a flashback zone
Shutdown immediate; : Close the database
startup Mount; : Mount Database
ALTER DATABASE Archivelog; : Turn on Archive mode
ALTER DATABASE flashback on; : Turn on the flashback log and change the command to off when off
ALTER DATABASE open; : Open Database
Alter system set db_recovery_life_dest= '/opt/oracle/flashrecovery
Area ' Scope=both;
Alter system set db_recovery_life_dest_size=100g Scope=both;
: Set up Oracle Flash back zone, specify size of 100G
alter system set db_flashback_retention_target=1440;
: Set the time for data retention in s; here 1440s is 1 days.
Use SCN to flash back to database
Shutdown immediate;
startup Mount; : The flash back operation requires the database to operate in Mount State (omitted later)
Flashback database to SCN 782541;
Flash back to the database by time
Alter session set uls_data_format= ' Yyyy-mm-dd HH24:MI:SS ';
Flashback database to timestamp (To_timestamp (' 2018-06-09 14-42-12),
' Yyyy-mm-dd HH24:MI:SS ');
Flash back Table
Flashback table T_name to TIMESTAMP/SCN [enable/disable triggers];
Note [enable/disable triggers]: is optional, whether the trigger is activated
Flash back Delete
Flashback table T_name to before drop [rename to T_name];
Note [rename to T_name]: can be renamed
# #drop table T_name purge; : not put into Recycle Bin after deletion
Flash back Query
SELECT * from T_name as of [Scn/timestamp] where ...
: Query based on SCN status or time status
Oracle's "Recycle Bin"-Flash recovery Zone