您好,登錄后才能下訂單哦!
本篇內容介紹了“Oracle閃回數據庫測試方法是什么”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!
1 設置閃回目錄和大小
SQL> show parameter recover SQL> alter system set db_recovery_file_dest_size=5g; SQL> alter system set db_recovery_file_dest='/fast_recovery'; SQL> show parameter recover NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_recovery_file_dest string /fast_recovery db_recovery_file_dest_size big integer 5G db_unrecoverable_scn_tracking boolean TRUE recovery_parallelism integer 0
2 啟用閃回
SQL> select flashback_on from v$database; FLASHBACK_ON ------------------ NO
SQL> alter database flashback on; Database altered. SQL> select flashback_on from v$database; FLASHBACK_ON ------------------ YES
3 查看時間
SQL> alter session set nls_date_format='yyyy-mm-dd hh34:mi:ss'; Session altered.
SQL> select oldest_flashback_scn,oldest_flashback_time from v$flashback_database_log; OLDEST_FLASHBACK_SCN OLDEST_FLASHBACK_TI -------------------- ------------------- 1114453 2020-06-24 08:30:49
4 創建測試數據
SQL> conn cjc/cjc SQL> create table test1 as select * from dba_objects; SQL> select count(*) from test1; COUNT(*) ---------- 87002
5 創建閃回點
SQL> create restore point test1; Restore point created.
6 查看閃回點
SQL> set line 200 SQL> col time for a50 SQL> col restore_point_time for a20 SQL> alter session set nls_date_format='yyyy-mm-dd hh34:mi:ss'; SQL> select scn,time,restore_point_time,name from v$restore_point; SCN TIME RESTORE_POINT_TIME NAME ---------- -------------------------------------------------- -------------------- ------------------------------ 1114756 24-JUN-20 08.36.20.000000000 AM TEST1
7 繼續插入數據
SQL> ho date Wed Jun 24 08:39:31 CST 2020 SQL> insert into test1 select * from test1; 87002 rows created. SQL> commit; Commit complete. SQL> select count(*) from test1; COUNT(*) ---------- 174004
8 刪除表
SQL> drop table test1 purge; Table dropped. SQL> select count(*) from cjc.test1; select count(*) from cjc.test1 * ERROR at line 1: ORA-00942: table or view does not exist
9 閃回數據庫
---test1是之前設置的閃回點名稱
SQL> conn / as sysdba SQL> shutdown immediate SQL> startup mount SQL> flashback database to restore point test1; Flashback complete. SQL> alter database open resetlogs;
10 查看數據,數據庫恢復到閃回點時刻
SQL> select count(*) from cjc.test1; COUNT(*) ---------- 87002
11 查看閃回數據
[oracle@cjcos01 flashback]$ pwd /fast_recovery/CJCDB01/flashback [oracle@cjcos01 flashback]$ ll -rth total 101M -rw-r----- 1 oracle oinstall 51M Jun 24 08:30 o1_mf_hh67ow2w_.flb -rw-r----- 1 oracle oinstall 51M Jun 24 08:49 o1_mf_hh67osvt_.flb
12 關閉閃回,閃回日志自動刪除
SQL> alter database flashback off; Database altered. SQL> select flashback_on from v$database; FLASHBACK_ON ------------------ NO [oracle@cjcos01 flashback]$ ls
“Oracle閃回數據庫測試方法是什么”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。