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.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
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
---------- ---------- ------------------- ---------- ----------
1 1134916635 2005-12-18 22:37:15 25 65931
1 1134916648 2005-12-18 22:37:28 25 65979
1 1134917029 2005-12-18 22:43:49 25 66224
1 1134917336 2005-12-18 22:48:57 25 66325
1 1134917643 2005-12-18 22:54:04 25 66426
1 1134917950 2005-12-18 22:59:11 25 66527
1 1134918257 2005-12-18 23:04:18 25 66628
1 1134918564 2005-12-18 23:09:25 25 66733
1 1134918871 2005-12-18 23:14:33 25 66836
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.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
19:34:58 SQL> col myscn for 9999999999999999
19:34:58 SQL> variable myscn number;
19:34:58 SQL> create table eygle (c1 number);
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
-----------------
107374274756
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
-----------------
107374274777
19:35:00 SQL> select * from eygle as of scn(:myscn);
select * from eygle as of scn(:myscn)
*
ERROR at line 1:
ORA-01466: unable to read data - table definition has changed
19:41:10 SQL> select * from eygle as of scn(:myscn);
select * from eygle as of scn(:myscn)
*
ERROR at line 1:
ORA-01466: unable to read data - table definition has changed
19:43:03 SQL> select dbms_flashback.get_system_change_number myscn from dual;
MYSCN
-----------------
107374274944
19:43:15 SQL> select * from eygle as of scn 107374274944;
C1
----------
1
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




