zoukankan      html  css  js  c++  java
  • 第11步:数据库冗余

    目前在ASM上控制文件只有一份,需要给控制文件做镜像


        1. 查看当前控制文件
    代码1
    [root@sgdb1 ~]# su - oracle
    [oracle@sgdb1 ~]$ export ORACLE_SID=sgdb1   //第2个节点为:export ORACLE_SID=sgdb2
    [oracle@sgdb1 ~]$ sqlplus / as sysdba
    SQL> show parameter control_files
    NAME                              TYPE  VALUE
    ------------------------------------ ----------- ------------------------------
    control_files                       string  +BJ_SGDB_DATA/sgdb/controlfile/current.256.887810989


        1. 复制控制文件
    1)两个节点分别关闭数据库
    代码2
    [oracle@sgdb1 ~]$ sqlplus / as sysdba
    SQL> shutdown immediate;     
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
     
    代码3
    [oracle@sgdb2 ~]$ sqlplus / as sysdba
    SQL> shutdown immediate;     
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
     
    2)启动数据库到nomount状态(实例之一即可)
    代码4
    SQL> startup nomount;
    ORACLE instance started.
    Total System Global Area 1.0055E+10 bytes
    Fixed Size                  2261888 bytes
    Variable Size           5435821184 bytes
    Database Buffers     4596957184 bytes
    Redo Buffers            19742720 bytes
    查看控制文件位置
    SQL> show parameter control_files;
    NAME                              TYPE  VALUE
    ------------------------------------ ----------- ------------------------------
    control_files                       string  +BJ_SGDB_DATA/sgdb/controlfile/current
                                               .256.887810989
    3)使用RMAN复制控制文件(实例之一即可)
    代码5
    [oracle@sgdb1 ~]$ rman target /
    RMAN> restore controlfile to '+BJ_SGDB_DATA' from
    '+BJ_SGDB_DATA/sgdb/controlfile/current.256.887810989';
    4)查看新生成的控制文件副本
    注意:新生成的文件名目前没有看到,可以通过grid用户,使用asmcmd查看
    代码6
    [grid@sgdb1 ~]$ export ORACLE_SID=+ASM1
    [grid@sgdb1 ~]$ asmcmd
    ASMCMD> cd DATA/SGDB/CONTROLFILE
    ASMCMD> ls
    Current.256.887810989
    current.269.887816799
     
    显然,新生成的文件名字为current.269.887816799
     
    5)修改SPFILE
    注意RAC不能像单实例那样直接修改pfile,不要轻易使用“create pfile from spfile;”命令创建PFILE文件,因此还是老老实实地修改spfile吧:
    代码7
    [oracle@sgdb1 ~]$ sqlplus / as sysdba
    当前状态应该已经为nomount
    SQL> select status from v$instance;
    STATUS
    ------------
    STARTED
    修改参数文件
    SQL> alter system set control_files = '+BJ_SGDB_DATA/sgdb/controlfile/current.256.887810989', '+BJ_SGDB_DATA/sgdb/controlfile/current.269.887816799' scope = spfile;
    System altered.
     
     
     
    6)分别重启两个数据库(sgdb1 & sgdb2),查看控制文件
    代码8
    SQL> startup force;
    SQL> show parameter control_files;
    NAME                              TYPE  VALUE
    ------------------------------------ ----------- ------------------------------
    control_files                       string  +BJ_SGDB_DATA/sgdb/controlfile/current
                                               .256.887810989, +BJ_SGDB_DATA/sgdb/con
                                               trolfile/current.269.887816799

      1. REDO LOG冗余

    目前REDO LOG一共有8组,每个组只有一名成员,需要做镜像
    代码9
    [oracle@sgdb1 ~]$ sqlplus / as sysdba
    拷贝下面语句,执行添加成员
    alter database add logfile member '+BJ_SGDB_DATA' to group 1;
    alter database add logfile member '+BJ_SGDB_DATA' to group 2;
    alter database add logfile member '+BJ_SGDB_DATA' to group 3;
    alter database add logfile member '+BJ_SGDB_DATA' to group 4;
    alter database add logfile member '+BJ_SGDB_DATA' to group 5;
    alter database add logfile member '+BJ_SGDB_DATA' to group 6;
    alter database add logfile member '+BJ_SGDB_DATA' to group 7;
    alter database add logfile member '+BJ_SGDB_DATA' to group 8;
     

    终于,OracleRAC安装完成!

    ==============================================================================
    1.rman-00554:initialization of internal recovery manager package failed
    rman-04005:error from target database:
    ORA-12162:TNS:net service name is incorrectly specified
     
     

    解决过程:

    忘记了,下次在遇到留意下。

     
     
     
    2.启动RAC其中一个节点正常,启动第二个节点报错,提示如下:
    SQL> startup force;
    ORACLE instance started.
     
    Total System Global Area 1068937216 bytes
    Fixed Size            2260088 bytes
    Variable Size          444597128 bytes
    Database Buffers      616562688 bytes
    Redo Buffers            5517312 bytes
    ORA-01105: mount is incompatible with mounts by other instances
    ORA-01606: parameter not identical to that of another mounted instance
     
    解决过程:
    之前的步骤修改SPFILE修改参数文件,应该两个节点同时关闭,同时以nomount方式启动,同时执行
    alter system set control_files = '+BJ_SGDB_DATA/sgdb/controlfile/current.256.887810989', '+BJ_SGDB_DATA/sgdb/controlfile/current.269.887816799' scope = spfile;
    System altered.
    问题解决。
  • 相关阅读:
    Ansible跳板机自动部署
    nginx展示文件目录
    【转】消息钩子注册浅析
    windows临界区
    windbg定位死锁
    Windows工作集内存
    我的spring boot,杨帆、起航!
    CursorFileManager对cursor文件的读写
    eclipse执行maven install命令时跳过test
    bASE--Risk
  • 原文地址:https://www.cnblogs.com/wuwanyu/p/8276148.html
Copyright © 2011-2022 走看看