还剩2页未读,继续阅读
文本内容:
闪回19c6orcl2上开启归档L orcl
2、设置闪回区大小、指定路径2alter systemset db_recovery_file_dest_size=14g;alter systemset db_recovery_fiIe_dest=7u01/app/oracle/fast_recovery_area;、切换日志3alter system switch logfile;SQL altersystem switchlogfile;System altered.、开启闪回4alter databaseflashback on;SQL|alter databaseflashback on;Database altered.、开启用户并修改密码5hralter user hr identified by oracle_4u accountunlock;SQL alteruserhridentifiedbyoracle_4u accountunlock;User altered.、以用户链接,建立表并向表内插入数据6hr tltl createtable tla number;insert into tl values1;commit;SQL conn hr/oracle_4u Connected.SQL createtable tla number;Table created.insert into tl valuesCl;1row created.SQL commit;Commit complete.、查询当前的时间7,select to_char sysdate,yyyy-mm-dd:hh24:mi:ss fromdual;sssLLQQQLSQL selectto_charC sysdate,YYYY-MM-DD:HH24:MI:SS fromdual;TO_CHARSYSDATE,YY2023-06-22:10:01:
15、模拟破坏8insert intotl values2;commit;SQL insertintotl values2;1row created.连续插入、、后并提交345SQL inserti ntotlvalues4;1row created.SQL commit;Commit complete.SQL insert1ntotlvalues5;1row created.SQL commit;Commi tcomplete.另开一个窗口,以身份登录并切换日志syssu-oracle.oraenvorcl2sqlplus/as sysdbaaltersystem switchlogfile;SQL altersystemswitch1ogfi1e;System altered.、模拟删除表9tldrop table tl purge;SQL droptabletlpurge;Table dropped.SQLssh2:AES-256-CTR24,624行,80列Linux大写数字select*from tl;这时发现表已经被删除了;tlSQL selectfrom tl;寺select%from tlERRORat line1:ORA-00942:table orvi ewdoes notexistSQL、利用闪回恢复106rman target/list incarnationof database;RMAN list1ncarnati onof database;using targetdatabase controlfile insteadof recoverycatalogList ofDatabase Incarnations0RCL21120854006PARENT1928875ll-JUN-210RCL21120854006PARENT21038542O-JUN-230RCL21120854006CURRENT21057602O-JUN-23DB KeyInc KeyDB NameDB IDSTATUS ResetSCN ResetTimeshutdown immediate;startup mount;SQL shutdown immediate;Database closed.Database dismounted.ORACLE instanceshut down.SQL startupmount;Total SystemGlobal FixedArea2566913256bytesSi ze8899816bytesVari ableSi zeDatabase553648128bytesBuffers RedoBuffers1996488704bytesDatabase mounted.7876608bytesORACLE instance started.、查看闪回的时间,默认是分钟,也就是天1114401show parameterflashback;SQL showparameter flashbackNAMETYPE VALUEdb_f1ashback_retenti on_target integer1440SOL查看闪回日志desc v$flashback_database_log;SQL descv$f1ashback_database_logName NullTypeOLDEST_FLASHBACK_SCN NUMBEROLDEST_FLASHBACK_TIME DATERETENTION_TARGET NUMBERFLASHBACK_SIZE NUMBERESTIMATED_FLASHBACK_SIZE NUMBERCON_ID NUMBERSQL、闪回12,flashback database to timestamp to_timestamp,2023-06-22:10:01:15:yyyy-mm-dd:hh24:mi:ss;SQL flashbackdatabasetotimestampto_timestamp2023-06-22:10:01:15,1YYYY-MM-DD:HH24:MI:SS;Flashback complete.、以只读方式打开数据库并查看闪回时间点是否正确,如果不正确可以重新再做13alter database open read only;connhr/oracle_4u select*from tl;SQL alter database openreadonly;Database altered.SQL connhr/oracle_4U Connected.SQL select*from tl;A1SQL这时看到,表已经恢复tl、换化身14shutdownimmediate;startupmount;alterdatabaseopen resetlogs;SQL shutdownimmediate;Database closed.Database dismounted.ORACLE instanceshut down.SQL startupmount;ORACLE instancestarted.Total SystemG1obal AreaFi xed2566913256bytesSi ze8899816bytesVari ableSi zeDatabase Buffers553648128bytesRedo BuffersDatabase mounted.1996488704bytesSQL alterdatabaseopen7876608bytesreset1ogs;Database altered.SQL。