Zhuan:Http://space.itpub.net/16128/viewspace-426863
Database:
Banner
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Prod
PL/SQL release 10.2.0.1.0-Production
Core 10.2.0.1.0 Production
TNS for 32-bit windows: Version 10.2.0.1.0-Production
Nlsrtl version 10.2.0.1.0-Production
Experiment process:
SQL> shutdown abort;
The Oracle routine has been disabled.
SQL> startup Mount;
The Oracle routine has been started.
Total system global area 612368384 bytes
Fixed size 1250428 bytes
Variable Size 289409924 bytes
Database buffers 314572800 bytes
Redo buffers 7135232 bytes
The database has been loaded.
SQL> alter database flashback on;
Alter database flashback on
*
Row 3 has an error:
ORA-38706: flashback database event logging cannot be enabled.
ORA-38707: Media recovery is not enabled.
* *** We learned from the experiment that archive log must be enabled when using flashback.
SQL> archive log list
Database Log mode non-archive Mode
Disable automatic archiving
Archiving end point use_db_recovery_file_dest
The earliest online log sequence 30
Current Log sequence 32
SQL> alter database archivelog;
Alter database archivelog
*
Row 3 has an error:
ORA-00265: requires instance recovery and cannot set archivelog Mode
SQL> alter system switch logfile;
Alter system switch logfile
*
Row 3 has an error:
ORA-01109: the database is not open
SQL> recover database;
Media recovery is completed.
* ** When an archive cannot be opened, use the media to restore the archive after mounting.
SQL> alter database open;
The database has been changed.
SQL>
SQL> alter system switch logfile;
The system has been changed.
SQL> alter system switch logfile;
The system has been changed.
SQL> shutdown immediate
The database has been closed.
The database has been detached.
The Oracle routine has been disabled.
SQL> startup Mount
The Oracle routine has been started.
Total system global area 612368384 bytes
Fixed size 1250428 bytes
Variable Size 293604228 bytes
Database buffers 310378496 bytes
Redo buffers 7135232 bytes
The database has been loaded.
SQL> alter database archivelog
2;
The database has been changed.
SQL> alter database open;
The database has been changed.
SQL> shutdown immediate
The database has been closed.
The database has been detached.
The Oracle routine has been disabled.
SQL> startup Mount
The Oracle routine has been started.
Total system global area 612368384 bytes
Fixed size 1250428 bytes
Variable Size 297798532 bytes
Database buffers 306184192 bytes
Redo buffers 7135232 bytes
The database has been loaded.
SQL> alter database flashback on
2;
The database has been changed.
SQL> alter database open;
The database has been changed.
18:06:13 SQL> connect Flash/flash
Connected.
18:07:02 SQL> flashback table t to timestamp to_timestamp ('2017-08-13 17:00:00 ',
'Yyyy-mm-dd hh24: MI: ss ');
Flashback table t to timestamp to_timestamp ('2017-08-13 17:00:00 ', 'yyyy-mm-dd hh
24: MI: ss ')
*
Row 3 has an error:
ORA-08189: Unable to flash back the table because row movement is not enabled
At 18:08:32 SQL> ALTER TABLE t enable row movement;
The table has been changed.
18:09:35 SQL> flashback table t to timestamp to_timestamp ('2017-08-13 17:00:00 ',
'Yyyy-mm-dd hh24: MI: ss ');
Flashback table t to timestamp to_timestamp ('2017-08-13 17:00:00 ', 'yyyy-mm-dd hh
24: MI: ss ')
*
Row 3 has an error:
ORA-01466: unable to read data-table definition changed
18:10:03 SQL> select * from T;
A
----------
Www.ncn.cn
18:10:15 SQL> Delete T;
One row has been deleted.
18:12:10 SQL> commit;
Submitted.
18:12:14 SQL> select * from T;
Unselected row
18:12:21 SQL> flashback table t to timestamp to_timestamp ('2017-08-13 18:12:00'
, 'Yyyy-mm-dd hh24: MI: ss ');
Flash back complete.
18:13:06 SQL> select * from T;
A
----------
Www.ncn.cn
Conclusion: 1. Flashback uses undo to implement flash back.
2. You must enable the database archiving mode.
3. If the archive fails to be implemented, restore the media.
4. You need to enable the row movement function.