Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3670039
  • 博文数量: 715
  • 博客积分: 1860
  • 博客等级: 上尉
  • 技术积分: 7745
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-07 08:51
个人简介

偶尔有空上来看看

文章分类

全部博文(715)

文章存档

2023年(75)

2022年(134)

2021年(238)

2020年(115)

2019年(11)

2018年(9)

2017年(9)

2016年(17)

2015年(7)

2014年(4)

2013年(1)

2012年(11)

2011年(27)

2010年(35)

2009年(11)

2008年(11)

分类: Oracle

2011-08-19 15:46:04

Script GetAsmDH.sh

#!/bin/sh
mkdir /tmp/HC 2> /dev/null
rm -f /tmp/HC/asmdisks.lst 2> /dev/null
rm -f /tmp/HC/asm_diskh.sh 2> /dev/null
echo " "
echo "############################################"
echo " 1) Collecting Information About the Disks:"
echo "############################################"
sqlplus '/nolog' set linesize 90
col path format a60
set heading off
set head off
set feedback off
spool /tmp/HC/asmdisks.lst
select group_number,disk_number,path from v\$asm_disk_stat where group_number > 0 order by group_number,disk_number;
spool off;
eof
echo " "
echo " "
ls -l /tmp/HC/asmdisks.lst

echo " "
echo "############################################"
echo " 2) Generating "asm_diskh.sh" script."
echo "############################################"
echo " "
grep -v SQL /tmp/HC/asmdisks.lst > /tmp/HC/asmdisks_tmp.lst
mv /tmp/HC/asmdisks_tmp.lst /tmp/HC/asmdisks.lst
sed 's/ORCL:/\/dev\/oracleasm\/disks\//g' /tmp/HC/asmdisks_NEW.lst
mv /tmp/HC/asmdisks_NEW.lst /tmp/HC/asmdisks.lst
 
cat /tmp/HC/asmdisks.lst|while read LINE
do
comm=`echo $LINE|awk '{print "dd if="$3 " of=/tmp/HC/dsk_"$1"_"$2".dd bs=1048576 count=1"}'`
echo $comm >> /tmp/HC/asm_diskh.sh
done
chmod 700 /tmp/HC/asm_diskh.sh
ls -l /tmp/HC/asm_diskh.sh
echo " "
echo "############################################"
echo " 3) Executing asm_diskh.sh script to "
echo " generate dd dumps."
echo "############################################"
echo " "

### For display only
/tmp/HC/asm_diskh.sh 2> /dev/null
ls -l /tmp/HC/*dd
echo " "
echo "############################################"
echo " 4) Compressing dd dumps in the next format:"
echo " (asm_dd_header_all_.tar)"
echo "############################################"
echo " "
 

NOW=$(date +"%m-%d-%Y_%T")
tar -cvf /tmp/HC/asm_dd_header_all_$NOW.tar /tmp/HC/*.dd 2> /dev/null
compress /tmp/HC/asm_dd_header_all_$NOW.tar
ls -l /tmp/HC/*.Z
 
阅读(3113) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~