SMON_SCN_TIME是Oracle数据库的系统表,用以进行辅助恢复等功能。
在Oracle9iR2中,SMON_SCN_TIME每5分钟被更新一次。
[oracle@jumper oracle]$ sqlplus "/ as sysdba" SQL*Plus: Release 9.2.0.4.0 - Production on Mon Dec 19 18:19:27 2005 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss'; Session altered. SQL> select * from smon_scn_time where rownum <10; THREAD TIME_MP TIME_DP SCN_WRP SCN_BAS 9 rows selected. |
SMON_SCN_TIME记录5天的数据,也就是1440 ((5d x 24h x 12m = 1440) 条记录。
所以在Oracle9iR2中,表属性修改时间和flashback时间差至少应为5分钟。否则就会出现ORA-01466错误。
[oracle@jumper oracle]$ sqlplus eygle/eygle SQL*Plus: Release 9.2.0.4.0 - Production on Mon Dec 19 19:34:53 2005 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
19:34:58 SQL> col myscn for 9999999999999999 Table created. 19:35:00 SQL> exec :myscn := dbms_flashback.get_system_change_number(); PL/SQL procedure successfully completed. 19:35:00 SQL> print myscn; MYSCN 19:35:00 SQL> insert into eygle values(1); 1 row created. 19:35:00 SQL> commit; Commit complete. 19:35:00 SQL> exec :myscn := dbms_flashback.get_system_change_number(); PL/SQL procedure successfully completed. 19:35:00 SQL> print myscn; MYSCN 19:35:00 SQL> select * from eygle as of scn(:myscn); 19:41:10 SQL> select * from eygle as of scn(:myscn); 19:43:03 SQL> select dbms_flashback.get_system_change_number myscn from dual; MYSCN 19:43:15 SQL> select * from eygle as of scn 107374274944; C1 |
此时SMON_SCN_TIME中的信息如下:
19:45:11 SQL> select * from (select * from smon_scn_time order by time_dp desc) where rownum <5; THREAD TIME_MP TIME_DP SCN_WRP SCN_BAS |
在Oracle10g中,SMON_SCN_TIME表每6秒被更新一次。所以这个Flashback时间被缩小为6秒。
[oracle@danaly ~]$ sqlplus eygle/eygle SQL*Plus: Release 10.2.0.1.0 - Production on Mon Dec 19 19:37:19 2005 Copyright (c) 1982, 2005, Oracle. All rights reserved.
19:37:22 SQL> col myscn for 9999999999999999 Table created. 19:37:22 SQL> exec :myscn := dbms_flashback.get_system_change_number(); PL/SQL procedure successfully completed. 19:37:22 SQL> print myscn; MYSCN 19:37:22 SQL> insert into eygle values(1); 1 row created. 19:37:22 SQL> commit; Commit complete. 19:37:22 SQL> exec :myscn := dbms_flashback.get_system_change_number(); PL/SQL procedure successfully completed. 19:37:22 SQL> print myscn; MYSCN 19:37:22 SQL> select * from eygle as of scn(:myscn);
SCN_TO_TIMESTAMP(16011230124) 19:38:50 SQL> select timestamp_to_scn('19-DEC-05 07.37.27.000000000 PM') MYSCN from dual;
MYSCN 19:39:02 SQL> select * from eygle as of scn 16011230125; C1 |
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/77580/viewspace-212710/ ,如需转载,请注明出处,否则将追究法律责任。