您好,登錄后才能下訂單哦!
本篇內(nèi)容介紹了“Oracle閃回?cái)?shù)據(jù)庫測(cè)試方法是什么”的有關(guān)知識(shí),在實(shí)際案例的操作過程中,不少人都會(huì)遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
1 設(shè)置閃回目錄和大小
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 查看時(shí)間
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)建測(cè)試數(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)建閃回點(diǎn)
SQL> create restore point test1; Restore point created.
6 查看閃回點(diǎn)
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 閃回?cái)?shù)據(jù)庫
---test1是之前設(shè)置的閃回點(diǎn)名稱
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ù)庫恢復(fù)到閃回點(diǎn)時(shí)刻
SQL> select count(*) from cjc.test1; COUNT(*) ---------- 87002
11 查看閃回?cái)?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 關(guān)閉閃回,閃回日志自動(dòng)刪除
SQL> alter database flashback off; Database altered. SQL> select flashback_on from v$database; FLASHBACK_ON ------------------ NO [oracle@cjcos01 flashback]$ ls
“Oracle閃回?cái)?shù)據(jù)庫測(cè)試方法是什么”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。