当前位置:数据库 > Oracle >>

oracle flashback查找当前的scn值

oracle flashback查找当前的scn值
 
1.查找当前的scn的值
 
SELECT dbms_flashback.get_system_change_number from dual;
 
假设返回值:140856480
 
2.统计或查看当前scn值的记录
 
SELECT count(*) from qt_exame_ver as of scn 140856480;
SELECT *  from qt_exame_ver as of scn 140856480;
3.统计或查看当前scn值的记录
 
SELECT count(*) from qt_exame_ver as of scn 140856000;
SELECT *  from qt_exame_ver as of scn 140856000;
 
一直找到一个合适的scn值,假设是:140848000
 
4.开启行移动功能,只有开启行移动功能才能对表做闪回
 
alter table qt_exame_ver enable row movement;  
flashback table qt_exame_ver to scn 140848000;  
如不支持闪回表,可以使用手动插入
 
INSERT INTO qt_exame_ver SELECT * from qt_exame_ver as of scn 140848000 where msg_id=18838;
 
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,