Oracle10g與oracle11g中current_scn計算差別
我們知道Oracle10g在v$database檢視中引入了current_scn,這個SCN來自底層表,代表當前的SCN,在Oracle9i中我們可以透過dbms_flashback.get_system_change_number來獲得系統的SCN。我的版本是oracle11g的。
但是注意current_scn還是有所不同的,看一下一個查詢:
SQL> col current_scn for 99999999999999999
SQL> select current_scn from v$database; CURRENT_SCN
------------------
1941617
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941650
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941675
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941678
SQL> select current_scn from v$database;
CURRENT_SCN
------------------
1941683
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941689
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941691
SQL> select current_scn from v$database;
CURRENT_SCN
------------------
1941762
SQL> conn system/yang as sysdba
已連線。
SQL> select current_scn from v$database;
CURRENT_SCN
------------------
1941780
SQL> select current_scn from v$database;
CURRENT_SCN
------------------
1941794
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941794
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941795
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941797
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941797
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941798
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941799
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941799
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941799
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941800
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941800
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941801
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941801
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941801
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941802
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941802
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941802
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
1941803
SQL> select current_scn from v$database;
CURRENT_SCN
------------------
1941806
SQL> select current_scn from v$database;
CURRENT_SCN
------------------
1941808
SQL> select current_scn from v$database;
CURRENT_SCN
------------------
1941809
SQL> select current_scn from v$database;
CURRENT_SCN
------------------
1941811
SQL> select current_scn from v$database;
CURRENT_SCN
------------------
1941812
SQL> select current_scn from v$database;
CURRENT_SCN
------------------
1941814
SQL> select current_scn from v$database;
CURRENT_SCN
------------------
1941815
SQL> select current_scn from v$database;
CURRENT_SCN
------------------
1941817
我們看到current_scn的查詢會直接導致SCN的增進,而其他方式並不會,至少執行兩次時不會。也就是說在這裡的current_scn就像是一個Sequence一樣,查詢會導致增進。這也很好理解,v$database只能透過增進當前的SCN才能保證獲得的SCN是Current的。可是如果不查詢呢?這個值肯定是不會增長的。
這裡 和蓋國強大師 說點不一樣。
http://www.eygle.com/archives/2007/06/oracle10g_current_scn.html
有點疑惑?那位朋友能給個解答!先謝謝了。。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22664653/viewspace-661762/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle10g與Oracle11g中PASSWORD_LIFE_TIME的差異Oracle
- 視差和深度分析與計算
- 錢德沛教授:雲端計算和網格計算差別何在?薦
- pandas中計算總體標準差
- 時間差計算
- NHibernate Criteria中 Restriction與Expression的差別RESTExpress
- php中計算時間差的幾種方法PHP
- 自學程式設計和計算機科班出身的差別在哪?程式設計計算機
- JS計算時間差JS
- bash shell計算時間差
- 註冊時間差計算
- 計算兩個時間差
- carbon 計算當前時間與給定時間差
- C#中計算兩個時間的差,得到月份C#
- Android 計算倆個日期差Android
- JavaScript計算時間差詳解JavaScript
- 世界時區及時差計算
- 計算時間差,頁面倒數計時,安卓與ios相容問題安卓iOS
- excel日期加減計算方法 excel計算日期時間差Excel
- matlab符號函式的求導與差分的計算Matlab符號函式求導
- 【新炬網路名師大講堂】CBO中”與NULL在cardinality計算上的差別Null
- 差分方程自動計算專案
- shell 計算時間差的問題
- Vue中計算屬性computed與偵聽器watch的區別Vue
- 後端請求中的非同步計算與平行計算後端非同步
- JavaScript中的資料型別-儲存差別JavaScript資料型別
- 計算機中的補碼與java取反運算計算機Java
- ORACLE11G中SQL計劃管理OracleSQL
- int型別和long long型別運算執行時間的差別型別
- js處理浮點數計算誤差JS
- python程式計算執行時間差Python
- SQL中IN,NOT IN,EXISTS,NOT EXISTS的用法和差別SQL
- 程式設計師差別的本質程式設計師
- Linux Shell 時間運算以及時間差計算方法Linux
- 為什麼計算機對浮點型數字計算存在誤差計算機
- 邊緣計算、霧計算、雲端計算區別幾何?
- 邊緣計算與雲端計算
- MyISAM與innoDB儲存引擎有何差別儲存引擎