oracle11g asm單例項重建has

datapeng發表於2013-12-13

最近到客戶那裡處理故障,客戶說,他們修改了一下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也是差不多的步驟

 

 

 

 

 


 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29371470/viewspace-1063175/,如需轉載,請註明出處,否則將追究法律責任。

相關文章