Oracle的DBMS_SCN修正以及SCN的auto-rollover新特性
在 Oracle 11.2.0.2 之後,隨著一系列 SCN 耗盡問題的出現,很多補丁湧現出來,一個新的 Package 增加進來。
這個 Package 就是 DBMS_SCN。
如果你的資料庫中存在這個 Package,也就意味著你已經安裝具備了關於 DB Link 的修正補丁。
以下是這個包的主要函式過程以及說明,這個內容來自 Oracle 11.2.0.4 版本平臺:
Rem
Rem $Header: rdbms/admin/dbmsscnc.sql /st_rdbms_11.2.0/1 2013/04/18 23:05:40 vgokhale Exp $
Rem
Rem dbmsscn.sql
Rem
Rem Copyright (c) 2012, 2013, Oracle and/or its affiliates.
Rem All rights reserved.
Rem
Rem NAME
Rem dbmsscnc.sql - dbms_scn package definition
Rem
Rem DESCRIPTION
Rem
Rem
Rem NOTES
Rem
Rem
Rem MODIFIED (MM/DD/YY)
Rem mtiwary 05/26/12 - Declarations and definitions related to DBMS_SCN
Rem package.
Rem mtiwary 05/26/12 - Created
Rem
Rem
Rem BEGIN SQL_FILE_METADATA
Rem SQL_SOURCE_FILE: rdbms/admin/dbmsscn.sql
Rem SQL_SHIPPED_FILE:
Rem SQL_PHASE:
Rem SQL_STARTUP_MODE: NORMAL
Rem SQL_IGNORABLE_ERRORS: NONE
Rem SQL_CALLING_FILE:
Rem END SQL_FILE_METADATA
SET ECHO ON
SET FEEDBACK 1
SET NUMWIDTH 10
SET LINESIZE 80
SET TRIMSPOOL ON
SET TAB OFF
SET PAGESIZE 100
CREATE OR REPLACE LIBRARY DBMS_SCN_LIB TRUSTED AS STATIC;
/
CREATE OR REPLACE PACKAGE DBMS_SCN AUTHID CURRENT_USER IS
DBMS_SCN_API_MAJOR_VERSION CONSTANT NUMBER := 1;
DBMS_SCN_API_MINOR_VERSION CONSTANT NUMBER := 0;
PROCEDURE GetCurrentSCNParams(
rsl OUT number,
headroom_in_scn OUT number,
headroom_in_sec OUT number,
cur_scn_compat OUT number,
max_scn_compat OUT number);
-- Currently no exceptions are thrown.
-- rsl - Reasonable SCN Limit as of `now`
-- headroom_in_scn - Difference between current SCN and RSL
-- headroom_in_sec - number of seconds it would take to reach RSL
-- assuming a constant SCN consumption rate associated
-- with current SCN compatibility level
-- cur_scn_compat - current value of SCN compatibility
-- max_scn_compat - max value of SCN compatibility this database
-- understands
FUNCTION GetSCNParamsByCompat(
compat IN number,
rsl OUT number,
headroom_in_scn OUT number,
headroom_in_sec OUT number
) RETURN boolean;
-- compat -- SCN compatibility value
-- rsl -- Reasonable SCN Limit
-- headroom_in_scn -- Difference between current SCN and RSL
-- headroom_in_sec -- number of seconds it would take to reach RSL
-- assuming a constant SCN consumption rate associated
-- with specified database SCN compatibility
--
-- Returns False if `compat` parameter value is invalid, and OUT parameters
-- are not updated.
PROCEDURE GetSCNAutoRolloverParams(
effective_auto_rollover_ts OUT DATE,
target_compat OUT number,
is_enabled OUT boolean);
-- effective_auto_rollover_ts - timestamp at which rollover becomes
-- effective
-- target_compat - SCN compatibility value this database
-- will move to, as a result of
-- auto-rollover
-- is_enabled - TRUE if auto-rollover feature is
-- currently enabled
PROCEDURE EnableAutoRollover;
PROCEDURE DisableAutoRollover;
END DBMS_SCN;
/
這裡就可以看到 auto-rollover 的自動 SCN 相容性終止時間,也就是說,在不同的相容性設定中,SCN 的演算法不同,但是內建了天然的演算法過期時間。
在此之後,可以通過命令修改資料庫的 SCN 相容性演算法:
SQL> ALTER DATABASE SET SCN COMPATIBILITY 2;
Database altered.
從高階別向低階別修改,需要資料庫在 Mount 狀態:
SQL> ALTER DATABASE SET SCN COMPATIBILITY 2;
ALTER DATABASE SET SCN COMPATIBILITY 2
*
ERROR at line 1:
ORA-01126: database must be mounted in this instance and not open in any instance
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 4609830912 bytes
Fixed Size 2260888 bytes
Variable Size 989855848 bytes
Database Buffers 3607101440 bytes
Redo Buffers 10612736 bytes
Database mounted.
SQL> ALTER DATABASE SET SCN COMPATIBILITY 2;
Database altered.
SQL> alter database open;
Database altered.
這是一個非常重要的變化。
原文釋出時間為:2018-03-16
本文作者:蓋國強
本文來自雲棲社群合作伙伴“資料和雲”,瞭解相關資訊可以關注“資料和雲”微信公眾號
相關文章
- oracle的scn及sequenceOracle
- Oracle:SCNOracle
- 【SCN】Oracle SCN 詳細介紹Oracle
- Oracle 檢查點涉及的SCNOracle
- Oracle的SCN顯示問題Oracle
- 【SCN】Oracle推薦scn命令參考Oracle
- 【SCN】Oracle檢查scn值指令碼Oracle指令碼
- Oracle SCN詳解Oracle
- ORACLE -詳解SCNOracle
- DG備庫未啟動SCN 新特性引起ORA-600 2252
- Oracle 18c新特性詳解 - 表和表空間相關的新特性Oracle
- Oracle 21c新特性預覽與日常管理相關的幾個新特性Oracle
- Oracle資料庫中的多種SCN彙總Oracle資料庫
- Oracle merge 與 PG新特性 UPSERTOracle
- 新特性:/dev/shm對Oracle 11g的影響devOracle
- ordebug 手動修改Oracle sga scnOracle
- oracle基於SCN增量恢復Oracle
- Oracle SCN健康狀態檢查Oracle
- Oracle 12c新特性--ASMFD(ASM Filter Driver)特性OracleASMFilter
- Oracle的特性分頁Oracle
- Oracle 12C新特性-History命令Oracle
- Oracle 12C新特性In-MemoryOracle
- Oracle 12c 兩個新特性Oracle
- 1 Oracle Database 19c 新特性OracleDatabase
- Oracle 20c 的 In-Memory 新特性 Spatial 和 Text 支援Oracle
- Oracle SCN機制詳細解讀Oracle
- 【OMF】使用Oracle的OMF 特性Oracle
- 【kingsql分享】Oracle Database 19c的各種新特性介紹SQLOracleDatabase
- Oracle 20c 新特性:自主的 In-Memory 管理 - Self-ManagingOracle
- lightdb新特性--相容oracle儲存過程的聯合陣列Oracle儲存過程陣列
- 【RECO_ORACLE】NBU 8.2新特性——快速拉起的恢復步驟Oracle
- Oracle12C新特性_DDL日誌Oracle
- Oracle 20C 多租戶_新特性Oracle
- LightDB 23.1相容Oracle新特性支援Oracle
- react 16.8版本新特性以及對react開發的影響React
- oracle 推進scn(poke、gdb、event、bbed)方法Oracle
- Swift 4.1 的新特性Swift
- ES的那些新特性