Scn基本知识

Mos 对scn的解释

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. Multiple transactions that commit at the same time may share the same SCN.

SCNs occur in a monotonically increasing sequence, and 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) 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. 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.

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 inDocument: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.

Longer term Oracle will be raising the upper limit from 281 trillion (i.e. 2^48) to an even larger number.

在Oracle内部,SCN分为两部分存储,分别称之为scn wrap和scn base。实际上SCN长度为48位,即它其实就是一个48位的整数。只不过可能是由于在早些年通常只能处理32位甚至是16位的数据,所以人为地分成了低32位(scnbase)和高16位(scn wrap)

SCN= (SCN_WRP * 4294967296) + SCN_BAS

一些字典表中记录SCN_WRP 和SCN_BAS的值

v$transaction;

smon_scn_time

_minimum_giga_scn参数理解

_minimum_giga_scn参数的作用

_minimum_giga_scn=n的含义是把SCN往前推进到nG,但请注意,只有在SCN小于nG的时候才会用到这个隐含参数,反之则Oracle会置这个隐含参数于不顾。

比如_minimum_giga_scn设置为1

这个开始最小scn为1*2^30=4294967296

注意_minimum_giga_scn不是调整SCN_WRP但是可以通过_minimum_giga_scn推算出SCN_WRP的值

通过_minimum_giga_scn也可以反推算出SCN_WRP的值 和 SCN_BASE的最小值

如果_minimum_giga_scn 6

取整数 (n*2^30)/2^32

如果n为4-8则为1

如果n为8-16 则为2

调整_minimum_giga_scn引起SCN_WRP,SCN_BASE 的变化测试

SQL> select current_scn from v$database;

CURRENT_SCN

-----------

4472678

SQL> create table test(id number);

Table created.

SQL> insert into test values(1);

1 row created.

SQL> select start_scnw, start_scnb from v$transaction;

START_SCNW START_SCNB

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

0    4490405

SQL> rollback;

Rollback complete.

SQL> alter system set "_MINIMUM_GIGA_SCN"=2 scope=spfile;

System altered.

SQL> startup force

ORACLE instance started.

Total System Global Area 1090519040 bytes

Fixed Size                  1266996 bytes

Variable Size             301992652 bytes

Database Buffers          771751936 bytes

Redo Buffers               15507456 bytes

Database mounted.

Database opened.

SQL> select start_scnw, start_scnb from v$transaction;

no rows selected

SQL> insert into test values(1);

1 row created.

SQL> select start_scnw, start_scnb from v$transaction;

START_SCNW START_SCNB

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

0 2147489696

SQL> rollback;

Rollback complete.

SQL>  alter system set "_MINIMUM_GIGA_SCN"=4 scope=spfile;

System altered.

SQL> startup force

ORACLE instance started.

Total System Global Area 1090519040 bytes

Fixed Size                  1266996 bytes

Variable Size             301992652 bytes

Database Buffers          771751936 bytes

Redo Buffers               15507456 bytes

Database mounted.

Database opened.

SQL> insert into test values(1);

1 row created.

SQL> select start_scnw, start_scnb from v$transaction;

START_SCNW START_SCNB

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

1         86

SQL> rollback;

Rollback complete.

SQL>

SQL>  alter system set "_MINIMUM_GIGA_SCN"=8 scope=spfile;

System altered.

SQL> startup force

ORACLE instance started.

Total System Global Area 1090519040 bytes

Fixed Size                  1266996 bytes

Variable Size             301992652 bytes

Database Buffers          771751936 bytes

Redo Buffers               15507456 bytes

Database mounted.

Database opened.

SQL> insert into test values(1);

1 row created.

SQL> select start_scnw, start_scnb from v$transaction;

START_SCNW START_SCNB

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

2         84

SQL> rollback;

Rollback complete.

注意:

11.2.0.2.5 以后不再支持通过_minimum_giga_scn来调整scn

如果想调整scn 需要通过直接调整controlfile或者调整datafile header然后再重建控制文件

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15747463/viewspace-1142993/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/15747463/viewspace-1142993/

