zoukankan      html  css  js  c++  java
  • Oracle推进SCN系列:使用oradebug在mount状态下推进SCN

    环境:RHEL 6.5(x86-64) + Oracle 11.2.0.4
    声明:推进SCN属于非常规恢复范畴,不建议非专业人员操作,否则后果自负。
    需求:我这里演示下推进SCN 10W数量级,实际需求推进多少可以根据ORA-600 [2662] [a] [b] [c] [d] [e]具体值来确认。

    ARGUMENTS:
    Arg [a] Current SCN WRAP
    Arg [b] Current SCN BASE
    Arg [c] dependent SCN WRAP
    Arg [d] dependent SCN BASE
    Arg [e] Where present this is the DBA where the dependent SCN came from.

    更多详情可参考: ORA-600 [2662] "Block SCN is ahead of Current SCN" (文档 ID 28929.1)

    1.查看当前数据库的Current SCN

    SYS@orcl> select current_scn||'' from v$database;
    
    CURRENT_SCN||''
    --------------------------------------------------------------------------------
    4563483988
    

    可以看到当前SCN是4563483988,我现在想推进SCN,在10w级别,也就是4563483988标红数字修改为指定值。

    2.重新启动数据库到mount阶段

    重新启动数据库到mount阶段:
    SYS@orcl> shutdown abort
    ORACLE instance shut down.
    SYS@orcl> startup mount
    ORACLE instance started.
    
    Total System Global Area 1235959808 bytes
    Fixed Size                  2252784 bytes
    Variable Size             788529168 bytes
    Database Buffers          436207616 bytes
    Redo Buffers                8970240 bytes
    Database mounted.
    

    3.使用oradebug poke推进SCN

    我这里直接把十万位的"4"改为"9"了,相当于推进了50w左右: 说明:实验发现oradebug poke 推进的SCN值,既可以指定十六进制的0x11008DE74,也可以直接指定十进制的4563983988。
    SYS@orcl> oradebug setmypid
    Statement processed.
    SYS@orcl> oradebug dumpvar sga kcsgscn_
    kcslf kcsgscn_ [06001AE70, 06001AEA0) = 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 6001AB50 00000000
    SYS@orcl> select to_char(checkpoint_change#, 'XXXXXXXXXXXXXXXX') from v$database;
    
    TO_CHAR(CHECKPOINT_CHANGE#,'XXXXXX
    ----------------------------------
            110013C41
    
    SYS@orcl> oradebug poke 0x06001AE70 8 4563983988
    BEFORE: [06001AE70, 06001AE78) = 00000000 00000000
    AFTER:  [06001AE70, 06001AE78) = 1008DE74 00000001
    
    SYS@orcl> oradebug dumpvar sga kcsgscn_
    kcslf kcsgscn_ [06001AE70, 06001AEA0) = 1008DE74 00000001 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 6001AB50 00000000
    
    SYS@orcl> alter database open;
    
    Database altered.
    
    SYS@orcl> select current_scn||'' from v$database;
    
    CURRENT_SCN||''
    --------------------------------------------------------------------------------
    4563984271
    

    可以看到已经成功将SCN推进到4563983988,SCN不断增长,所以这里查到的值略大一些。

    4.补充实际计算推进SCN的方法

    本文在 2018-12-16 进一步补充说明: 在实际这类工作中,我们实际应该是要认真计算好需要推进SCN的值,而不应图省事直接给一个很大的值。后者不但是技术水平不成熟的表现,而且是不负责任的行为。
    --ORA-00600: internal error code, arguments: [2662], [2], [1424107441], [2], [1424142235], [8388617], [], []
    select 2*power(2,32)+1424142235 from dual;
    10014076827
    
    --ORA-00600: internal error code, arguments: [2662], [2], [1424142249], [2], [1424142302], [8388649], [], []
    select 2*power(2,32)+1424143000 from dual;
    10014077592
    

    总结公式:c * power(2,32) + d {+ 可适当加一点,但不要太大!}
    c代表:Arg [c] dependent SCN WRAP
    d代表:Arg [d] dependent SCN BASE

    oradebug setmypid
    oradebug dumpvar sga kcsgscn_
    oradebug poke 0x060012658 8 10014077592
    oradebug dumpvar sga kcsgscn_
    alter database open;
    

    最后要说的是,做事情还是多考虑些,在非常规恢复中也能温柔的去推进SCN,高级DBA的价值从细节上体现。

  • 相关阅读:
    使用SharePoint文档库需注意的问题
    Windows 2003 lassess.exe 系统错误
    使用javascript 实现.net 验证控件功能
    NetAdvantage For .NET全新推出 2008 Volume 2 版加强了对web图表的支持
    Aspose.Total 发布Q12010第一季度版
    FastReport VCL4.9发布
    StimulReport.Net报表控件推介
    .NET Reactor超高性价比的混淆器
    TeeChartfor.NET 全面支持VisualStudio2010和.NET Framework4.0 (控件中国网)
    Dundas Dashboard V2.0仪表盘控件的发布
  • 原文地址:https://www.cnblogs.com/jyzhao/p/9242352.html
Copyright © 2011-2022 走看看