欢迎Oracle的朋友们,通过交流和学习,互相进步.我通过这个空间把自己的实践和测试都记录下来,与你们共同分享,请多指教.
We are now ready to take a look at Flashback Database in action.
for example,we will first create a table called test_flashback_tb and load it with some test data.
Follow these steps:
1. Create the table:
SQL> CREATE TABLE test_flashback_tb AS SELECT * FROM emp@orcl;
表已创建。
2. Get a count of the total number of rows
SQL> SELECT COUNT(*) FROM test_flashback_tb ;
COUNT(*)
----------
14
3. Find out the current SCN of the database:
SQL> SELECT current_scn FROM v$database;
CURRENT_SCN
-----------
824930
4. Perform. an INSERT, doubling the number of rows in our persons table
SQL> INSERT INTO test_flashback_tb
2 SELECT * FROM test_flashback_tb;
已创建14行。
SQL> COMMIT;
提交完成。
5. Verify the data insertion as follows:
SQL> SELECT COUNT(*) FROM test_flashback_tb;
COUNT(*)
----------
28
我们的目标是闪回到test_flashback_tb表为14行时的状态:
follow these steps:
1. Shut down the database and start it up again in the mount mode:
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP MOUNT;
2. Issue this command:
SQL> FLASHBACK DATABASE TO SCN 824930;
闪回完成。
3. In order to query the test_flashback_tb table,first open database:
SQL> ALTER DATABASE OPEN RESETLOGS;
4. Verify that the database:
SQL> SELECT COUNT(*) FROM test_flashback_tb ;
COUNT(*)
----------
14
ok!简简单单!
试试看哦!
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/11013567/viewspace-557959/ ,如需转载,请注明出处,否则将追究法律责任。