本篇內(nèi)容介紹了“Oracle閃回數(shù)據(jù)庫測試方法是什么”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠?qū)W有所成!
目前成都創(chuàng)新互聯(lián)公司已為上1000家的企業(yè)提供了網(wǎng)站建設、域名、虛擬主機、網(wǎng)站托管、服務器租用、企業(yè)網(wǎng)站設計、東方網(wǎng)站維護等服務,公司將堅持客戶導向、應用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長,共同發(fā)展。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 創(chuàng)建測試數(shù)據(jù)
SQL> conn cjc/cjc SQL> create table test1 as select * from dba_objects; SQL> select count(*) from test1; COUNT(*) ---------- 87002
5 創(chuàng)建閃回點
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 繼續(xù)插入數(shù)據(jù)
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 閃回數(shù)據(jù)庫
---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 查看數(shù)據(jù),數(shù)據(jù)庫恢復到閃回點時刻
SQL> select count(*) from cjc.test1; COUNT(*) ---------- 87002
11 查看閃回數(shù)據(jù)
[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閃回數(shù)據(jù)庫測試方法是什么”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關的知識可以關注創(chuàng)新互聯(lián)-成都網(wǎng)站建設公司網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!