eygle.com   eygle.com
eygle.com eygle
eygle.com  
 

« Mac Terminal 终端防范 idle 避免自动中断的方法 | Blog首页 | 2018 Oracle APAC用户组大会在上海胜利闭 »

Oracle 12.2 新特性:BigSCN 支持 8 字节存储解决SCN越界问题
modb.pro

前情回顾:

更新通报:Oracle修正了关于DB Link补丁的公告

解决方案:Oracle的DB Link问题及升级路线详述

预警揭秘:11.2.0.4前版必须在2019年4月升级

Oracle Database 12.2 中,为了更彻底的解决SCN问题,Oracle 通过引入 BigSCN 的新特性,最终改变了 SCN 的算法。

ScnChangedCover.jpg

BigSCN 新特性最根本的改变是:将原来 SCN 的存储位数从 6 字节扩展为 8 字节。对比起来,我们将原来的SCN算法称为 SmallSCN,现在的就是 BigSCN。

在 Oracle 12.2 的执行文件中,可以看到其中的一点提示:

[oracle12c@enmotech bin]$ strings oracle | grep big_scn

_big_scn_test_mode

Raising initial SCN from 0x%016llx to 0x0002000000000000 due to _big_scn_test_mode = 4

Raising initial SCN from 0x%016llx to 0x0000ffffffff1fff due to _big_scn_test_mode = %d

通过隐含参数列表,可以获得 big scn 的一个隐含参数,从这个注释中可以看出新特性被命名为 BigSCN, 缺省值是 2 ,在产品环境中这个参数不可以修改,是以测试目的设置的 :

NAME: _big_scn_test_mode

VALUE: 2

DESCRIB: testing mode for BigSCN

通过以上两类输出,可以看到,当 _big_scn_test_mode 被设置为 4 的时候,SCN 会增进为 0x0002000000000000 ,由这些我们可以看出 SCN 终于突破了 6 Bytes 的设置,进入到了 8 Bytes 时代。


插播活动信息

2018 ACOUG中国行之·上海站 4月13日上海相见,从Oracle 18c到MySQL 8.0 ,5 大技术主题,欢迎来约,报名详情参考:

ACOUG China Tour 2018 - 4月13日启航上海站

当SCN mode 设置为 4 的时候,SCN 会直接跃迁到 7 Bytes,超越了 6 Bytes 的界限。

那么这个SCN 是多少?

SQL> select to_number('2000000000000','xxxxxxxxxxxxx') scn

from dual;

SCN

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

562,949,953,421,312

而 6 Bytes 的 SCN极限值是281 trillion :

SQL> select power(2,48) scn from dual;

SCN

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

281,474,976,710,656

将这两组数据放到一个表格会显得一目了然:

SCN 位数和设置 SCN值
6 Bytes最大可用

281,474,976,710,656

_big_scn_test_mode=4

562,949,953,421,312

BigSCN 最大可用
9,223,372,036,854,775,808

_big_scn_test_mode=4 的起点是 49 位,比较 原来的 48 位增进一位,这个起点就直接超越了过去的最大限制:

SQL> select power(2,49) scn from dual;

SCN

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

562,949,953,421,312

BigSCN 最大可用值上升到一个天量数字,可以看到关于SCN问题,我们越来越不需要去担心了:

SQL> select power(2,63) scn from dual;

SCN

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

9,223,372,036,854,775,808

虽然理论值做出了改变,SCN的地址空间也获得了增加,但是在实践中,这些新特性的获得是渐进式,在 12.2 之后,这些特性才会逐渐的释放出来。

在以下我的测试环境中,尝试将SCN推进到了极高的位置:

SQL> select current_scn scn from v$database;

SCN

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

4,519,057,215,000,399

SQL> oradebug setmypid

Statement processed.

SQL> oradebug dumpvar sga kcsgscn_

kcslf kcsgscn_ [0600113B8, 0600113E8) = 00050F5D 00100E0F

将这个数字放到前面的表格中,大家可以看到SCN在实践中可以获得的海量值空间:

SCN 位数和设置 SCN值
6 位SmallSCN 最大

281,474,976,710,656

_big_scn_test_mode=4

562,949,953,421,312

测试环境 SCN 推进量 4,519,057,215,000,399

8 位BigSCN 最大

9,223,372,036,854,775,808

为了防止SCN的过度增加,Oracle 增加了内部函数去分析headroom,并通过 600 号错误的 kcm_low_scn_headroom_alert_1 抛出异常:

2018-03-23T18:12:01.849206+08:00

Errors in file /enmo12c/enmo12c/trace/enmo12c_ora_5259.trc (incident=174424) (PDBNAME=CDB$ROOT):

ORA-00600: internal error code, arguments: [2252], [4520092301887888], [4519517455400960], [], [], [], [], [], [], [], [], []

