In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you how to write Oracle performance troubleshooting automation scripts, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!
Enter Oracle Performance troubleshooting automation scripts: Perfbot Maria
Function: execute the script periodically, and send the waiting event of SQL statement for more than n minutes to SQL and the related execution plan and SQL monitor information to the operator in the form of e-mail.
Main script: pbm_wait.sh
#! / bin/bash
Export ORACLE_SID=$1
Export SQL='sqlplus / as sysdba'
Export EXEC_MIN=5
Export ORACLE_HOME=/opt/app/oracle/product/11GR2
Export PATH=$PATH:$ORACLE_HOME/bin
Export DIR=/home/oracle/dba/pb_maria
# export MY_DATE= `date'+% d% b% yearly% k% M``
Export LOG=$ {DIR} / pbm_$ {ORACLE_SID} _ wait.log
Export RESULT=pbm_$ {ORACLE_SID} _ wait.result
Export TEMP_RESULT=pbm_$ {ORACLE_SID} _ wait_temp.result
Export FINAL_RESULT=pbm_wait_$ {ORACLE_SID} _ final.result
Export GRACE=pbm_$ {ORACLE_SID} _ grace.log
Export COUNT=1
Export MAIL='mailx-s "Perfbot maria report of DB $ORACLE_SID"'
Cd $DIR
$SQL > / dev/null $RESULT
For i in `awk'{print $2}'$RESULT`
Do
Array [$COUNT] = $I
COUNT=$ (($COUNT+1))
Done
If [$COUNT-ne 1]
Then
For ((iTun1; I > $TEMP_RESULT)
Fi
Done
Fi
If [[- e $TEMP_RESULT]]; then
Sort-u $TEMP_RESULT > $FINAL_RESULT
COUNT=1
For i in `awk'{print $1}'$FINAL_ RESULT`
Do
Array [$COUNT] = $I
COUNT=$ (($COUNT+1))
Done
For ((iTunes 1; I / dev/null'& & 1century Magazine type = > 'text') from dual
/
Attachments do not seem to be supported here. Note as follows:
Note that the script must be used in the / home/oracle/dba/pb_maria path; create results and reports paths under that path to store historical information.
Cronjob I set it every 5 minutes.
This script requires the Oracle database server to connect to the Internet in order to send mail. If it is a private network machine, you can consider adding a mail server where both private and public networks are located, and transmit the information of the mail you need to send to this mail server, and then send the mail regularly.
These are all the contents of the article "how to write automated scripts for troubleshooting Oracle performance problems". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.