日期:2014-05-16 浏览次数:20460 次
转自:http://2024486.blog.51cto.com/339445/70536???
?有很多原因导致了数据记录的误删,怎样恢复误删的记录呢?先来看看这个概念:
$ sqlplus eygle/eygle SQL*Plus: Release 10.1.0.2.0 - Production on Wed Mar 30 08:52:04 2005 Copyright (c) 1982, 2004, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production With the Partitioning, OLAP and Data Mining options SQL>select count(*) from t1; COUNT(*) ---------- 9318
SQL>delete from t1; 9318 rows deleted. SQL>commit; Commit complete. SQL>select count(*) from t1; COUNT(*) ---------- 0
SQL>select dbms_flashback.get_system_change_number from dual; GET_SYSTEM_CHANGE_NUMBER ------------------------ 10671006 SQL>select count(*) from t1 as of scn 10671000; COUNT(*) ---------- 0 SQL>select count(*) from t1 as of scn 10670000; COUNT(*) ---------- 9318?我们可以看到在10670000这个scn 有9318条记录。
SQL>insert into t1 select * from t1 as of scn 10670000; 9318 rows created. SQL>commit; Commit complete. SQL>select count(*) from t1; COUNT(*) ---------- 9318