原文地址:oracle11g asm单实例重建has 作者:datapeng

最近到客户那里处理故障,客户说,他们修改了一下hostname,导到has出现了问题,当然,他们的数据库也就无法再启动,把处理过程记录下来,供大家参考!
在有些时候,我们修改了hostname,以及其它一些配置后,导至has、crs均无法启动,这时候,我们就需要对has、crs进行重建,其具体步骤如下。
1、首先修改hostname

[root@mydb ~]# vi /etc/hosts

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               testdb localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
192.168.88.150          testdb

[root@mydb ~]# vi /etc/sysconfig/network

NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=testdb

[root@mydb network-scripts]# reboot

Broadcast message from root (pts/0) (Fri Dec 13 08:57:58 2013):

The system is going down for reboot NOW!

2、修改hostname后,重启出现问题

[root@testdb bin]# ./crsctl start has
CLSU-00100: Operating System function: opendir failed with error data: 2
CLSU-00101: Operating System error message: No such file or directory
CLSU-00103: error location: scrsearch1
CLSU-00104: additional error information: cant open scr home dir scls_scr_getval
CRS-4000: Command Start failed, or completed with errors.

可以看到,has无法启动,在这种情况下,我们必须重新配置has\crs

3、配置has,修复上面的问题存在

--首先,对has进行删除,然后再进行配置
[root@testdb bin]# cd /u01/app/grid/product/11.2.0/crs/crs/install
[root@testdb install]# ls *has.pl
roothas.pl
[root@testdb install]# ./roothas.pl -deconfig -force -verbose
Using configuration parameter file: ./crsconfig_params
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Stop failed, or completed with errors.
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Delete failed, or completed with errors.
CLSU-00100: Operating System function: opendir failed with error data: 2
CLSU-00101: Operating System error message: No such file or directory
CLSU-00103: error location: scrsearch1
CLSU-00104: additional error information: cant open scr home dir scls_scr_getval
CRS-4544: Unable to connect to OHAS
CRS-4000: Command Stop failed, or completed with errors.
Successfully deconfigured Oracle Restart stack

--重新配置has
[root@testdb install]# ./roothas.pl
Using configuration parameter file: ./crsconfig_params
LOCAL ADD MODE 
Creating OCR keys for user 'oracle', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE 
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node testdb successfully pinned.
Adding Clusterware entries to inittab

testdb     2013/12/13 09:55:56     /u01/app/grid/product/11.2.0/crs/cdata/testdb/backup_20131213_095556.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server

如果失败,在这里会提示你做这样一个操作:
/u01/app/grid/product/11.2.0/crs/perl/bin/perl -I/u01/app/grid/product/11.2.0/crs/perl/lib -I/u01/app/grid/product/11.2.0/crs/crs/install /u01/app/grid/product/11.2.0/crs/crs/install/roothas.pl

[root@testdb bin]# ./crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.cssd       ora.cssd.type  OFFLINE   OFFLINE               
ora.diskmon    ora....on.type OFFLINE   OFFLINE               
ora.evmd       ora.evm.type   ONLINE    ONLINE    testdb      
ora.ons        ora.ons.type   OFFLINE   OFFLINE

[root@testdb bin]# ./crsctl config has
CRS-4622: Oracle High Availability Services autostart is enabled.

可以看到,这里has已经起来了,但是crs并没有起来

[root@testdb bin]# ./crsctl start crs
CRS-4013: This command is not supported in a single-node configuration.
CRS-4000: Command Start failed, or completed with errors.

--重新配置crs

[root@testdb ~]# cd /etc/oracle/scls_scr/
[root@testdb scls_scr]# ls -a
.  ..  testdb
[root@testdb scls_scr]# 
看到有新的名称,但crs并没有起来,所以,我们必须重新配置

--先卸载crs,然后再重新配置
[root@testdb bin]# cd /u01/app/grid/product/11.2.0/crs/crs/install
[root@testdb install]# ls *crs.pl
rootcrs.pl
[root@testdb install]# ./rootcrs.pl -deconfig -force -verbose
Using configuration parameter file: ./crsconfig_params
Usage: srvctl []
    commands: enable|disable|start|stop|status|add|remove|modify|getenv|setenv|unsetenv|config|upgrade
    objects: database|service|asm|diskgroup|listener|home|ons
