scn,headroom

參考文檔:

Master Note: Overview for SCN issues (文檔 ID 1503937.1)

System Change Number (SCN), Headroom, Security and Patch Information (文檔 ID 1376995.1)

What is System Change Number (SCN)?

The system change number (SCN) is a database ordering primitive. The value of an SCN is the logical point in time at which changes are made to a database. The database uses these SCNs to query and track the changes. For example, if a transaction updates a row, then the database records the SCN at which this update occurred.

There is a very large upper limit to how many SCNs an Oracle Database can use. That limit is currently 281 trillion, or specifically 281,474,976,710,656 (is 2^48) where the Oracle Database should not run out of available ones.

 

What is SCN Headroom?

The difference between the current SCN the database is using, and the "not to exceed" upper limit, is known as the SCN headroom. For almost all Oracle Databases, this headroom is constantly increasing every second. However, Oracle has determined that some software bugs could cause the database to attempt to exceed the current maximum SCN value (or get closer to the limit than was warranted). Generally if the database does try to exceed the current maximum SCN value, the transaction that caused this event would be cancelled by the database, and the application would see an error. The next second the limit increases, so typically the application then continues with a slight hiccough in processing. However, in some very rare cases, the database does need to shutdown to preserve its integrity. In no cases is data lost or corrupted.

--------------------------

The system change number (SCN) is a logical, internal timestamp used by the Oracle Database. SCNs order events that occur within the database, which is necessary to satisfy the ACID properties of a transaction.

The database uses SCNs to query and track changes. For example, if a transaction updates a row, then the database records the SCN at which this update occurred. Other modifications in this transaction typically have the same SCN. When a transaction commits, the database records an SCN for this commit. Each transaction increments the SCN after commits.

SCNs occur in a monotonically increasing sequence, and there is a very large upper limit to how many SCNs an Oracle Database can use. Starting 12.2.0.1 with compatibility set to 12.2 the limit is 2^63 and for versions below 12.2.0.1 it is 2^48 or 281 trillion SCN values.

Given that there is an upper limit, it is important that any given Oracle Database does not run out of available SCNs. The Oracle Database uses a time based rationing system to ensure that this does not happen.

At any point in time, the Oracle Database calculates a "not to exceed" limit for the number of SCNs a database can have used, based on the number of seconds elapsed since 1988, multiplied by 16,384 (16K/sec). This is known as the database's current maximum SCN limit. Doing this ensures that Oracle Databases will ration SCNs over time, allowing over 500 years of data processing for any Oracle Database using version 12.2.0.1 or lower. Starting 12.2.0.1 with compatibility set to 12.2, even if the SCNs are consumed at the rate of 96K/sec, the Oracle Database will allow close to 3 million years of data processing.

The difference between the current SCN the database is using, and the "not to exceed" upper limit, is known as the SCN headroom. For almost all Oracle Databases, this headroom is constantly increasing every second.

However, Oracle has determined that some software bugs could cause the database to attempt to exceed the current maximum SCN value (or get closer to the limit than was warranted).

Generally if the database does try to exceed the current maximum SCN value, the transaction that caused this event would be cancelled by the database, and the application would see an error. The next second the limit increases, so typically the application then continues with a slight hiccough in processing. However, in some very rare cases, the database does need to shut down to preserve its integrity. In no cases is data lost or corrupted.

Similar to how clocks are kept synchronized in a computer network, when two databases communicate with each other over a database link, they synchronize their SCNs by picking the largest SCN in use by the two. So in some cases, databases experienced rapidly decreasing SCN headroom not because of a bug in that specific database, but because the bug was active in one or more of the databases that database was connected to. Since the database always rejects SCNs that exceed the current maximum SCN, the provision of being able to run Oracle Databases for more than 500 years was not affected in any of the cases.

All the associated bugs have been fixed in the January 2012 CPU (and associated PSU). The same fixes are also available in the database Patchset Update (PSU) and the latest Oracle Exadata and Windows bundled patches.

