从timestamp到SCN的转换函数:
SQL> select timestamp_to_scn(to_timestamp('2007-12-11 09:00:00','YYYY-MM-DD HH24
:MI:SS')) from dual;
TIMESTAMP_TO_SCN(TO_TIMESTAMP('2007-12-1109:00:00','YYYY-MM-DDHH24:MI:SS'))
--------------------------------------------------------------------------
36383520
从SCN到timestap的转换函数:
SQL> select scn_to_timestamp('36383520') from dual;
SCN_TO_TIMESTAMP('36383520')
--------------------------------------------------------------------------
11-12月-07 09.00.00.000000000 上午
注:以上两个函数在使用时受到sys.smon_scn_time的MIN(SCN) 和MAX(SCN)的限制而只能查询到5天以内的数据。
如现在系统改变号为
SQL> select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
36393199
对应的时间是:
SQL> select scn_to_timestamp('36393199') from dual;
SCN_TO_TIMESTAMP('36393199')
---------------------------------------------------------------------------
11-12月-07 11.43.58.000000000 上午
SMON_SCN_TIME表保存的最早改变号:
SQL> select min(scn) from smon_scn_time;
MIN(SCN)
----------
35725371
对应的时间是
SQL> select scn_to_timestamp('35725371') from dual;
SCN_TO_TIMESTAMP('35725371')
---------------------------------------------------------------------------
05-12月-07 05.21.26.000000000 下午
察看当前系统的改变号:
SQL> select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
36391955
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/404722/viewspace-991276/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/404722/viewspace-991276/