您好,登錄后才能下訂單哦!
以下內容為模擬操作,因為客戶核心數據庫是不允許把日志拿出來的哈。
不過處理過程和思路幾乎是一樣的。
一、故障描述
11G RAC -單機ADG,備端HAS服務無法啟動。
二、現象
查看了集群的各種日志,均無任何日志輸出。
[root@roidb2 bin]# pwd
/u01/app/11.2.0/grid/bin
[root@roidb2 bin]# ./crsctl start has
[root@roidb2 bin]# --無輸出,不提示報錯,也不提示成功啟動
[root@roidb2 bin]#
怎么辦,怎么辦?第一次遇到這樣的問題。問了客戶,說了周五做了搬遷工作,難道是磁盤出了問題,還是權限出了問題。按照這個思路查了一遍,也沒有什么發現。回過頭來,整理了一下思路,使用strace來看一下,也許會有意想不到的收獲。
[root@roidb2 bin]# strace ./crsctl start has
execve("./crsctl", ["./crsctl", "start", "has"], [/* 28 vars */]) = -1 ENOEXEC (Exec format error) --格式錯誤
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]#
為什么會是這樣的報錯,難道是文件又問題?繼續往下查..........
[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]#
怎么辦,怎么辦?我們知道這是一個腳本文件,那么,我們從其他節點copy一個文件怎么樣呢?
三、處理過程
--遠程傳輸一個文件過來唄
<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]#
--搞定
--學習官方都怎么寫腳本
[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]#
小結:
1.數據庫、主機的啟停一定要正常步驟進行,切記直接斷電。
2.搬遷之前,做好備份工作,移動安裝設備要注意輕拿輕放。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。