Incident details in: /enmo12c/enmo12c/incident/incdir_174424/enmo12c_ora_5259_i174424.trc

2018-03-23T18:12:01.858629+08:00

Errors in file /enmo12c/enmo12c/trace/enmo12c_ckpt_5220.trc (incident=174304) (PDBNAME=CDB$ROOT):

ORA-00600: internal error code, arguments: [kcm_low_scn_headroom_alert_1], [], [], [], [], [], [], [], [], [], [], []

Incident details in: /enmo12c/enmo12c/incident/incdir_174304/enmo12c_ckpt_5220_i174304.trc

这个启用了 BigSCN 的 12.2 数据库,当通过DB Link连接 11.2.0.4 的数据库时:

SQL> create database link enmo

connect to eygle identified by eygle using 'enmo';

Database link created.

SQL> select * from dual@enmo;

select * from dual@enmo

*

ERROR at line 1:

ORA-24442: SCN exceeds the capability of the target OCI database or client

这是一个新的错误号:

ORA-24442: SCN exceeds the capability of the target OCI database or client

Cause: An attempt was made to transfer a system change number (SCN) to an Oracle database or client that is older than Release 12.2 and the SCN exceeds the maximum value that such a system can handle.

Action: If needed, update the target database or client to Release 12.2 or higher.

有了BigSCN的新特性,在12.2版本之后,Oracle 关于SCN的种种问题,可能再也不容易被遇到了。

在官方文档上有一些描述与 8 Bytes的 BigSCN相关:

Data Pump Export and Data Pump Import support the new big SCN size of 8 bytes. See the Export FLASHBACK_SCN and the Import FLASHBACK_SCN parameters.

As of Oracle Database 12c release 2 (12.2), the SCN value can be a big SCN (8 bytes). You can also specify a big SCN when you create a dump file for an earlier version that does not support big SCNs because actual SCN values are not moved. See the following restrictions for more information about using big SCNs.

  • You cannot specify a big SCN for a network export or network import from a version that does not support big SCNs.

附录

在kcm内核文件中,可以看到和BigSCN相关的一些函数调用:

bigscn: %c

-?comment:PROF: NO_PROFILE krsu_fal_rcv_hndl_bigscn()

-?comment:PROF: NO_PROFILE krsu_fal_send_hndl_bigscn()

-?comment:PROF: NO_PROFILE krsu_rfs_rcv_hndl_bigscn()

-?comment:PROF: NO_PROFILE krsu_rfs_send_hndl_bigscn()

-?comment:PROF: NO_PROFILE krsu_rfx_rcv_hndl_bigscn()

-?comment:PROF: NO_PROFILE krsu_rfx_send_hndl_bigscn()

krsu_fal_rcv_hndl_bigscn

krsu_fal_send_hndl_bigscn

krsu_rfs_rcv_hndl_bigscn

krsu_rfs_send_hndl_bigscn

krsu_rfx_rcv_hndl_bigscn

krsu_rfx_send_hndl_bigscn

-?comment:PROF: USED kcm_low_scn_headroom_alert()

kcm_low_scn_headroom_alert

kcm_low_scn_headroom_alert_1

相关阅读:

更新通报:Oracle修正了关于DB Link补丁的公告

解决方案:Oracle的DB Link问题及升级路线详述

预警揭秘:11.2.0.4前版必须在2019年4月升级

SCN、ORA-19706错误和内部参数

深入剖析:Oracle SCN 机制详解

安全警报:2018一月号安全补丁修复安全漏洞

安全警告:WebLogic WSAT组件漏洞挖矿程序攻击

如果在此问题上需要进一步的协助,请联系云和恩墨的技术团队,更详细的解决方案将提供给我们的服务客户。也欢迎加入我们的微信群进一步的讨论该问题。

云和恩墨

数据驱动,成就未来。整合业界顶尖的技术与合作伙伴资源,围绕数据及相关领域,提供解决方案和专业服务。
IT基础架构
分布式存储 | zData一体机 | 容灾方案
数据架构
Oracle DB2 MySQL NoSQL
专项服务:架构/安全/优化/升级/迁移
运维服务:运维服务 代维服务
人才培养:个人认证 企业内训
软件产品:SQL审核、自动化运维、数据恢复
应用架构
应用和中间件:数据建模 | SQL审核和优化 | 中间件服务

历史上的今天...
    >> 2012-03-26文章:
           关于Oracle数据库的夏令时
    >> 2010-03-26文章:
    >> 2007-03-26文章:
           生命的律动
    >> 2006-03-26文章:

By eygle on 2018-03-26 11:18 | Comments (0) | Oracle12c/11g | 3285 |


CopyRight © 2004~2020 云和恩墨,成就未来!, All rights reserved.
数据恢复·紧急救援·性能优化 云和恩墨 24x7 热线电话:400-600-8755 业务咨询:010-59007017-7040 or 7037 业务合作: marketing@enmotech.com