获取系统昨日最高峰时的AWR报告,get_hight_load_awr
生活随笔
收集整理的這篇文章主要介紹了
获取系统昨日最高峰时的AWR报告,get_hight_load_awr
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
運行get_hight_load_awr.sh,會自動收集昨日最高峰時刻的AWR報告,并上傳到FTP服務器
. /home/oracle/.profile
#get yestoday hight load time
cat >/tmp/select.sql<<EOF
spool /tmp/awrmax.txt
set echo off feedback off underline off;
. /home/oracle/.profile
export ORACLE_SID=czloans
cat >/tmp/select.sql<<EOF
spool /tmp/awrmax.txt
set echo off feedback off underline off;
set linesize 1000
SELECT SUM(decode(to_char(first_time, 'hh24'),'00',1,0)) "0",SUM(decode(to_char(first_time, 'hh24'),'01',1,0)) "1",SUM(decode(to_char(first_time, 'hh24'),'02',1,0)) "2",SUM(decode(to_char(first_time, 'hh24'),'03',1,0)) "3",SUM(decode(to_char(first_time, 'hh24'),'04',1,0)) "4",SUM(decode(to_char(first_time, 'hh24'),'05',1,0)) "5",SUM(decode(to_char(first_time, 'hh24'),'06',1,0)) "6",SUM(decode(to_char(first_time, 'hh24'),'07',1,0)) "7",SUM(decode(to_char(first_time, 'hh24'),'08',1,0)) "8",SUM(decode(to_char(first_time, 'hh24'),'09',1,0)) "9",SUM(decode(to_char(first_time, 'hh24'),'10',1,0)) "10",SUM(decode(to_char(first_time, 'hh24'),'11',1,0)) "11",SUM(decode(to_char(first_time, 'hh24'),'12',1,0)) "12",SUM(decode(to_char(first_time, 'hh24'),'13',1,0)) "13",SUM(decode(to_char(first_time, 'hh24'),'14',1,0)) "14",SUM(decode(to_char(first_time, 'hh24'),'15',1,0)) "15",SUM(decode(to_char(first_time, 'hh24'),'16',1,0)) "16",SUM(decode(to_char(first_time, 'hh24'),'17',1,0)) "17",SUM(decode(to_char(first_time, 'hh24'),'18',1,0)) "18",SUM(decode(to_char(first_time, 'hh24'),'19',1,0)) "19",SUM(decode(to_char(first_time, 'hh24'),'20',1,0)) "20",SUM(decode(to_char(first_time, 'hh24'),'21',1,0)) "21",SUM(decode(to_char(first_time, 'hh24'),'22',1,0)) "22",SUM(decode(to_char(first_time, 'hh24'),'23',1,0)) "23"
FROM v\$log_history
where to_char(first_time,'yyyy-mm-dd')=to_char((sysdate-1),'yyyy-mm-dd')
order by 1;
spool off
exit
EOF
sqlplus / as sysdba @/tmp/select.sql
rm /tmp/select.sql
htime=`awk 'NR==2{split($0,aa," ")}NR==3{maxidx=1;rst=$1;for(i=0;i<=NF;i++){if(rst<$i){rst=$i;maxidx=i;}};print aa[maxidx]}' /tmp/awrmax.txt`
rm /tmp/awrmax.txt
YESTODAY=`TZ=aaa24 date +%Y%m%d`
YESTIME=$YESTODAY$htime
echo $YESTIME
#get hight load snapshot id
m=`sqlplus -s /nolog <<EOFconn / as sysdba;set echo off feedback off heading off underline off;select snap_id from dba_hist_snapshot where to_char(begin_interval_time,'yyyymmddhh24')=\$YESTIME;exit;EOF`
j=$((m-0))
k=$((m-1))
#get hight load awrrptsqlplus / as sysdba <<EOF
@$ORACLE_HOME/rdbms/admin/awrrpt.sql;
html
1
${k}
${j}
/tmp/ftpfile/${ORACLE_SID}_awrrpt_1_${k}_${j}.html
EOF
#put awr to ftp
MONTH=`TZ=aaa24 date +%Y%m`
DAY=`TZ=aaa24 date +%d`
ftp -i -n 10.1.24.217 <<!
user admin 123456
bin
prompt off
cd /database/awr/$MONTH/$DAY
lcd /tmp/ftpfile
mput *
bye
!
?
轉載于:https://www.cnblogs.com/houzhiqing/p/6add1e9025edfd01ceceaa4446f87278.html
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的获取系统昨日最高峰时的AWR报告,get_hight_load_awr的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python字符类型的一些方法
- 下一篇: 【Linux开发】linux设备驱动归纳