Applies to:
Linux OS – Version: 1.4
Linux x86
Linux x86-64
Purpose
This support script is to collect diagnostic information to assist in service request troubleshooting and resolution. It gathers OCFS2 relevant information on your system and generate output in the command line output.
It only collects diagnostic information and will not do any change on your system.
Software Requirements/Prerequisites
This is a bash script and is only supported to run on RHEL/OEL 4, RHEL/OEL 5, and Oracle VM.
Configuring the Script
Ensure the execute bit on the script is turned on.
# chmod +x dc_ocfs2.shRunning the Script
Run the script with root user.
# ./dc_ocfs2.sh > ocfs2info.log 2>&1It will finish in a couple of seconds with an output file named “ocfs2info.log”.
Caution
This script is provided for educational purposes only and not supported by Oracle Support Services. It has been tested internally, however, and works as documented. We do not guarantee that it will work for you, so be sure to test it in your environment before relying on it. Proofread this script before using it! Due to the differences in the way text editors, e-mail packages and operating systems handle text formatting (spaces, tabs and carriage returns), this script may not be in an executable state when you first receive it. Check over the script to ensure that errors of this type are corrected.
Script
#!/bin/sh
#
# $Id: dc_ocfs2.sh,v 1.11 2009/11/26 10:05:26 rwen Exp $
#
# collect ocfs2 relevant info on localhost
#
run_cmd()
{
local basecmd="${1%% *}"
if type $basecmd >/dev/null 2>&1
then
echo "# $1"
eval "$1"
else
echo "# command not exist: $basecmd"
fi
}
dump_proc()
{
local ENTRY="$1"
local LEVEL="$2"
LEVEL=$((LEVEL + 1))
if [ $LEVEL -gt 5 ]
then
echo "potential loop detected."
return 2
fi
if [ ! -e "$ENTRY" ]
then
return 1
elif [ -f "$ENTRY" ]
then
run_cmd "cat $ENTRY"
fi
find "$ENTRY" -maxdepth 1 | while read FILE
do
if [ "$FILE" = "$ENTRY" ]
then
continue
fi
if [ -L "$FILE" ]
then
realfile=`readlink "$FILE"`
if echo "$realfile" | grep -q '^..*'
then
FILE="${FILE%/*}/${realfile}"
fi
dump_proc "$FILE" "$LEVEL"
fi
if [ -f "$FILE" ]
then
run_cmd "cat $FILE"
elif [ -d "$FILE" ]
then
dump_proc "$FILE" "$LEVEL"
else
echo "Ignore"
fi
done
}
basic_info()
{
run_cmd "date"
run_cmd "uname -a"
run_cmd "id"
run_cmd "hostname"
run_cmd "getenforce"
}
network_info()
{
run_cmd "ifconfig -a"
run_cmd "route -n"
run_cmd "grep -vE '(^;.*|^$)' /etc/resolv.conf"
run_cmd "arp -an"
run_cmd "netstat -s"
}
check_ocfs2()
{
echo "Collecting package info ..." >&2
# packages level
run_cmd "rpm -qa --qf='%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' | grep -E '(kernel|ocfs2)'"
for i in `rpm -qa | grep ocfs2`
do
run_cmd "rpm -V $i"
done
echo "Collecting static configuration and run-time info ..." >&2
# driver module
run_cmd "modinfo ocfs2"
run_cmd "lsmod | grep ocfs"
# static configuration
run_cmd "grep -vE '(^#.*|^$)' /etc/sysconfig/o2cb"
run_cmd "grep -vE '(^#.*|^$)' /etc/ocfs2/cluster.conf"
run_cmd "grep -vE '(^#.*|^$)' /etc/fstab"
run_cmd "grep -vE '(^#.*|^$)' /etc/hosts"
# runtime status
run_cmd "/etc/init.d/o2cb status"
run_cmd "/etc/init.d/ocfs2 status"
echo "# Checking heartbeat..."
dump_proc /sys/kernel/config/cluster/ocfs2/
dump_proc /sys/kernel/debug/o2hb
# disk info
run_cmd "blkid | grep ocfs2"
run_cmd "mount | grep ocfs2"
run_cmd "mounted.ocfs2 -f"
run_cmd "mounted.ocfs2 -d"
# logs
run_cmd "dmesg | grep -E '(Linux version|ocfs2|o2net|dlm)'"
run_cmd "tail -n10000 /var/log/messages | grep -E '(Linux version|ocfs2|o2net|dlm)'"
for dev in `get_dev_list`
do
echo "Collecting info on $dev ..." >&2
check_one_device $dev
done
}
get_dev_list()
{
(blkid | grep ocfs2 | cut -d: -f1;mount | grep ocfs2 | grep -v ocfs2_dlm | awk '{ print $1 }') | sort | uniq
}
check_one_device()
{
local DEBUGFS="debugfs.ocfs2"
local DEV="$1"
run_cmd "tunefs.ocfs2 -q -Q 'Block size:%B\nCluster size:%T\nNum of Nodes:%N\nVolume Label:%V\nVolume UUID:%U\n' $DEV"
run_cmd "echo stats | ${DEBUGFS} $DEV" 2>&1
run_cmd "echo hb | ${DEBUGFS} $DEV" 2>&1
run_cmd "sleep 2"
run_cmd "echo hb | ${DEBUGFS} $DEV" 2>&1
run_cmd "echo 'stat //global_bitmap' | ${DEBUGFS} -n ${DEV}"
run_cmd "echo 'stat //global_inode_alloc' | ${DEBUGFS} -n ${DEV}"
run_cmd "echo 'stat //slot_map' | ${DEBUGFS} -n ${DEV}"
run_cmd "echo 'stat //heartbeat' | ${DEBUGFS} -n ${DEV}"
local SLOTS=`tunefs.ocfs2 -q -Q "%N\n" $DEV`
for i in `seq --format="%04g" 0 $[${SLOTS}-1]`
do
INODE=//inode_alloc:$i
EXTNT=//extent_alloc:$i
LOCAL=//local_alloc:$i
TRUNC=//truncate_log:$i
JOURN=//journal:$i
ORPHN=//orphan_dir:$i
run_cmd "echo stat ${INODE} | ${DEBUGFS} -n ${DEV}"
run_cmd "echo stat ${EXTNT} | ${DEBUGFS} -n ${DEV}"
run_cmd "echo stat ${LOCAL} | ${DEBUGFS} -n ${DEV}"
run_cmd "echo stat ${TRUNC} | ${DEBUGFS} -n ${DEV}"
run_cmd "echo stat ${JOURN} | ${DEBUGFS} -n ${DEV}"
run_cmd "echo ls -l ${ORPHN} | ${DEBUGFS} -n ${DEV}"
done
}
#
# main routine starts here
#
basic_info
network_info
check_ocfs2
run_cmd "date"
Script Output
The script will generate the following output, and all the diagnostic logs will be written to ocfs2info.log.
# ./dc_ocfs2.sh > ocfs2info.log 2>&1
Collecting package info ...
Collecting static configuration and run-time info ...
Collecting info on /dev/sdb ...
Collecting info on /dev/sdc ...
You can check it by a text viewer or editor. At the same time, please attach it to the corresponding service request for further review.
© 2010, www.oracledatabase12g.com. 版权所有.文章允许转载,但必须以链接方式注明源地址,否则追究法律责任.
相关文章 | Related posts:
- Collecting Diagnostic information for Oracle block corruption
- Data Gathering for Troubleshooting RAC Issues
- Script to Collect RAC Diagnostic Information (racdiag.sql)
- Data gathering for troubleshooting Oracle Real Application Cluster issues
- Data Gathering for Troubleshooting CRS Issues
- Script to Collect Data Guard Diagnostic Information
- Extracting Data from a Corrupt Table using DBMS_REPAIR or Event 10231
- RMAN 11G : Data Recovery Advisor – RMAN command line example
- How to resize an OCFS2 filesystem
- SCRIPT TO CHECK FOR FOREIGN KEY LOCKING ISSUES




最新评论