1.在Oracle9i及以上版本中
可以使用dbms_flashback.get_system_change_number来获得
SQL> select dbms_flashback.get_system_change_number from dual; GET_SYSTEM_CHANGE_NUMBER |
2.在Oracle9i之前
可以通过查询x$ktuxe获得最接近当前系统scn值
X$KTUXE-------------[K]ernel [T]ransaction [U]ndo Transa[x]tion [E]ntry (table)
SQL> select max(ktuxescnw*power(2,32)+ktuxescnb) from x$ktuxe; MAX(KTUXESCNW*POWER(2,32)+KTUXESCNB) |
3.通过oradebug获取
以前在l2g32003的站点上看到使用oradebug获取SCN的方法,转引在这里:
[oracle@neirong oracle]$ sqlplus "/ as sysdba" SQL*Plus: Release 9.2.0.4.0 - Production on Wed Dec 21 21:04:24 2005 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to: SQL> col a for 999999999999 A SQL> select dbms_flashback.get_system_change_number a from dual; A SQL> |
方法有多种,但是涉及的知识各有巧妙不同,深入研究一下都是很有意思的.