For detailed help on each command and object and its options use:
  srvctl -h or
  srvctl -h
PRKO-2012 : nodeapps object is not supported in Oracle Restart
CRS-2613: Could not find resource 'ora.registry.acfs'.
CRS-4000: Command Stop failed, or completed with errors.
CRS-2613: Could not find resource 'ora.drivers.acfs'.
CRS-4000: Command Modify failed, or completed with errors.
CRS-2613: Could not find resource 'ora.drivers.acfs'.
CRS-4000: Command Delete failed, or completed with errors.
CRS-4013: This command is not supported in a single-node configuration.
CRS-4000: Command Stop failed, or completed with errors.
################################################################
# You must kill processes or reboot the system to properly #
# cleanup the processes started by Oracle clusterware          #
################################################################
Successfully deconfigured Oracle clusterware stack on this node
[root@testdb install]# ./rootcrs.pl
Using configuration parameter file: ./crsconfig_params
 
The oracle binary is currently linked with RAC disabled.
Please execute the following steps to relink oracle binary
and rerun the command with RAC enabled: 
   setenv ORACLE_HOME 
   cd /rdbms/lib 
   make -f ins_rdbms.mk rac_on ioracle 
[root@testdb install]# ./roothas.pl
Using configuration parameter file: ./crsconfig_params
LOCAL ADD MODE 
Creating OCR keys for user 'oracle', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE 
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node testdb successfully pinned.
Adding Clusterware entries to inittab

testdb     2013/12/13 10:10:38     /u01/app/grid/product/11.2.0/crs/cdata/testdb/backup_20131213_101038.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server

到这里,crs配置已经完成

4、添加服务进去
[root@testdb bin]# ./srvctl add listener
[root@testdb bin]# ./srvctl add asm -l LISTENER
[root@testdb bin]# ./crsctl status res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               OFFLINE OFFLINE      testdb                                       
ora.asm
               OFFLINE OFFLINE      testdb                                       
ora.ons
               OFFLINE OFFLINE      testdb                                       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        OFFLINE OFFLINE                                                   
ora.diskmon
      1        OFFLINE OFFLINE                                                   
ora.evmd
      1        ONLINE  ONLINE       testdb

[oracle@testdb bin]$ ./crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora....ER.lsnr ora....er.type OFFLINE   OFFLINE               
ora.asm        ora.asm.type   OFFLINE   OFFLINE               
ora.cssd       ora.cssd.type  OFFLINE   OFFLINE               
ora.diskmon    ora....on.type OFFLINE   OFFLINE               
ora.evmd       ora.evm.type   ONLINE    ONLINE    testdb      
ora.ons        ora.ons.type   OFFLINE   OFFLINE               
ora.mydb.db  ora....se.type OFFLINE   OFFLINE

5、启动各服务
[root@testdb bin]# ./srvctl start asm
PRCR-1079 : Failed to start resource ora.asm
CRS-2674: Start of 'ora.asm' on 'testdb' failed
CRS-2678: 'ora.asm' on 'testdb' has experienced an unrecoverable failure
CRS-0267: Human intervention required to resume its availability.
CRS-5802: Unable to start the agent process

启动asm时候报错。由于,我是用root的用户加进去的,所以asm是无法启动的,查了好久,最后尝试用管理的用户去尝试一下

使用asm的管理用户oracle(我在安装是没有建grid,所以均是oracle)
[root@testdb bin]# su - oracle
[oracle@testdb ~]$ export ORACLE_HOME=/u01/app/grid/product/11.2.0/crs
[oracle@testdb ~]$ cd /u01/app/grid/product/11.2.0/crs/bin
[oracle@testdb bin]$ ./srvctl remove asm
[oracle@testdb bin]$ ./srvctl add asm -l LISTENER
[oracle@testdb bin]$ ./srvctl start asm

数据库也添加进去