Some customers expressed concerns that they may be getting closer to the current maximum SCN limit faster than the data processing they are doing would warrant. In all cases Oracle has found this to be a factor of one of the bugs fixed in the January 2012 CPU - and customers that have applied the fixes find that their SCN headroom starts to increase again, as it should.

To make sure they are not seeing these potential issues in their systems, customers can run a script that checks how far any particular database is away from the current maximum SCN limit for that database. The script is available in Document:1393363.1. The script will alert customers that they may be close to the maximum SCN limit, in which case Oracle recommends they should apply the CPU to the affected database (and interconnected databases) without delay. The expectation is then that these databases will start to grow their available SCN headroom, and for the affected customers that have applied the CPU, this has indeed been the case. The vast majority of customers will find their databases are not even close to the maximum SCN limit, in which case they can apply the CPU (or associated PSU) as part of their normal patching procedures. As always, Oracle recommends that CPUs be applied as soon as possible to address any additional security issues fixed in the CPU.

---------------- 谷歌翻譯

scn headroom
數據庫使用的當前SCN與“不超過”上限之間的差異稱爲SCN餘量。

在任何時候,Oracle數據庫都會計算數據庫可以使用的SCN數量的“不超過”限制,根據自1988年以來的秒數,再乘以16,384(16K /秒)。這稱爲數據庫當前的最大SCN限制。這樣做可確保Oracle數據庫隨着時間推移對SCN進行排序,允許使用12.2.0.1或更低版本的任何Oracle數據庫進行500多年的數據處理。在兼容性設置爲12.2的情況下啓動12.2.0.1,即使SCN以96K /秒的速率消耗,Oracle數據庫也將允許接近300萬年的數據處理。
數據庫使用的當前SCN與“不超過”上限之間的差異稱爲SCN餘量。對於幾乎所有Oracle數據庫而言,這個空間每秒都在不斷增加。
但是,Oracle已確定某些軟件錯誤可能導致數據庫嘗試超過當前的最大SCN值。
通常,如果數據庫確實嘗試超過當前最大SCN值,則導致此事件的事務將被數據庫取消,並且應用程序將看到錯誤。下一秒限制增加,因此通常應用程序繼續處理中的輕微打嗝。但是,在一些非常罕見的情況下,數據庫確實需要關閉以保持其完整性。在任何情況下都不會丟失或損壞數據。
類似於計算機網絡中時鐘保持同步的方式,當兩個數據庫通過數據庫鏈路相互通信時,它們通過選擇兩個使用的最大SCN來同步其SCN。
因此,在某些情況下,數據庫經歷了SCN擴展空間的快速減少,這不是因爲該特定數據庫中的錯誤,而是因爲該錯誤在數據庫連接到的一個或多個數據庫中是活動的。由於數據庫總是拒絕超過當前最大SCN的SCN,因此在任何情況下都不會影響能夠運行Oracle數據庫500多年的規定。
一些客戶表示擔心他們可能會比他們正在進行的數據處理更快地接近當前的最大SCN限制。在所有情況下,Oracle都發現這是2012年1月CPU中修復的錯誤之一 - 已經應用修復程序的客戶發現他們的SCN空間開始再次增加,應該如此。

爲了確保他們沒有在系統中看到這些潛在問題,客戶可以運行一個腳本來檢查任何特定數據庫距離該數據庫的當前最大SCN限制的距離。該腳本可在文檔:1393363.1中找到。該腳本將提醒客戶他們可能接近最大SCN限制,在這種情況下,Oracle建議他們應該毫不拖延地將CPU應用於受影響的數據庫(以及互連的數據庫)。因此,期望這些數據庫將開始增加其可用的SCN餘量,對於已應用CPU的受影響客戶,情況確實如此。絕大多數客戶會發現他們的數據庫甚至沒有接近最大SCN限制,在這種情況下,他們可以將CPU(或相關的PSU)作爲其正常修補程序的一部分。與往常一樣,Oracle建議儘快應用CPU以解決CPU中修復的任何其他安全問題。

----

從上面的文章中,scn的最大值。

2的48次方 -- 版本低於12.2.0.1
2的63次方 --版本從12.0.1 ,兼容性設置爲12.2 

END

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章