Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Some improvements of OSW

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Increase the detection of process running status and restart automatically if there is an exception

Since osw is not a daemon, you are likely to forget to start it after downtime and maintenance, and there is a lack of valid data in subsequent problem analysis, so you can configure osw as crontab to avoid the loss of collected data after the host restarts.

[oracle@rac11g1 oswbb] $cat oswcheck.sh

#! / bin/sh

#

# Copyright (c) 2016 by Ducw

# oswcheck.sh

# This program check OSWatcher run status, if not run, start OSWatcher

# oswcheck crontab config

# 1 * / oracle/oswbb/oswcheck.sh > / oracle/oswbb/oswcheck.log 2 > / oracle/oswbb/oswcheck.err

#

OSWRUNFLAG= `ps-ef | grep OSWatcher.sh | grep-v grep | wc-l`

CHECKDATA= `date "+% Y-%m-%d% H:%M:%S" `

If [[${OSWRUNFLAG}-eq 1]]; then

Echo "="

Echo "OSWatcher is running at" ${CHECKDATA}

Echo "="

Echo ""

Else

Echo "="

Echo "OSWatcher is not running at" ${CHECKDATA}

Echo "="

Echo ""

Echo "Begin to start startOSWbb.sh"

Cd / oracle/oswbb

Nohup. / startOSWbb.sh 10 72 &

Fi

Configure crontab

[oracle@rac11g1 oswbb] $crontab-l

1* / oracle/oswbb/oswcheck.sh > / oracle/oswbb/oswcheck.log 2 > / oracle/oswbb/oswcheck.err

two。 Adjust ps output process information

By default, all the process information will be output. For the database host, there will be more information. Every time sr is opened, huge file uploads are also a problem. Therefore, only the process information of the top 100 with high CPU usage or the top 100 processes of memory usage are output, which is much faster. Of course, there are some cases in which some useful information is lost.

[oracle@rac11g1 oswbb] $cat psmemsub.sh

HP-UX | HI-UX)

UNIX95=1 ps-e-o user,pid,ppid,pri,pcpu,cpu,vsz,sz,wchan,state,etime,args | head-1 > > $1

UNIX95=1 ps-e-o user,pid,pcpu,ppid,pri,cpu,vsz,sz,wchan,state,etime,args | sort-nr-k 3 | head-100 > > $1

3. New heartbeat network card monitoring

This information comes from MOS, and the monitoring of heartbeat network card is particularly important in RAC environment.

Set up communication check between private networks:

A) copy Exampleprivate.net as private.net to the same directory.

b)。 Find your corresponding system platform in private.net, and replace the following private_nodename1. Private_nodename2 is the specific private network IP or host name.

Traceroute-r-F private_nodename1

Traceroute-r-F private_nodename2

c)。 Delete the rest of the platform in private.net.

d)。 Never delete the following:

Rm locks/lock.file

4. Quickly analyze the utilization of CPU/ memory in a certain period of time

The paste command in Linux can splice the records of multiple files and display them at the same time. The data form of oswtop is as follows, including time information and cpu usage information. So we can intercept the contents of these two parts, splice them into a file, and then sort specific fields. This can help us quickly locate the time when the load is high. Of course, you can also use the form of java graphics tools. I just feel that the way of script customization is more convenient and independent of the environment.

Of course, this method can also be applied to the analysis of memory and other information.

Zzz * Wed Jan 27 08:53:08 CST 2016

Top-08:53:10 up 9 min, 3 users, load average: 1.22,2.01,1.27

Tasks: 259 total, 2 running, 257 sleeping, 0 stopped, 0 zombie

Cpu (s): 1.0%us, 0.0%sy, 0.0%ni, 99.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

Mem: 4050948k total, 3643476k used, 407472k free, 217272k buffers

Swap: 4095992k total, 0k used, 4095992k free, 1929572k cached

[root@rac11g1 oswtop] # cat rac11g1_top_16.01.27.0800.dat | grep ^ zzz > top_time.txt

[root@rac11g1 oswtop] # cat rac11g1_top_16.01.27.0800.dat | grep ^ Cpu > top_cpu.txt

[root@rac11g1 oswtop] # paste-d''top_time.txt top_cpu.txt > result.txt

[root@rac11g1 oswtop] # cat result.txt

Zzz * * Wed Jan 27 08:49:08 CST 2016 Cpu (s): 3.0%us, 1.0%sy, 0.0%ni, 94.1%id, 2.0%wa, 0.0%hi, 0.0%si, 0.0%st

