溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

11g生產(chǎn)數(shù)據(jù)庫crsctl start has無法啟動(dòng)故障處理

發(fā)布時(shí)間:2020-06-11 21:35:14 來源:網(wǎng)絡(luò) 閱讀:2250 作者:roidba 欄目:關(guān)系型數(shù)據(jù)庫

以下內(nèi)容為模擬操作,因?yàn)榭蛻艉诵臄?shù)據(jù)庫是不允許把日志拿出來的哈。
不過處理過程和思路幾乎是一樣的。

一、故障描述
11G RAC -單機(jī)ADG,備端HAS服務(wù)無法啟動(dòng)。

二、現(xiàn)象

查看了集群的各種日志,均無任何日志輸出。

[root@roidb2 bin]# pwd
/u01/app/11.2.0/grid/bin
[root@roidb2 bin]# ./crsctl start has
[root@roidb2 bin]# --無輸出,不提示報(bào)錯(cuò),也不提示成功啟動(dòng)
[root@roidb2 bin]# 

怎么辦,怎么辦?第一次遇到這樣的問題。問了客戶,說了周五做了搬遷工作,難道是磁盤出了問題,還是權(quán)限出了問題。按照這個(gè)思路查了一遍,也沒有什么發(fā)現(xiàn)?;剡^頭來,整理了一下思路,使用strace來看一下,也許會(huì)有意想不到的收獲。

[root@roidb2 bin]# strace ./crsctl start has
execve("./crsctl", ["./crsctl", "start", "has"], [/* 28 vars */]) = -1 ENOEXEC (Exec format error)  --格式錯(cuò)誤
dup(2)                                  = 3
fcntl(3, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)
fstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff367e29000
lseek(3, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
write(3, "strace: exec: Exec format error\n", 32strace: exec: Exec format error
) = 32
close(3)                                = 0
munmap(0x7ff367e29000, 4096)            = 0
exit_group(1)                           = ?
[root@roidb2 bin]# 

為什么會(huì)是這樣的報(bào)錯(cuò),難道是文件又問題?繼續(xù)往下查..........

[root@roidb2 bin]# ls -l crsctl
-rwxr-xr-x 1 root root 0 Dec 11 20:54 crsctl
[root@roidb2 bin]# file crsctl
crsctl: empty  --竟然是空文件!?。。。。。?[root@roidb2 bin]# 

怎么辦,怎么辦?我們知道這是一個(gè)腳本文件,那么,我們從其他節(jié)點(diǎn)copy一個(gè)文件怎么樣呢?

三、處理過程

--遠(yuǎn)程傳輸一個(gè)文件過來唄
<roidb1:+ASM1:/home/grid>$scp /u01/app/11.2.0/grid/bin/crsctl root@192.168.1.212:/u01/app/11.2.0/grid/bin/
root@192.168.1.212's password: 
crsctl                                                                                 100% 8574     8.4KB/s   00:00    
<roidb1:+ASM1:/home/grid>$
[root@roidb2 bin]# file crsctl         
crsctl: POSIX shell script text executable
[root@roidb2 bin]# ./crsctl start has  
CRS-4123: Oracle High Availability Services has been started.
[root@roidb2 bin]# 
--搞定
--學(xué)習(xí)官方都怎么寫腳本
[root@roidb2 bin]# cat crsctl
#!/bin/sh
#
# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 
# Notes:
#   - This script should only use clsecho.bin directly and not clsecho(which is
#     this same script).
#   - FIXME: crswrap should process hostname locally as well just like init.ohasd.

### Main ###
ORA_CRS_HOME=/u01/app/11.2.0/grid
MY_HOST=roidb1
ORACLE_USER=grid
ORACLE_HOME=/u01/app/11.2.0/grid
CRF_HOME=/u01/app/11.2.0/grid
export ORA_CRS_HOME ORACLE_HOME CRF_HOME

#limits
CRS_LIMIT_CORE=unlimited
CRS_LIMIT_MEMLOCK=unlimited
CRS_LIMIT_OPENFILE=65536
CRS_LIMIT_STACK=2048

#export the limit variables
export CRS_LIMIT_CORE CRS_LIMIT_MEMLOCK CRS_LIMIT_OPENFILE CRS_LIMIT_STACK

#listener
CRS_LSNR_STACK=10240
export CRS_LSNR_STACK

# Unset env var ORACLE_BASE before spawning any processes.
unset ORACLE_BASE

[ -z "$PERL" ] && PERL="/u01/app/11.2.0/grid/perl/bin/perl -I${ORA_CRS_HOME}/perl/lib"
LOGMSG="/bin/logger -puser.err"
CLSECHO="/u01/app/11.2.0/grid/bin/clsecho.bin"

PLATFORM=`/bin/uname`
case $PLATFORM in
Linux) 
       ORACLUSTER_LIB=/etc/ORCLcluster/lib
       LD_LIBRARY_PATH=/u01/app/11.2.0/grid/lib:$ORACLUSTER_LIB
       export LD_LIBRARY_PATH 

       # forcibly eliminate LD_ASSUME_KERNEL to ensure NPTL where available
       LD_ASSUME_KERNEL=
       export LD_ASSUME_KERNEL

       LOGGER="/usr/bin/logger"
       if [ ! -f "$LOGGER" ];then
        LOGGER="/bin/logger"
       fi
       LOGMSG="$LOGGER -puser.err"
       ;;
