« PowerPoint不能输入中文 - 令人抓狂的诡异 | Blog首页 | 10.2.0.4 LGWR Trace Warning: Log Write Time »
工作日志:闪回查询及scn_to_timestamp
作者:eygle | 【转载请注出处】|【云和恩墨 领先的zData数据库一体机 | zCloud PaaS云管平台 | SQM SQL审核平台 | ZDBM 数据库备份一体机】
链接:https://www.eygle.com/archives/2009/11/scn_to_timestamp.html
上周在培训期间,一个客户的数据库出了误UPDATE的问题,修改错了数据,请求我帮忙恢复。链接:https://www.eygle.com/archives/2009/11/scn_to_timestamp.html
闪回查询在这类误操作中非常有用,只要发现的及时,数据可以快速的闪回回来,我想这是开发人员也应该掌握的SQL查询。
记录一下工作日志:
SQL> desc lm_mtrp_syn_channelinfo
Name Null? Type
----------------------------------------- -------- ----------------------------
CHANNELID NUMBER
SGWID VARCHAR2(50)
SERVICETYPE VARCHAR2(50)
SPNUMBER VARCHAR2(50)
CMD VARCHAR2(50)
CREATETIME DATE
MORE VARCHAR2(500)
SQL> select count(*) from lm_mtrp_syn_channelinfo;
COUNT(*)
----------
21
SQL> select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
708677858
SQL> select count(*) from lm_mtrp_syn_channelinfo as of scn 708600000;
COUNT(*)
----------
21
SQL> select count(*) from lm_mtrp_syn_channelinfo as of scn 708000000;
COUNT(*)
----------
21
SQL> select scn_to_timestamp(708000000) from dual;
SCN_TO_TIMESTAMP(708000000)
---------------------------------------------------------------------------
05-NOV-09 01.37.08.000000000 PM
SQL> create table lm_temp as select * from lm_mtrp_syn_channelinfo as of scn 708000000;
Table created.
-The End-
历史上的今天...
>> 2008-11-11文章:
>> 2007-11-11文章:
>> 2005-11-11文章:
By eygle on 2009-11-11 14:28 | Comments (3) | FAQ | 2451 |
nice
有相反的timestamp_to_scn不?
有的,看到了。
不过如果知道了确切的时间直接闪回到需要的时间也可以收到一样的效果啊?
没有体会到他的用途。。。