实用的oracle数据库恢复

前端之家收集整理的这篇文章主要介绍了实用的oracle数据库恢复前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

闪回数据================================================

恢复删除的数据,未删除

select*fromdc_std_codeasoftimestampsysdate-5/1440;

查找数据

select*fromdc_std_codeasoftimestampto_timestamp('2015-09-3016:03:00','YYYY-MM-DDhh24:mi:ss');

恢复数据

insertintodc_std_codeselect*fromdc_std_codeasoftimestampto_timestamp('16:03:00','YYYY-MM-DDhh24:mi:ss');


获取当前数据的svn918515

SELECTCURRENT_SCNFROMV$DATABASE;

查询svn的数据

select*fromdc_std_codeasofscn918515;

恢复数据

insertintodc_std_codeselect*fromAasofscn918515;

闪回数据到某个时间点

alter tableDC_STD_CODEenable row movement

flashback tableDC_STD_CODETO TIMESTAMP to_timestamp('2015-09-3012:00:00','yyyy-mm-dd hh24:mi:ss');



闪回表============================================
查询索引
selectindex_namefromuser_indexeswheretable_name='DC_STD_CODE';
重命名索引
alter index " BIN$3Wv7xMoCTQii0aKtk13Ugg==$1 " rename to t_e_id;



查询回收站
select object_name,original_name,partition_name,type,ts_name,createtime,droptime from recyclebin;

恢复回收站数据 dc_std_code 以下下都能恢复
1. flashbacktabledc_std_codetobeforedrop;
2. flashbacktable" BIN$9J3Ps1ACTruS5eKa4cQR9w==$0 "tobeforedrop;

删除后有创建又删除,给重命名 回收站里面的,按照最后一个被删除的先恢复。
FLASHBACK TABLEdc_std_code TO BEFORE DROP RENAME TOdc_std_code1;
FLASHBACK TABLEdc_std_code TO BEFORE DROP RENAME TOdc_std_code2;

FLASHBACK TABLE "BIN$04LhcpnoanfgMAAAAAANPw==$0" TO BEFORE DROP RENAME TOdc_std_code1;

FLASHBACK TABLE "BIN$04LhcpnqanfgMAAAAAANPw==$0" TO BEFORE DROP RENAME TOdc_std_code2;


在恢复前先执行查询原索引名称
@H_790_301@ SELECT OBJECT_NAME,ORIGINAL_NAME,TYPE

@H_790_301@   FROM USER_RECYCLEBIN

@H_790_301@   WHERE BASE_OBJECT = (SELECT BASE_OBJECT FROM USER_RECYCLEBIN

@H_790_301@   WHERE ORIGINAL_NAME = 'DC_STD_CODE2')

@H_790_301@   AND ORIGINAL_NAME != 'DC_STD_CODE2';

@H_790_301@

@H_790_301@

清理回收站

@H_790_301@ Purgerecyclebin

@H_790_301@

@H_790_301@ 闪回库==============================================================

@H_790_301@ 开启恢复数据库功能

@H_790_301@ SHUTDOWN IMMEDIATE

@H_790_301@ STARTUP MOUNT

查看数据库状态

selectname,current_scn,flashback_onfromv$database;
alterdatabaseflashbackon;
altersystemsetdb_flashback_retention_target=1440scope=both;

alterdatabaSEOpen;

@H_162_404@

@H_162_404@ 数据库恢复

@H_162_404@

shutdownimmediate

startupmount

恢复数据库到某一个时间点

Flashbackdatabasetotimestampto_timestamp('09-10-1414:37:05','yy-mm-ddhh24:mi:ss');

Flashbackdatabasetoscn947921;

alterdatabaSEOpen;

恢复记录日志

alterdatabaSEOpenresetlogs;





shutdown immediate
startup mount
recover database until time '2016-06-30:15:50:00'

alter database open resetlogs
原文链接:https://www.f2er.com/oracle/210120.html

猜你在找的Oracle相关文章