Zzz * * Wed Jan 27 08:49:38 CST 2016 Cpu (s): 1.0%us, 1.0%sy, 0.0%ni, 98.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

Zzz * * Wed Jan 27 08:50:08 CST 2016 Cpu (s): 2.0%us, 0.0%sy, 0.0%ni, 96.1%id, 0.0%wa, 1.0%hi, 1.0%si, 0.0%st

Zzz * Wed Jan 27 08:50:38 CST 2016 Cpu (s): 0.0%us, 0.0%sy, 0.0% nipgy 100.0% id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

Zzz * * Wed Jan 27 08:51:08 CST 2016 Cpu (s): 1.0%us, 0.0%sy, 0.0%ni, 99.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

Zzz * * Wed Jan 27 08:51:38 CST 2016 Cpu (s): 14.0%us, 1.0%sy, 0.0%ni, 85.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

Zzz * * Wed Jan 27 08:52:08 CST 2016 Cpu (s): 1.0%us, 0.0%sy, 0.0%ni, 99.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

Zzz * * Wed Jan 27 08:52:38 CST 2016 Cpu (s): 1.0%us, 1.9%sy, 0.0%ni, 78.6%id, 17.5%wa, 1.0%hi, 0.0%si, 0.0%st

Zzz * * Wed Jan 27 08:53:08 CST 2016 Cpu (s): 1.0%us, 0.0%sy, 0.0%ni, 99.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

Zzz * * Wed Jan 27 08:53:38 CST 2016 Cpu (s): 2.0%us, 2.0%sy, 0.0%ni, 95.1%id, 0.0%wa, 1.0%hi, 0.0%si, 0.0%st

Zzz * * Wed Jan 27 08:54:09 CST 2016 Cpu (s): 1.0%us, 0.0%sy, 0.0%ni, 98.0%id, 0.0%wa, 0.0%hi, 1.0%si, 0.0%st

Zzz * * Wed Jan 27 08:54:39 CST 2016 Cpu (s): 1.0%us, 1.0%sy, 0.0%ni, 98.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

Zzz * * Wed Jan 27 08:55:09 CST 2016 Cpu (s): 2.0%us, 2.0%sy, 0.0%ni, 96.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

Zzz * * Wed Jan 27 08:55:39 CST 2016 Cpu (s): 1.0%us, 2.0%sy, 0.0%ni, 96.1%id, 0.0%wa, 1.0%hi, 0.0%si, 0.0%st

Zzz * * Wed Jan 27 08:56:09 CST 2016 Cpu (s): 5.9%us, 2.0%sy, 0.0%ni, 87.3%id, 4.9%wa, 0.0%hi, 0.0%si, 0.0%st

[root@rac11g1 oswtop] # sort-n-k 9 result.txt sorted content

.

Zzz * * Wed Jan 27 08:55:39 CST 2016 Cpu (s): 1.0%us, 2.0%sy, 0.0%ni, 96.1%id, 0.0%wa, 1.0%hi, 0.0%si, 0.0%st

Zzz * * Wed Jan 27 08:50:08 CST 2016 Cpu (s): 2.0%us, 0.0%sy, 0.0%ni, 96.1%id, 0.0%wa, 1.0%hi, 1.0%si, 0.0%st

Zzz * * Wed Jan 27 08:53:38 CST 2016 Cpu (s): 2.0%us, 2.0%sy, 0.0%ni, 95.1%id, 0.0%wa, 1.0%hi, 0.0%si, 0.0%st

Zzz * * Wed Jan 27 08:55:09 CST 2016 Cpu (s): 2.0%us, 2.0%sy, 0.0%ni, 96.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

Zzz * * Wed Jan 27 08:49:08 CST 2016 Cpu (s): 3.0%us, 1.0%sy, 0.0%ni, 94.1%id, 2.0%wa, 0.0%hi, 0.0%si, 0.0%st

Zzz * * Wed Jan 27 08:56:09 CST 2016 Cpu (s): 5.9%us, 2.0%sy, 0.0%ni, 87.3%id, 4.9%wa, 0.0%hi, 0.0%si, 0.0%st

Zzz * * Wed Jan 27 08:51:38 CST 2016 Cpu (s): 14.0%us, 1.0%sy, 0.0%ni, 85.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

Because the files are generated in chronological order, the time and the corresponding resource utilization can correspond consistently. The rest of the job is to play freely. Of course, you can also write more elegant shell scripts.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report