使用10gR2 CRS搭建HA環境 & 一些測試結果

westzq1984發表於2013-07-03
本文只是簡單的功能性測試

1.1根心跳線
斷了就發生驅逐,磁碟心跳不足以支撐叢集

2.2根心跳線
只要有1個通就OK,可以配置多個心跳,所有網路設定為cluster_interconnect

3.public網路卡宕
資源飄到正常節點

4.單例項是否依賴CRS
DB軟體在rac_on模式需要,rac_off模式不需要

5.如何設定資源的主節點
-p favored -h "nodename"
 
6.如何設定資源在主節點恢復後,自動飄回來
-o ap=1

7.PUBLIC新增備份網路卡
原生的VIP可以新增,Define VIP with multiple interfaces to allow the failover capability [ID 783633.1]
自己新增的HAIP資源如何搞,還需要研究

8.指令碼配置注意
stop資源的指令碼,必須要確保返回為0
否則資源將進入unknow的狀態,需要人工介入

/u01/app/oracle/product/crs/bin/crs_profile -create db01vip -t application -a /u01/app/oracle/product/crs/bin/usrvip -o i=eth1,ov=83.16.16.33,on=255.255.255.0
/u01/app/oracle/product/crs/bin/crs_register db01vip
/u01/app/oracle/product/crs/bin/crs_setperm db01vip -o root
/u01/app/oracle/product/crs/bin/crs_setperm db01vip -u user:oracle:r-x
/u01/app/oracle/product/crs/bin/crs_start db01vip

/u01/app/oracle/product/crs/bin/crs_profile -create fs_database1 -t application -d "Filesystem data1" -r db01vip -a /u01/app/oracle/product/crs/crs/public/action_FS_database1.scr -o ci=5,ra=60
/u01/app/oracle/product/crs/bin/crs_register fs_database1
/u01/app/oracle/product/crs/bin/crs_setperm fs_database1 -o root
/u01/app/oracle/product/crs/bin/crs_setperm fs_database1 -u user:oracle:r-x
/u01/app/oracle/product/crs/bin/crs_start fs_database1

/u01/app/oracle/product/crs/bin/crs_profile -create oradb01 -t application -d "Oracle instance 01" -r "db01vip fs_database1" -a /u01/app/oracle/product/crs/crs/public/action_DB_db01.scr -h "westzq3" -p favored -o ci=5,ra=60,ap=1
/u01/app/oracle/product/crs/bin/crs_register oradb01
/u01/app/oracle/product/crs/bin/crs_setperm oradb01 -o root
/u01/app/oracle/product/crs/bin/crs_setperm oradb01 -u user:oracle:r-x
/u01/app/oracle/product/crs/bin/crs_start oradb01

[root@westzq3 public]# cat action_FS_database1.scr
#!/bin/sh
# *****************************************************************
# *                                                               *
# *    Copyright (c) 2002, 2003 Oracle Corporation.               *
# *         All rights reserved.                                  *
# *                                                               *
# *    Copyright (c) 1991, 1999, 2002 Digital Equipment           *
# *                  Corporation                                  *
# *                                                               *
# *                                                               *
# *   All Rights Reserved.  Unpublished rights  reserved  under   *
# *   the copyright laws of the United States.                    *
# *                                                               *
# *   The software contained on this media  is  proprietary  to   *
# *   and  embodies  the  confidential  technology  of  Digital   *
# *   Equipment Corporation and Oracle Corporation.  Possession,  *
# *   use, duplication or dissemination of the software           *
# *   and media is authorized only pursuant to a valid written    *
# *   license from Digital Equipment Corporation and Oracle       *
# *   Corporation                                                 *
# *                                                               *
# *   RESTRICTED RIGHTS LEGEND   Use, duplication, or disclosure  *
# *   by the U.S. Government is subject to restrictions  as  set  *
# *   forth in Subparagraph (c)(1)(ii)  of  DFARS  252.227-7013,  *
# *   or  in  FAR 52.227-19, as applicable.                       *
# *                                                               *
# *                                                               *
# *****************************************************************
#

SCRIPT=$0
ACTION=$1                     # Action (start, stop or check)

#########################################################################
#
# Main section of Action Script. - starts, stops, or checks an application
#       
# This script. is invoked by CRS when managing the application associated
# with this script.
#
# Argument:  $1 - start | stop | check
#
# Returns:   0 - successful start, stop, or check
#            1 - error
#
#########################################################################

