当前位置:数据库 > 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;
 
Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,