欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 运维知识 > windows >内容正文

windows

获取系统昨日最高峰时的AWR报告,get_hight_load_awr

发布时间:2025/7/14 windows 41 豆豆
生活随笔 收集整理的这篇文章主要介绍了 获取系统昨日最高峰时的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的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。