隐含参数_minimum_giga_scn的理解相关推荐

  1. oracle scn隐藏参数,_minimum_giga_scn 隐含参数测试

    --隐含参数递增SCN(10015有时候不成功用隐含参数) SQL> startup force ORACLE instance started. Total System Global Are ...

  2. 【DBA脚本】查看隐含参数

    v$parameter动态视图并不能查到Oracle的全部参数,通过v$parameter动态视图我们只能查看到Oracle数据库相关的一些一般普通常用的参数,v$parameter动态视图中并没有包 ...

  3. 隐含参数与 Library Cache 与 Shared Pool Latch 原理

    现在每一个 Oracle DBA,很少有不知道隐含参数的.但至少在表面上,Oracle 是不支持将隐含参数用于数据库的.隐含参数通常用于救急,或者是作为 Oracle BUG 的临时解决方案(Work ...

  4. Oracle隐含参数:_allow_resetlogs_corruption

    提示:Oracle的隐含参数只应该在测试环境或者在Oracle Support的支持下使用.在使用_disable_logging进一步的测试中,试图通过switch logfile进行日志切换,结果 ...

  5. oracle11g 隐藏参数_oracle隐含参数的查看与修改

    v$parameter视图中查询参数的时候其实都是通过x$ksppi和x$ksppcv这两个内部视图中得到的. 1.   可以通过如下方式查询当前实例的所有隐含参数: col name for a30 ...

  6. oracle11g 隐藏参数_ORACLE 11GR2常用参数(含隐含参数)设置

    ORACLE 11GR2常用参数(含隐含参数)设置如下: alter system set "_PX_use_large_pool" = true scope=spfile; al ...

  7. Oracle入门(五D)之如何设置show parameter显示隐含参数

    转载自 oracle如何设置show parameter显示隐含参数 在sqlplus中show parameter是显示不了隐藏参数的,需要做一个处理,如下所示:    以SYS用户登录: C:\D ...

  8. oracle scn隐藏参数,Oracle隐含参数scn不一致启动

    Oracle隐含参数:allow_resetlogs_corruption的使用提示:Oracle的隐含参数只应该在测试环境或者在Oracle Support的支持下使用or Oracle隐含参数:a ...

  9. undo_management设置与隐含参数*._offline_rollback_segments和*._corrupted_rollback_segments关系...

    一 环境:oracle版本:10.2.0.1.0 当前undo表空间: SQL> show parameter undo; NAME                                ...

最新文章

  1. 基于visual Studio2013解决面试题之1002公共子串
  2. 一张图看懂阿里云网络产品【十五】IPv6 解决方案
  3. [JS] - onmusewheel事件(兼容IE,FF)
  4. python pso_利用python实现PSO算法优化二元函数
  5. 【Spring】Spring的AOP术语解释
  6. python实现简单的http服务器_python实现简单http服务器功能
  7. android 程序错乱,android – 安装时应用程序崩溃,错误sqlite3_...
  8. 8位串行加法器 计算机组成原理,安尧-2013434158-计算机组成原理8位加法器实验报告.doc...
  9. 银河麒麟系统查看网络设置命令_银河麒麟配置说明
  10. FlowNet到FlowNet2.0:基于卷积神经网络的光流预测算法
  11. [转] Ubuntu 16.04 RTL8111/8168/8411 不能上网 经常断网解决办法
  12. win10关闭最佳分辨率通知
  13. emacs 学习成长记
  14. 计算机新建里没有word,电脑新建中没有word和excel怎么回事
  15. 【MATLAB100个实用小技巧】——界面设计(33-43)
  16. 阿里云视频点播-对接注意点
  17. 直播相关知识之二 采集、处理、编码和封装
  18. HCNP-RS培训视频课程[简讲版]-马青-专题视频课程
  19. python在国内外研究现状_国内外研究现状,水平和发展趋势-开题报告
  20. android手机 恢复微信图片,OPPO R9s Plus怎么找回微信聊天图片?恢复微信误删图片方法推荐...

热门文章

  1. 消息中心——短信、邮件、推送、文件上传中台系统(京东实习)总结
  2. ProxmoxVE6.2 虚拟机导入导出
  3. 世​界​知​名​芯​片​厂​商​及​其​产​品​介​绍
  4. 浪潮通软笔试、面试总结,正规的典型。
  5. 深圳富士康应聘者:我们就是想进这打工(组图)
  6. 改变dialog的大小
  7. 收藏!Git命令大全
  8. CentOS命令修改系统时间同步
  9. 使用js做简易轮播图,可自动
  10. AI与全民开发:挑战和机会并存