[oracle@testdb bin]$ ./srvctl add database -d mydb -o /u01/app/oracle/product/11.2.0/db1 
[oracle@testdb bin]$ ./crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora....ER.lsnr ora....er.type ONLINE    ONLINE    testdb      
ora.asm        ora.asm.type   ONLINE    ONLINE    testdb      
ora.cssd       ora.cssd.type  ONLINE    ONLINE    testdb      
ora.diskmon    ora....on.type OFFLINE   OFFLINE               
ora.evmd       ora.evm.type   ONLINE    ONLINE    testdb      
ora.ons        ora.ons.type   OFFLINE   OFFLINE               
ora.mydb.db  ora....se.type   ONLINE    OFFLINE

打开数据库
[oracle@testdb ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.3.0 Production on Fri Dec 13 12:43:14 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
ORA-01565: error in identifying file '+SYSDG/wuyedb/spfilewuyedb.ora'
ORA-17503: ksfdopn:2 Failed to open file +SYSDG/wuyedb/spfilewuyedb.ora
ORA-15056: additional error message
ORA-17503: ksfdopn:2 Failed to open file +SYSDG/wuyedb/spfilewuyedb.ora
ORA-15001: diskgroup "SYSDG" does not exist or is not mounted
ORA-06512: at line 4

diskgroup 还没有启动,需要启动起来

[oracle@testdb ~]$ export ORACLE_SID=+ASM
[oracle@testdb ~]$ export ORACLE_HOME=/u01/app/grid/product/11.2.0/crs
[oracle@testdb ~]$ cd /u01/app/grid/product/11.2.0/crs/bin
[oracle@testdb bin]$ ./sqlplus / as sysasm

SQL*Plus: Release 11.2.0.3.0 Production on Fri Dec 13 12:44:42 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Automatic Storage Management option

SQL> select name,state from v$asm_diskgroup;

NAME                           STATE
------------------------------ ----------------------
SYSDG                          DISMOUNTED
REDODG1                        DISMOUNTED
REDODG2                        DISMOUNTED
ARCHDG                         DISMOUNTED
DATADG1                        DISMOUNTED

SQL> alter diskgroup sysdg mount;

Diskgroup altered.

SQL> alter diskgroup REDODG1 mount;

Diskgroup altered.

SQL> alter diskgroup REDODG2 mount;

Diskgroup altered.

SQL> alter diskgroup ARCHDG mount;

Diskgroup altered.

SQL> alter diskgroup DATADG1 mount;

Diskgroup altered.

然后再去启动数据库!

其它说明:

1、默认情况下HAS(High Availability Service)是自动启动的.通过如下命令可以取消和启用自动启动  
    crsctl disable has  
    crsctl enable has  
2、HAS手动启动和停止  
    crsctl start has  
    crsctl stop has  
3、查看HAS的状态  
    crsctl check has  
4、ora.css和ora.diskmon服务随着HAS的启动而自动启动,那么你可以这两个服务的AUTO_START属性  
        crsctl modify resource "ora.cssd" -attr "AUTO_START=1"  
        crsctl modify resource "ora.diskmon" -attr "AUTO_START=1"  
        ora.css和ora.diskmon的Auto start   
        crsctl modify resource "ora.cssd" -attr "AUTO_START=never"  
        crsctl modify resource "ora.diskmon" -attr "AUTO_START=never"

最后说明,12c单实例重构has也是差不多的步骤

oracle11g asm standalone 单实例重建的更多相关文章

  1. ORACLE11g R2【单实例 FS→单实例FS】

    ORACLE11g R2[单实例 FS→单实例FS] 本演示案例所用环境:   primary standby OS Hostname pry std OS Version RHEL6.5 RHEL6 ...

  2. nbu恢复 oracle10g rac asm 到单实例asm(恢复某个表空间)

    一 检验条件 二 准备工作 1 创建相关目录 mkdir -p /oracle/admin/orcl/adumpmkdir -p /oracle/admin/orcl/bdumpmkdir -p /o ...

  3. ORACLE11g R2【RAC+ASM→单实例FS】

    ORACLE11g R2[RAC+ASM→单实例FS] 11g R2 RAC+ASMà单实例FS的DG,建议禁用OMF. 本演示案例所用环境:   primary standby OS Hostnam ...

  4. Linux平台oracle 11g单实例 + ASM存储 安装部署 快速参考

    操作环境:Citrix虚拟化环境中申请一个Linux6.4主机(模板)目标:创建单机11g + ASM存储 数据库 1. 主机准备 2. 创建ORACLE 用户和组成员 3. 创建以下目录并赋予对应权 ...

  5. Oracle DataBase单实例使用ASM案例(1)--ASM基本概念

    版权声明:本文为博主原创文章,未经博主允许不得转载. Oracle DataBase单实例使用ASM案例(1)--ASM基本概念 系统环境: 操作系统:RH EL5-64 Oracle 软件: Ora ...

  6. ORACLE10g R2【RAC+ASM→单实例FS】

    ORACLE10g R2[RAC+ASM→单实例FS] 10g R2 RAC+ASMà单实例FS的DG,建议禁用OMF. 本演示案例所用环境:   primary standby OS Hostnam ...

  7. centos部署oracle rac单实例11.2.0.3数据库(使用asm磁盘)

    部署oracle rac单实例数据库,需要安装grid和datavase两部分,所以首先创建两个用户oracle和grid,因为不能使用root用户进行安装,在安装之前首先需要修改一些系统参数和安装一 ...

  8. 2级搭建类201-Oracle 12cR2 单实例 ASM(OEL7.7)公开

    项目文档引子系列是根据项目原型,制作的测试实验文档,目的是为了提升项目过程中的实际动手能力,打造精品文档AskScuti. 项目文档引子系列除特定项目目前不对外发布,仅作为博客记录,其他公开.如学员在 ...

  9. Oracle11g 搭建单实例DataGuard (转载)

    原文:http://blog.itpub.net/29324876/viewspace-1246133/ 环境:主备库都为单实例并且数据库SID相同 OS:red hat 6.5 Oracle:11. ...

随机推荐

  1. Excel动态生成JSON

    在最近的一个项目中,有大量的数据源来至Excel,转成JSON供前台使用.Excel数据是人工录入的,难免会有错误,所以中间会有逻辑检查.在C#中读取Excel的方式有很多,网上一搜一大堆,这里我也贴 ...

  2. JAVA使用jdbc连接MYSQL简单示例

    以下展示的为JAVA使用jdbc连接MYSQL简单示例: import java.sql.DriverManager; import java.sql.ResultSet; import java.s ...

  3. 个人思考:能否sub.prototye=sup.prototype实现继承

    var Sup=function(name){ this.name=name; }; var Sub=function(name){ this.name=name; }; Sup.prototype. ...

  4. 最大二位子数组和问题(homework-02)

    前面已经谈过最大一维子数组和问题,这里面扩展到二维. 一. 常规情况 一个矩形的数组,找到一个矩形的子数组有最大的元素和,求这个和. 1. 从朴素算法入手,枚举矩形数组的4个顶点,以此计算其数组和.同 ...

  5. POJ 2253 Frogger (dijkstra 最大边最小)

    Til the Cows Come Home 题目链接: http://acm.hust.edu.cn/vjudge/contest/66569#problem/A Description The i ...

  6. 经典代码-C宏 #转字符串【瓦特芯 笔记】

    在调试C语言程序时,有时需要打印宏的名字.可以通过定义宏,宏名字的数组来获得. 例如: #include <stdio.h> #define MACRO_STR(x) {x, #x} ty ...

  7. 开源原生JavaScript插件-CJPCD(省市区联动)

    一.前言 上两篇博客笔者对 JavaScript Module 模式,闭包等知识点做了简单介绍之后,我们今天开始正式开发一款属于自己的 JavaScript 插件.由于最近项目刚好用到地区选择这一块的 ...

  8. HTML5学习笔记(一):HTML简介

    Web前端涵盖的内容较多且杂,主要由3个部分组成:HTML标记语言.CSS样式语言和JavaScript脚本语言组成,而下面我们将先学习最新的标记语言HTML5. <!DOCTYPE>标记 ...

  9. swift 个人笔记

    swift是现代编程语言的综合体,灵活而强大. //http://www.cocoachina.com/newbie/basic/2014/0604/8675.html //语法var 变量,let ...

  10. 看京东如何把Intel RealSense技术用在物流上

    提起Intel RealSense 3D 深度摄像头,总是离不开无人机.机器人等前沿硬件产品,比如 CES 2016 上让人眼前一亮的自动避障无人机Yuneec “台风 H”,Segway.Nineb ...