HP-UX) MACH_HARDWARE=`/bin/uname -m`
       if [ "$MACH_HARDWARE" = "ia64" ]; then
          SO_EXT=so
          NMAPIDIR_64=/opt/nmapi/nmapi2/lib/hpux64
          NMAPIDIR_32=/opt/nmapi/nmapi2/lib/hpux32
       else
          SO_EXT=sl
          NMAPIDIR_64=/opt/nmapi/nmapi2/lib/pa20_64
          NMAPIDIR_32=/opt/nmapi/nmapi2/lib
       fi 

       case $0 in
           */lsnodes|lsnodes)
               if [ ! -f $NMAPIDIR_64/libnmapi2.so -a ! -f $NMAPIDIR_32/libnmapi2.so ]; then
                   /bin/echo "No vendor clusterware installed."
                   exit 1
               fi
               ;;
       esac

       LD_LIBRARY_PATH=/u01/app/11.2.0/grid/lib:$NMAPIDIR_64:/usr/lib:$LD_LIBRARY_PATH
       SHLIB_PATH=/u01/app/11.2.0/grid/lib32:$NMAPIDIR_32:$SHLIB_PATH
       export LD_LIBRARY_PATH
       export SHLIB_PATH 
       ;;
SunOS) ARCH_NAME=`/bin/uname -p`
       if [ "${ARCH_NAME}" = "sparc" ]; then
           LD_LIBRARY_PATH_64=/u01/app/11.2.0/grid/lib:/opt/ORCLcluster/lib:/usr/lib/sparcv9:/usr/ucblib/sparcv9:$LD_LIBRARY_PATH_64
       else
           LD_LIBRARY_PATH_64=/u01/app/11.2.0/grid/lib:/opt/ORCLcluster/lib:/usr/lib/amd64:/usr/ucblib/amd64:$LD_LIBRARY_PATH_64
       fi
       LD_LIBRARY_PATH=/u01/app/11.2.0/grid/lib:/opt/ORCLcluster/lib:/usr/lib:/usr/ucblib:$LD_LIBRARY_PATH
       export LD_LIBRARY_PATH_64
       export LD_LIBRARY_PATH
       GREP='/usr/bin/grep'
       /usr/bin/coreadm | $GREP  'process core dumps' | $GREP  'enabled' > /dev/null
       STATUS1=$?
       /usr/bin/coreadm | $GREP  'global core dumps' | $GREP 'enabled' > /dev/null
       STATUS2=$?
       if [ "$STATUS1" != "0" ] && [ "$STATUS2" != "0" ];
       then
           /usr/bin/coreadm -e global > /dev/null 2>&1
       fi

       /usr/bin/coreadm | $GREP  'process setid' | $GREP 'enabled' > /dev/null
       STATUS1=$?
       /usr/bin/coreadm | $GREP  'global setid' | $GREP 'enabled' > /dev/null
       STATUS2=$?
       if [ "$STATUS1" != "0" ] && [ "$STATUS2" != "0" ];
       then
           /usr/bin/coreadm -e global-setid > /dev/null 2>&1
       fi

       # Solaris allows partitioning of resources by Projects.
       # On Solaris, start crsd/ohasd using the default Project of
       # the owner of the Grid Home. See bugs 9442360 / 5629487.
       PROJECT=`/usr/bin/projects -d $ORACLE_USER` 
       # If no project is set use the default root project
       if [ "$PROJECT" = "" ]; then
           PROJECT="user.root"
       fi
       ;;

AIX)   ORACLUSTER_LIB=/opt/ORCLcluster/lib 
       LIBPATH=/u01/app/11.2.0/grid/lib:$ORACLUSTER_LIB:/usr/lib
       LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH
       AIXTHREAD_SCOPE=S
       export LIBPATH
       export LD_LIBRARY_PATH
       export AIXTHREAD_SCOPE
       ;;
*)     /bin/echo "ERROR: Unknown Operating System"
       exit -1
       ;;
esac

# enable GIPCHA consistently along with root scripts
case $PLATFORM in
  Linux)
    GIPCD_PASSTHROUGH=false
    export GIPCD_PASSTHROUGH
    ;;
  HP-UX)
    GIPCD_PASSTHROUGH=false
    export GIPCD_PASSTHROUGH
    ;;
  SunOS)
    GIPCD_PASSTHROUGH=false
    export GIPCD_PASSTHROUGH
    ;;
  AIX)
    GIPCD_PASSTHROUGH=false
    export GIPCD_PASSTHROUGH
    ;;
  OSF1)
    ;;
esac

case $0 in
*.bin) 
    ORASYM=/u01/app/11.2.0/grid/bin/`basename $0 .bin`
    ;;
