Fosdccf.blog.chinaunix.net
sdccf
全部博文(19283)
Linux酷软(214)
tmp(0)
PostgreSQL(93)
Solaris(383)
AIX(173)
SCOUNIX(575)
DB2(1005)
Shell(386)
C/C++(1187)
MySQL(1750)
Sybase(465)
Oracle(3695)
Informix(548)
HP-UX(0)
IBM AIX(2)
Sun Solaris(0)
BSD(1)
Linux(8597)
SCO UNIX(23)
2011年(1)
2009年(125)
2008年(19094)
2007年(63)
clifford
linky521
曾德标
fengzhan
leon_yu
mcuflowe
yt200902
guanyuji
GY123456
snow888
carlos94
丸喵喵
sean229
cxunix
可怜的猪
cqxc413
xzzgege
wb123456
分类: Sybase
2008-05-17 22:13:29
如果你在工作中误删除了一部分重要的数据,并且已经提交,当你需要恢复数据的时候,你可以登陆到数据库上仔细查看,如果是Oracle9iR2,你可以首先尝试使用flashback query闪回数据。
◆第一步:确认数据库的SCN变化:
SQL> col fscn for 9999999999999999999 SQL> col nscn for 9999999999999999999 SQL> select name,FIRST_CHANGE# fscn,NEXT_CHANGE# nscn,FIRST_TIME from v $archived_log; ................... NAME FSCN NSCN FIRST_TIME ---------------------------- --------- ------------------- /mwarch/oracle/1_52413.dbf 12929941968 12929942881 2005-06-22 14:38:28 /mwarch/oracle/1_52414.dbf 12929942881 12929943706 2005-06-22 14:38:32 /mwarch/oracle/1_52415.dbf 12929943706 12929944623 2005-06-22 14:38:35 /mwarch/oracle/1_52416.dbf 12929944623 12929945392 2005-06-22 14:38:38 /mwarch/oracle/1_52417.dbf 12929945392 12929945888 2005-06-22 14:38:41 /mwarch/oracle/1_52418.dbf 12929945888 12929945965 2005-06-22 14:38:44 /mwarch/oracle/1_52419.dbf 12929945965 12929948945 2005-06-22 14:38:45 /mwarch/oracle/1_52420.dbf 12929948945 12929949904 2005-06-22 14:46:05 /mwarch/oracle/1_52421.dbf 12929949904 12929950854 2005-06-22 14:46:08 /mwarch/oracle/1_52422.dbf 12929950854 12929951751 2005-06-22 14:46:11 /mwarch/oracle/1_52423.dbf 12929951751 12929952587 2005-06-22 14:46:14 ................... /mwarch/oracle/1_52498.dbf 12930138975 12930139212 2005-06-22 15:55:57 /mwarch/oracle/1_52499.dbf 12930139212 12930139446 2005-06-22 15:55:59 /mwarch/oracle/1_52500.dbf 12930139446 12930139682 2005-06-22 15:56:00 NAME FSCN NSCN FIRST_TIME ------------------------- ------------- ----------- /mwarch/oracle/1_52501.dbf 12930139682 12930139915 2005-06-22 15:56:02 /mwarch/oracle/1_52502.dbf 12930139915 12930140149 2005-06-22 15:56:03 /mwarch/oracle/1_52503.dbf 12930140149 12930140379 2005-06-22 15:56:05 /mwarch/oracle/1_52504.dbf 12930140379 12930140610 2005-06-22 15:56:05 /mwarch/oracle/1_52505.dbf 12930140610 12930140845 2005-06-22 15:56:07 14811 rows selected.
◆此时的SCN为:
SQL> select dbms_flashback. get_system_change_number fscn from dual; FSCN -------------------- 12930142214
◆此时使用用户尝试闪回
SQL> connect username/password Connected.
◆现有的数据:
SQL> select count(*) from hs_passport; COUNT(*) ---------- 851998
◆创建恢复表
SQL> create table hs_passport_recov as select * from hs_passport where 1=0; Table created.
上一篇:SQL Remote的限制
下一篇:使用Flashback Query 恢复误删除的数据(2)
登录 注册