Oracle闪回数据库测试方法是什么
本篇内容介绍了“Oracle闪回数据库测试方法是什么”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
1 设置闪回目录和大小
SQL>showparameterrecoverSQL>altersystemsetdb_recovery_file_dest_size=5g;SQL>altersystemsetdb_recovery_file_dest='/fast_recovery';SQL>showparameterrecoverNAMETYPEVALUE-----------------------------------------------------------------------------db_recovery_file_deststring/fast_recoverydb_recovery_file_dest_sizebiginteger5Gdb_unrecoverable_scn_trackingbooleanTRUErecovery_parallelisminteger0
2 启用闪回
SQL>selectflashback_onfromv$database;FLASHBACK_ON------------------NO
SQL>alterdatabaseflashbackon;Databasealtered.SQL>selectflashback_onfromv$database;FLASHBACK_ON------------------YES
3 查看时间
SQL>altersessionsetnls_date_format='yyyy-mm-ddhh34:mi:ss';Sessionaltered.
SQL>selectoldest_flashback_scn,oldest_flashback_timefromv$flashback_database_log;OLDEST_FLASHBACK_SCNOLDEST_FLASHBACK_TI---------------------------------------11144532020-06-2408:30:49
4 创建测试数据
SQL>conncjc/cjcSQL>createtabletest1asselect*fromdba_objects;SQL>selectcount(*)fromtest1;COUNT(*)----------87002
5 创建闪回点
SQL>createrestorepointtest1;Restorepointcreated.
6 查看闪回点
SQL>setline200SQL>coltimefora50SQL>colrestore_point_timefora20SQL>altersessionsetnls_date_format='yyyy-mm-ddhh34:mi:ss';SQL>selectscn,time,restore_point_time,namefromv$restore_point;SCNTIMERESTORE_POINT_TIMENAME--------------------------------------------------------------------------------------------------------------111475624-JUN-2008.36.20.000000000AMTEST1
7 继续插入数据
SQL>hodateWedJun2408:39:31CST2020SQL>insertintotest1select*fromtest1;87002rowscreated.SQL>commit;Commitcomplete.SQL>selectcount(*)fromtest1;COUNT(*)----------174004
8 删除表
SQL>droptabletest1purge;Tabledropped.SQL>selectcount(*)fromcjc.test1;selectcount(*)fromcjc.test1*ERRORatline1:ORA-00942:tableorviewdoesnotexist
9 闪回数据库
---test1是之前设置的闪回点名称
SQL>conn/assysdbaSQL>shutdownimmediateSQL>startupmountSQL>flashbackdatabasetorestorepointtest1;Flashbackcomplete.SQL>alterdatabaseopenresetlogs;
10 查看数据,数据库恢复到闪回点时刻
SQL>selectcount(*)fromcjc.test1;COUNT(*)----------87002
11 查看闪回数据
[oracle@cjcos01flashback]$pwd/fast_recovery/CJCDB01/flashback[oracle@cjcos01flashback]$ll-rthtotal101M-rw-r-----1oracleoinstall51MJun2408:30o1_mf_hh67ow2w_.flb-rw-r-----1oracleoinstall51MJun2408:49o1_mf_hh67osvt_.flb
12 关闭闪回,闪回日志自动删除
SQL>alterdatabaseflashbackoff;Databasealtered.SQL>selectflashback_onfromv$database;FLASHBACK_ON------------------NO[oracle@cjcos01flashback]$ls
“Oracle闪回数据库测试方法是什么”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。