#
# Start section - start the process and report results
#
# If the Application Startup Commands (see description above) were used,
# little, if any modifications are needed in this section.  If not used,
# you may replace most of the contents in this section with your own
# start procedure code.
#

case $1 in
'start')
    /bin/mount /dev/mapper/oravg-lv_db01 /database1
    exit $?
    ;;

#
# Stop section - stop the process and report results
#
# If the Application Stop Commands or Associated Processes (see descriptions
# above) were used,little, if any modifications are needed in this section.
# If not used, you may replace most of the contents in this section with
# your own stop procedure code.
#

'stop')
    umount /database1
    exit $?
    ;;

#
# Check section - check the process and report results
#
#
# Your application might allow you to implement more accurate process
# checking.  If so, you may choose to implement that code here. 
#
'check')
    if [[ `/bin/mount|grep database1|wc -c` -eq 0 ]]
    then
       exit 1
    else
       exit 0
    fi
    ;;

*)
    echo "usage: $0 {start stop check}"
    ;;

esac

exit 0

[root@westzq3 public]# cat action_DB_db01.scr
#!/bin/sh
# *****************************************************************
# *                                                               *
# *    Copyright (c) 2002, 2003 Oracle Corporation.               *
# *         All rights reserved.                                  *
# *                                                               *
# *    Copyright (c) 1991, 1999, 2002 Digital Equipment           *
# *                  Corporation                                  *
# *                                                               *
# *                                                               *
# *   All Rights Reserved.  Unpublished rights  reserved  under   *
# *   the copyright laws of the United States.                    *
# *                                                               *
# *   The software contained on this media  is  proprietary  to   *
# *   and  embodies  the  confidential  technology  of  Digital   *
# *   Equipment Corporation and Oracle Corporation.  Possession,  *
# *   use, duplication or dissemination of the software           *
# *   and media is authorized only pursuant to a valid written    *
# *   license from Digital Equipment Corporation and Oracle       *
# *   Corporation                                                 *
# *                                                               *
# *   RESTRICTED RIGHTS LEGEND   Use, duplication, or disclosure  *
# *   by the U.S. Government is subject to restrictions  as  set  *
# *   forth in Subparagraph (c)(1)(ii)  of  DFARS  252.227-7013,  *
# *   or  in  FAR 52.227-19, as applicable.                       *
# *                                                               *
# *                                                               *
# *****************************************************************
#

SCRIPT=$0
ACTION=$1                     # Action (start, stop or check)

#########################################################################
#
# Main section of Action Script. - starts, stops, or checks an application
#       
# This script. is invoked by CRS when managing the application associated
# with this script.
#
# Argument:  $1 - start | stop | check
#
# Returns:   0 - successful start, stop, or check
#            1 - error
#
#########################################################################

#
# Start section - start the process and report results
#
# If the Application Startup Commands (see description above) were used,
# little, if any modifications are needed in this section.  If not used,
# you may replace most of the contents in this section with your own
# start procedure code.
#

case $1 in
'start')
    su - oracle -c "/u01/app/oracle/product/crs/crs/public/start_db.sh"
    exit $?
    ;;

#
# Stop section - stop the process and report results
#
# If the Application Stop Commands or Associated Processes (see descriptions
# above) were used,little, if any modifications are needed in this section.
# If not used, you may replace most of the contents in this section with
# your own stop procedure code.
#

'stop')
    su - oracle -c "/u01/app/oracle/product/crs/crs/public/stop_db.sh"
    exit $?
    ;;

#
# Check section - check the process and report results
#
#
# Your application might allow you to implement more accurate process
# checking.  If so, you may choose to implement that code here. 
#
'check')
    if [[ `/bin/ps -ef|grep ora_smon_db01|grep -v grep|wc -c` -eq 0 ]]
    then
       exit 1
    else
       exit 0
    fi
    ;;

*)
    echo "usage: $0 {start stop check}"
    ;;

esac

exit 0


[root@westzq3 public]# cat st
start_db.sh  stop_db.sh  
[root@westzq3 public]# cat start_db.sh
lsnrctl start
export ORACLE_SID=db01
sqlplus "/as sysdba" <startup
exit
EOF
if [[ $? -eq 1 ]]
then
  exit 0
else
  exit 1
fi
[root@westzq3 public]# cat stop_db.sh
lsnrctl stop
export ORACLE_SID=db01
sqlplus "/as sysdba" <shutdown immediate
exit
EOF
exit 0

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

相關文章