• 给11gR2 Dataguard打psu补丁的步骤及注意事项


    参考文档278641.1

    0.备份
    备主备库的spfile
    备份主库的数据

    1.在主库上暂停向备库传日志
    alter system set log_archive_dest_state_X=defer scope=both sid='*'

    2.关闭备库以及备库监听,打上psu;不需要执行catpatch/catbundle/catcpu这些脚本;打完补丁后,将备库启动到mount状态,启动备库监听
    (1)关闭数据库及监听
    shutdown immediate;
    lsnrctl stop

    集群的环境关闭命令如下:
    srvctl stop database -d dbname
    srvctl stop listener -n nodehost1 -l lsnr_name
    srvctl stop listener -n nodehost2 -l lsnr_name

    (2)打psu补丁
    opatch apply (注意要看psu文档上面需要的opatch版本要求,如果不满足,需要去下载6880880 opatch的最新版本)
    注意一点,如果没有完全退出sqlplus的话,那么apply的时候会报错:
    Prerequisite check "CheckActiveFilesAndExecutables" failed.
    The details are:
    Following executables are active :
    /u01/app/oracle/product/11.2.0/dbhome_1/lib/libclntsh.so.11.1

    解决方法是 :
    fuser /u01/app/oracle/product/11.2.0/dbhome_1/lib/libclntsh.so.11.1
    再kill -9 显示的第一个值

    (3)启动数据库到mount状态,启动监听
    startup mount
    lsncrctl start


    3.关闭主库以及主库监听,打上psu,执行catpatch/catbundle/catcpu这些脚本;
    (1)关闭数据库和监听
    shutdown immediate
    lsnrctl stop

    集群的环境关闭命令如下:
    srvctl stop database -d dbname
    srvctl stop listener -n nodehost1 -l lsnr_name
    srvctl stop listener -n nodehost2 -l lsnr_name

    (2)opatch apply

    (3)执行脚本
    cd $ORACLE_HOME/rdbms/admin
    sqlplus / as sysdba
    startup restrict
    @catbundle.sql psu apply
    @utlrp.sql

    注意一点:
    如果是普通的不得,执行:
    SQL>@catupgrade

    如果是安全补丁,执行:
    SQL>@catcpu

    4.启动主库监听,启动向备库传递日志
    lsnrctl start
    集群用下面的命令给每个节点启动
    srvctl start database -d dbname
    srvctl start service -d dbname
    srvctl start listener -n nodehost1 -l lsnr_name

    打开主库让其他进程也可以访问
    alter system disable restricted session;

    alter system set log_archive_dest_state_X=enable scope=both sid='*'

    这个时候可以在备库的alert日志上面看到类似:
    RFS[1]: Archived Log: '/0u1/archivelogdir/pmis_STD/archivelog/2015_11_06/o1_mf_1_990_6ampq53c1_.arc'
    RFS[1]: Archived Log: '/0u1/archivelogdir/pmis_STD/archivelog/2015_11_06/o1_mf_1_991_6ampn54l3_.arc'
    RFS[1]: Archived Log: '/0u1/archivelogdir/pmis_STD/archivelog/2015_11_06/o1_mf_1_992_6apmp561o_.arc'
    RFS[1]: Archived Log: '/0u1/archivelogdir/pmis_STD/archivelog/2015_11_06/o1_mf_1_993_6ampp572b_.arc'
    Thu Nov 6 11:55:20 2016
    RFS[1]: Archived Log: '/0u1/archivelogdir/pmis_STD/archivelog/2015_11_06/o1_mf_1_994_6ampz58i1_.arc'
    RFS[1]: Archived Log: '/0u1/archivelogdir/pmis_STD/archivelog/2015_11_06/o1_mf_1_995_6ampa59z8_.arc'
    RFS[1]: Archived Log: '/0u1/archivelogdir/pmis_STD/archivelog/2015_11_06/o1_mf_1_996_6apma68p0_.arc'
    RFS[1]: Archived Log: '/0u1/archivelogdir/pmis_STD/archivelog/2015_11_06/o1_mf_1_997_6amps572b_.arc'
    Thu Nov 6 11:59:26 2016 
    RFS[1]: Archived Log: '/0u1/archivelogdir/pmis_STD/archivelog/2015_11_06/o1_mf_1_998_6amps60c1_.arc'
    RFS[1]: Archived Log: '/0u1/archivelogdir/pmis_STD/archivelog/2015_11_06/o1_mf_1_999_6ampz61l3_.arc'
    RFS[1]: Archived Log: '/0u1/archivelogdir/pmis_STD/archivelog/2015_11_06/o1_mf_1_1000_6apmp621o_.arc'
    RFS[1]: Archived Log: '/0u1/archivelogdir/pmis_STD/archivelog/2015_11_06/o1_mf_1_1001_6amp652b_.arc'
    Media Recovery Waiting for thread 1 sequence 1002


    5.打开备库的 apply/managed recovery
    直到看到Media Recovery Waiting for thread 1 sequence 1002 这种信息,表示已经把日志恢复完成,这个时候可以切换到active dataguard的模式


    alter database recover managed standby database cancel;

    如果没有执行上面的命令,直接alter database open的话,会报错如下:

    ORA-10456: cannot open standby database; media recovery session may be in progress

    所以正确的步骤是:

    alter database recover managed standby database cancel;
    alter database open;
    alter database recover managed standby database using current logfile disconnect ;

    再查询状态:
    SQL> select name,open_mode from v$database;
    NAME OPEN_MODE
    --------- --------------------
    PMIS       MOUNTED

    6.检查补丁情况,在主备库都要检查
    opatch lsinventory

  • 相关阅读:
    R的卸载和更新安装
    Holt-Winters原理和初始值的确定
    使用excel结合线性规划求解Holt-Winters参数
    Java_Number(装箱和拆箱)
    Java_运算符
    Java_Character类
    Java_String&StringBuilder&StringBuffer类
    Java_数组
    Java_修饰符
    Java_变量类型
  • 原文地址:https://www.cnblogs.com/nazeebodan/p/4942691.html
Copyright © 2020-2023  润新知