*)     
    ORASYM=$0.bin
    ;;
esac

export ORASYM

case $ORASYM in
*ocrpatch*)
     if [ ! -x $ORASYM ]
     then
       /bin/echo "NOTE:"
       /bin/echo "The ocrpatch binary is not part of the software distribution;"
       /bin/echo "ocrpatch can only be obtained and used by Oracle Support."
       exit -1
     fi
     ;;
*ocssd*)
     if [ "$PLATFORM" = "AIX" ]
     then
       UID=`id -u`
       if [ $UID -eq 0 ]; # do not want to do su in SIHA
       then
         SU='/bin/su'
         $SU $ORACLE_USER -c "/bin/sh -c 'ulimit -c unlimited; $ORASYM $@'"
         exit 0
       fi
     fi
     ;;
*ohasd*)
    CRSWRAPEXECE="/u01/app/11.2.0/grid/bin/crswrapexece.pl"
    ENV_FILE="${ORA_CRS_HOME}/crs/install/s_crsconfig_${MY_HOST}_env.txt"
    export ENV_FILE

    if [ ! -f "$CRSWRAPEXECE" ]
    then
      $LOGMSG "$CRSWRAPEXECE script is not found"
      exit 1;
    fi

    # we attempt to set limits here and check if return code is 0
    # if not we generate an alert using clsecho
    # see init.ohasd.sbs for a full rationale

    #STACK_SIZE limit. The goal is to reduce thread usage across the grid
    #infrastructure bottom up from the ohasd wrapper (Bug 9154152).
    #Only the soft limit is set so that any process even unpriviledged can
    #reincrease it up to the administrator set hard limit
    ulimit -Ss 2048
    if [ "$?" != "0" ]
        then
        $CLSECHO -p has -f crs -l -m 6021 "Ss" "2048"
    fi    

    case $PLATFORM in
    Linux) 
        # MEMLOCK limit is for Bug 9136459
        ulimit -l unlimited
        if [ "$?" != "0" ]
        then
            $CLSECHO -p has -f crs -l -m 6021 "l" "unlimited"
        fi
        ulimit -c unlimited
        if [ "$?" != "0" ]
        then
            $CLSECHO -p has -f crs -l -m 6021 "c" "unlimited"
        fi
        ulimit -n 65536
        if [ "$?" != "0" ]
        then
            $CLSECHO -p has -f crs -l -m 6021 "n" "65536"
        fi
        ;;
    *) 
        ulimit -c unlimited
        if [ "$?" != "0" ]
        then
            $CLSECHO -p has -f crs -l -m 6021 "c" "unlimited"
        fi
        ulimit -n 65536
        if [ "$?" != "0" ]
        then
            $CLSECHO -p has -f crs -l -m 6021 "n" "65536"
        fi
        ;;
    esac

    $LOGMSG "exec $PERL /u01/app/11.2.0/grid/bin/crswrapexece.pl $ENV_FILE $ORASYM \"$@\""
    exec $PERL /u01/app/11.2.0/grid/bin/crswrapexece.pl $ENV_FILE $ORASYM "$@"

    # Reached here only if exec fails
    /bin/echo "Failed to execute \"exec $PERL /u01/app/11.2.0/grid/bin/crswrapexece.pl $ENV_FILE $ORASYM \"$@\""
    $LOGMSG "Failed to execute \"exec $PERL /u01/app/11.2.0/grid/bin/crswrapexece.pl $ENV_FILE $ORASYM \"$@\""
    exit 1;
    ;;
*)
    if [ "$PLATFORM" = "AIX" ]
    then
      # Prevents the setting of RT_GRQ for non-ocssd and non-cssagent processes
      # RT_GRQ is turned on globally for all processes in the environment file
      # generated by s_crsconfig_lib.pm during install setup, for AIX platform.
      # This should prevent rdbms RT processes from inheriting this attribute
      # since crsd will not have RT_GRQ set.
      #
      # NOTE: cssdagent and monitor does not need a special case since they
      #       do not use this wrapper script. So the '*)' case here does not
      #       apply and they *will* inherit RT_GRQ attribute, as intended
      RT_GRQ=
      export RT_GRQ
    fi
    ;;
esac

# Solaris allows partitioning of resources by Projects.
# On Solaris, start crsd/ohasd using the default Project of
# the owner of the Grid Home. See bugs 9442360 / 5629487.
case $PLATFORM in
SunOS)
    case $ORASYM in
    *ohasd*|*crsd*)
         exec /usr/bin/newtask -p $PROJECT $ORASYM "$@"
         ;;
    *)
         exec $ORASYM "$@"
         ;;
    esac
    ;;
*)
    exec $ORASYM "$@"
    ;;
esac 
[root@roidb2 bin]# 

小結(jié):
1.數(shù)據(jù)庫、主機(jī)的啟停一定要正常步驟進(jìn)行,切記直接斷電。
2.搬遷之前,做好備份工作,移動(dòng)安裝設(shè)備要注意輕拿輕放。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI