Flashback database Operation steps

Source: Internet
Author: User

The flashback database is closed by default.
To enable the flashback Database step:
1. Configure Flash Recovery Area
Check if the Flash recovery area is activated:

SQL>  show parameter db_recovery_file;name TYPE VALUE----------------------------- ------------------------------------------------integer 3912M

2. Start Flashback Database

Sql> shutdownimmediate; The database is closed. The database has been uninstalled. The ORACLE routine has been closed. SQL>The startup Mount;oracle routine has been started. Total System Global Area855982080bytesfixed Size2180544bytesvariable Size587205184bytesDatabaseBuffers260046848Bytesredo Buffers6549504The bytes database is loaded. SQL> Alter DatabaseFlashback on; the database has changed. SQL> Alter Database Open; the database has changed. SQL> Selectflashback_on fromv$Database; flashback_on------------------Yessql>

3. Check if the archive is enabled (must open the archive mode)

SQL>logten SQL >

4. Query the current SCN and current time

Sql> SelectCurrent_scn fromv$Database; CURRENT_SCN-----------1126864SQL> SelectSysdate fromdual; Sysdate-------------- the-October- -SQL> SelectTo_char (Sysdate,'YY-MM-DD HH24:MI:SS') Time fromDUAL; time----------------- --Ten- the  at: +: the

5. Delete the Scott.emp table
sql> drop table bonus;

The table has been deleted.

6. Restart DB to Mount
Flashback database is actually a incomplete restore operation to the database because it needs to shut down the databases reboot to Mount state

 sql>  shutdown   immediate; The database is closed. The database has been uninstalled. The ORACLE routine has been closed. SQL  >   startup Mount;oracle routine has started. Total System Global area  855982080   bytesfixed Size  2180544   bytesvariable Size  587205184   bytes  database  Buffers 260046848   Bytesredo buffers  6549504   bytes the database is loaded. SQL  >  

7. Perform recovery: Two types of timestamp or SCN

SQL>databasetotimestamp to_timestamp ('14-10-15 23:43:15 ','yy-mm-dd HH24:MI:SS'); Flash-back is complete. Or: SQL>databaseto1126864; flash back complete. 

8. Open the Database
After executing the Flashback database command, Oracle provides two ways for you to repair your databases:
1). Directly alter database open Resetlogs opens the databases, of course, the data generated after the specified SCN or timestamp point in time is lost.
2). Perform the ALTER DATABASE open Read Only command, open the database in read-only mode, and immediately use the logical export method to
and table data export, and then execute the Recover database command to reapply the redo generated by the databases to the flashback database operation before
, and then re-import the table that was previously mistakenly manipulated by a logical import so that the impact on existing data is minimal and there is no data loss.
When you open the database using the first method, you can see that the previously deleted Scott.bonus table has been restored.

Sql> Alter Database Openresetlogs; The database has changed. SQL>Conn Scott/Tiger@orcl; already connected. SQL> Select *  fromtab; Tname Tabtype Clusterid------------------------------ ------- ----------bin$xohma3y1rcgfglrwvq8v+G==$0 TABLEBONUSTABLEDEPTTABLEEMPTABLESalgradeTABLESYS_TEMP_FBTTABLE6 rows have been selected. 

Ii. 3 views related to Flashback database
1.v$database
This view can see if the Flashback database feature is enabled
Sql> select flashback_on from V$database;
flashback_on
------------------
YES

2.v$flashback_database_log
The earliest time Flashback database can fall back to, depending on how much of the Flashback database Log is retained, the view can see many 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

Sql> Select * fromV$flashback_database_stat; Begin_time end_time flashback_data db_data redo_data estimated_flashback_size----------- ----------- -------------- ---------- ---------- ------------------------ the/Ten/ the  the/Ten/ - 2269184 4816896 228864 0

3. V$flashback_database_stat
This view is used to make finer-grained records and estimates of the flashback log space situation. This view records the amount of activity of the 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

Sql> Select * fromV$flashback_database_stat; Begin_time end_time flashback_data db_data redo_data estimated_flashback_size----------- ----------- -------------- ---------- ---------- ------------------------ the/Ten/ the  the/Ten/ - 2433024 4849664 396800 0

"from:http://blog.csdn.net/tianlesoftware/article/details/4677378"

Flashback database Operation steps

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.