Script para Automatizar as Tarefas no Oracle
Este post pode ser um pouco passado para muitos DBAs, mas para quem está começando e planeja automatizar algumas tarefas, as dicas aqui pode ser de extrema utilidade! Estou começando.
Opção 1;
-------------------------------------------------------------------------------------------------
29/10/2013 ***** ORACLE BASIC SERVICES ***** 16:14:17
-------------------------------------------------------------------------------------------------
s120.ms - 10.2.19.4 - oracle
Code Basic Services Code Basic Services
---- --------------------------- ---- ---------------------------
1 Performance/Desempenho 12 XXXXXXXXXXXXXXXXXXXXXXXXXX
2 XXXXXXXXXXXXXXXXXXXXXXXXXX 13 XXXXXXXXXXXXXXXXXXXXXXXXXX
3 XXXXXXXXXXXXXXXXXXXXXXXXXX 14 XXXXXXXXXXXXXXXXXXXXXXXXXX
4 XXXXXXXXXXXXXXXXXXXXXXXXXX 15 XXXXXXXXXXXXXXXXXXXXXXXXXX
5 XXXXXXXXXXXXXXXXXXXXXXXXXX 16 XXXXXXXXXXXXXXXXXXXXXXXXXX
6 XXXXXXXXXXXXXXXXXXXXXXXXXX 17 XXXXXXXXXXXXXXXXXXXXXXXXXX
7 XXXXXXXXXXXXXXXXXXXXXXXXXX 18 XXXXXXXXXXXXXXXXXXXXXXXXXX
8 XXXXXXXXXXXXXXXXXXXXXXXXXX 19 XXXXXXXXXXXXXXXXXXXXXXXXXX
9 XXXXXXXXXXXXXXXXXXXXXXXXXX 20 XXXXXXXXXXXXXXXXXXXXXXXXXX
10 XXXXXXXXXXXXXXXXXXXXXXXXXX 21 XXXXXXXXXXXXXXXXXXXXXXXXXX
11 XXXXXXXXXXXXXXXXXXXXXXXXXX 0 Sair da Aplicacao
---- --------------------------- ---- ---------------------------
Digita um Codigo -
Opção 1;
-------------------------------------------------------------------------------------------------
29/10/2013 ***** ORACLE BASIC SERVICES ***** 16:14:39
-------------------------------------------------------------------------------------------------
Instancias Online 3 - 10.2.19.4 - oracle
Code Function
---- --------------------------- ---- ---------------------------
1 SAR - Performance da CPU 12 XXXXXXXXXXXXXXXXXXXXXXXXXX
2 Consumo de Memoria 13 XXXXXXXXXXXXXXXXXXXXXXXXXX
3 Consumo de Espaco em Disco 14 XXXXXXXXXXXXXXXXXXXXXXXXXX
4 Instancias Online 15 XXXXXXXXXXXXXXXXXXXXXXXXXX
5 Gerenciando pelo TOP 16 XXXXXXXXXXXXXXXXXXXXXXXXXX
6 Monitorando o Uso do Disco 17 XXXXXXXXXXXXXXXXXXXXXXXXXX
7 XXXXXXXXXXXXXXXXXXXXXXXXXX 18 XXXXXXXXXXXXXXXXXXXXXXXXXX
8 XXXXXXXXXXXXXXXXXXXXXXXXXX 19 XXXXXXXXXXXXXXXXXXXXXXXXXX
9 XXXXXXXXXXXXXXXXXXXXXXXXXX 20 XXXXXXXXXXXXXXXXXXXXXXXXXX
10 XXXXXXXXXXXXXXXXXXXXXXXXXX 21 XXXXXXXXXXXXXXXXXXXXXXXXXX
11 XXXXXXXXXXXXXXXXXXXXXXXXXX 0 Sair da Aplicacao
---- --------------------------- ---- ---------------------------
Digite um Codigo -
Opção 2;
-------------------------------------------------------------------------------------------------
29/10/2013 ***** ORACLE BASIC SERVICES ***** 16:14:48
-------------------------------------------------------------------------------------------------
s120.ms - 10.2.19.4 - oracle
clocks CPU %user %nice %system %iowait %steal %idle
-------------- ---- ------ ------ ------ ------ ------ ------
04:14:49 PM all 17.15 0.00 0.13 0.25 0.00 82.48
04:14:50 PM all 20.32 0.00 0.25 0.00 0.00 79.43
04:14:51 PM all 0.88 0.00 0.00 0.00 0.00 99.12
04:14:52 PM all 8.00 0.00 0.00 0.00 0.00 92.00
04:14:53 PM all 2.49 0.00 0.00 0.12 0.00 97.38
Average: all 9.77 0.00 0.07 0.07 0.00 90.08
Pressione (ENTER) para continuar...
Opção 3;
-------------------------------------------------------------------------------------------------
29/10/2013 ***** ORACLE BASIC SERVICES ***** 16:15:07
-------------------------------------------------------------------------------------------------
s120.ms - 10.2.19.4 - oracle
--------------- ----- ------ ---------- ---------- ---------- ----------
Size total used free shared buffers cached
--------------- ----- ------ ---------- ---------- ---------- ----------
GB Mem: 47 45 1 0 0 37
MB Mem: 48298 46917 1381 0 246 38548
KB Mem: 49457628 48043296 1414332 0 252688 39473500
Pressione (ENTER) para continuar...
Opção 4;
-------------------------------------------------------------------------------------------------
29/10/2013 ***** ORACLE BASIC SERVICES ***** 16:15:19
-------------------------------------------------------------------------------------------------
s120.ms - 10.2.19.4 - oracle
+--------+--------+-------------+------------+----------------------------------------------------+
| Total | Usado | Disponivel | % de Uso | FileSystem |
+--------+--------+-------------+------------+----------------------------------------------------+
| 55G | 25G | 28G | 48% | / |
| 26G | 0 | 26G | 0% | /dev/shm |
| 2.1T | 548G | 1.5T | 28% | /u01 |
+--------+--------+-------------+------------+----------------------------------------------------+
Pressione (ENTER) para continuar...
Opção 5;
-------------------------------------------------------------------------------------------------
29/10/2013 ***** ORACLE BASIC SERVICES ***** 16:15:31
-------------------------------------------------------------------------------------------------
s120.ms - 10.2.19.4 - oracle
oracle 8915 1 0 Oct20 ? 00:01:18 ora_smon_prd
oracle 29292 1 0 Oct21 ? 00:00:22 ora_smon_trn
oracle 29610 1 0 Oct21 ? 00:00:29 ora_smon_sml
Pressione (ENTER) para continuar...
Opção 6;
-------------------------------------------------------------------------------------------------
29/10/2013 ***** INFORMIX BASIC SERVICES ***** 16:19:39
-------------------------------------------------------------------------------------------------
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 15 0 10372 696 584 S 0.0 0.0 0:32.07 init
2 root RT -5 0 0 0 S 0.0 0.0 0:00.36 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:00.01 ksoftirqd/0
4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
5 root RT -5 0 0 0 S 0.0 0.0 0:00.16 migration/1
6 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/1
7 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/1
8 root RT -5 0 0 0 S 0.0 0.0 0:00.07 migration/2
9 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/2
10 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/2
11 root RT -5 0 0 0 S 0.0 0.0 0:00.12 migration/3
12 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/3
13 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/3
14 root RT -5 0 0 0 S 0.0 0.0 0:00.06 migration/4
15 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/4
16 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/4
17 root RT -5 0 0 0 S 0.0 0.0 0:00.12 migration/5
18 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/5
19 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/5
20 root RT -5 0 0 0 S 0.0 0.0 0:00.05 migration/6
21 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/6
22 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/6
23 root RT -5 0 0 0 S 0.0 0.0 0:00.09 migration/7
24 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/7
25 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/7
26 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/0
27 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/1
28 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/2
29 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/3
Pressione qualquer tecla para continuar...
Opção 7;
-------------------------------------------------------------------------------------------------
29/10/2013 ***** INFORMIX BASIC SERVICES ***** 16:17:09
-------------------------------------------------------------------------------------------------
Linux 2.6.18-238.el5 (s120.ms) 10/29/2013
avg-cpu: %user %nice %system %iowait %steal %idle
5.84 0.00 0.40 0.35 0.00 93.41
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
sda 5.75 9.55 1.91 1.62 63.37 89.36 43.28 0.06 17.57 3.25 1.15
sda1 0.02 2.19 0.15 1.10 3.42 26.31 23.78 0.02 17.81 5.06 0.63
sda2 5.73 7.36 1.76 0.52 59.95 63.05 53.97 0.04 17.43 2.30 0.53
sdd 0.00 0.00 0.00 0.00 0.00 0.00 10.79 0.00 520.67 520.67 0.01
sde 3.07 26.63 18.45 10.07 4983.20 293.58 185.01 0.04 1.57 0.96 2.74
sde1 3.07 26.63 18.45 10.07 4983.20 293.58 185.01 0.04 1.57 0.96 2.74
avg-cpu: %user %nice %system %iowait %steal %idle
6.30 0.00 0.50 0.06 0.00 93.13
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
sda 0.00 0.00 1.00 0.00 8.00 0.00 8.00 0.00 3.50 2.00 0.20
sda1 0.00 0.00 1.00 0.00 8.00 0.00 8.00 0.00 3.50 2.00 0.20
sda2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdd 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sde 0.00 25.50 0.00 7.00 0.00 260.00 37.14 0.01 0.71 0.57 0.40
sde1 0.00 25.50 0.00 7.00 0.00 260.00 37.14 0.01 0.71 0.57 0.40
avg-cpu: %user %nice %system %iowait %steal %idle
0.62 0.00 0.06 0.00 0.00 99.31
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdd 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sde 0.00 12.50 0.00 5.00 0.00 140.00 28.00 0.00 0.50 0.50 0.25
sde1 0.00 12.50 0.00 5.00 0.00 140.00 28.00 0.00 0.50 0.50 0.25
avg-cpu: %user %nice %system %iowait %steal %idle
0.00 0.00 0.00 0.12 0.00 99.88
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
sda 0.00 9.00 0.00 1.00 0.00 80.00 80.00 0.01 5.50 5.50 0.55
sda1 0.00 9.00 0.00 1.00 0.00 80.00 80.00 0.01 5.50 5.50 0.55
sda2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdd 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sde 0.00 5.00 0.50 2.00 4.00 56.00 24.00 0.00 0.80 0.80 0.20
sde1 0.00 5.00 0.50 2.00 4.00 56.00 24.00 0.00 0.80 0.80 0.20
avg-cpu: %user %nice %system %iowait %steal %idle
5.43 0.00 0.12 0.06 0.00 94.38
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdd 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sde 0.00 17.50 0.00 6.00 0.00 188.00 31.33 0.01 1.58 0.83 0.50
sde1 0.00 17.50 0.00 6.00 0.00 188.00 31.33 0.01 1.58 0.83 0.50
+---------------------------------------------------------------------------------------------------------------------+
| O uso alto de um disco pode haver uma maior chance de que um requerimento solicitando os dados do disco ira bloquear|
| (parar) ate que o disco estaja pronto para esse processo. A solucao geralmente envolve a divisao de sistemas de |
| arquivos em discos ou arrays, no entanto, o primeiro passo saber se voce tem este problema. |
+---------------------------------------------------------------------------------------------------------------------+
Pressione qualquer tecla para continuar...
Script Completo;
# -----------------------------------------------------------------------------------------------#
# Funcao : Menu para funcoes importantes do Oracle. #
# Detalhe: Varios scripts para rodar em um menu no Oracle #
# Autor : Claudemar Martins de Sa #
# Data : 24/10/2013 #
# Fonte : http://www.vivaolinux.com.br/script/Menu-tarefas-com-SSH #
# -----------------------------------------------------------------------------------------------#
Principal () {
clear
echo "-------------------------------------------------------------------------------------------------"
echo -n
echo -n "$(date "+%d/%m/%Y")"
echo -n " "
echo -n " ***** ORACLE BASIC SERVICES ***** "
echo -n " "
echo "$(date "+%T")"
echo "-------------------------------------------------------------------------------------------------"
echo " $(hostname) - $(hostname -i) - $(whoami)"
echo
echo " Code Basic Services Code Basic Services "
echo " ---- --------------------------- ---- --------------------------- "
echo " 1 Performance/Desempenho 12 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 2 XXXXXXXXXXXXXXXXXXXXXXXXXX 13 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 3 XXXXXXXXXXXXXXXXXXXXXXXXXX 14 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 4 XXXXXXXXXXXXXXXXXXXXXXXXXX 15 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 5 XXXXXXXXXXXXXXXXXXXXXXXXXX 16 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 6 XXXXXXXXXXXXXXXXXXXXXXXXXX 17 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 7 XXXXXXXXXXXXXXXXXXXXXXXXXX 18 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 8 XXXXXXXXXXXXXXXXXXXXXXXXXX 19 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 9 XXXXXXXXXXXXXXXXXXXXXXXXXX 20 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 10 XXXXXXXXXXXXXXXXXXXXXXXXXX 21 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 11 XXXXXXXXXXXXXXXXXXXXXXXXXX 0 Sair da Aplicacao "
echo " ---- --------------------------- ---- --------------------------- "
echo
echo -n " Digita um Codigo - "
read OPCAO
case $OPCAO in
1) sub_menu_0001 ;;
0) exit ;;
*) clear ; Principal ;;
esac
}
# ======================================================================================================
# Escolhido a opcao 1 - Monitorando a Performance
# ======================================================================================================
sub_menu_0001 () {
clear
echo "-------------------------------------------------------------------------------------------------"
echo -n
echo -n "$(date "+%d/%m/%Y")"
echo -n " "
echo -n " ***** ORACLE BASIC SERVICES ***** "
echo -n " "
echo "$(date "+%T")"
echo "------------------------------------------------------------------------------------------------- "
echo " Instancias Online $(ps -ef | grep smon|grep -v grep|awk '{print $8}' | wc -l) - $(hostname -i) - $(whoami)"
echo
echo " Code Function "
echo " ---- --------------------------- ---- --------------------------- "
echo " 1 SAR - Performance da CPU 12 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 2 Consumo de Memoria 13 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 3 Consumo de Espaco em Disco 14 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 4 Instancias Online 15 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 5 Gerenciando pelo TOP 16 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 6 Monitorando o Uso do Disco 17 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 7 XXXXXXXXXXXXXXXXXXXXXXXXXX 18 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 8 XXXXXXXXXXXXXXXXXXXXXXXXXX 19 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 9 XXXXXXXXXXXXXXXXXXXXXXXXXX 20 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 10 XXXXXXXXXXXXXXXXXXXXXXXXXX 21 XXXXXXXXXXXXXXXXXXXXXXXXXX "
echo " 11 XXXXXXXXXXXXXXXXXXXXXXXXXX 0 Sair da Aplicacao "
echo " ---- --------------------------- ---- --------------------------- "
echo
echo -n " Digite um Codigo - "
read OPCAO2
case $OPCAO2 in
1) OPCAO_00000 ;;
2) CONSUMO_DE_MEMORIA ;;
3) ESPACO_DISPONIVEL_NO_SERVIDOR ;;
4) INSTANCIAS_ONLINE ;;
5) COMANDO_TOP ;;
6) IOSTAT_DISCO ;;
0) clear ; Principal ;;
*) Opcao Invalida ; echo ; sub_menu_0001 ;;
esac
}
# ======================================================================================================
# Abaixo vamos checar a performance do servidor
# ======================================================================================================
OPCAO_00000 ()
{
clear
echo "-------------------------------------------------------------------------------------------------"
echo -n
echo -n "$(date "+%d/%m/%Y")"
echo -n " "
echo -n " ***** ORACLE BASIC SERVICES ***** "
echo -n " "
echo "$(date "+%T")"
echo "-------------------------------------------------------------------------------------------------"
echo " $(hostname) - $(hostname -i) - $(whoami)"
echo
echo "clocks CPU %user %nice %system %iowait %steal %idle"
echo "-------------- ---- ------ ------ ------ ------ ------ ------"
sar 1 5 | grep "all"
echo
echo -n "Pressione (ENTER) para continuar..."
read MSG
clear
sub_menu_0001
}
# ======================================================================================================
# Abaixo vamos checar o consumo de memoria
# ======================================================================================================
CONSUMO_DE_MEMORIA ()
{
clear
echo "-------------------------------------------------------------------------------------------------"
echo -n
echo -n "$(date "+%d/%m/%Y")"
echo -n " "
echo -n " ***** ORACLE BASIC SERVICES ***** "
echo -n " "
echo "$(date "+%T")"
echo "-------------------------------------------------------------------------------------------------"
echo " $(hostname) - $(hostname -i) - $(whoami)"
echo
echo "--------------- ----- ------ ---------- ---------- ---------- ----------"
echo "Size total used free shared buffers cached"
echo "--------------- ----- ------ ---------- ---------- ---------- ----------"
echo -n "GB "
free -g | grep Mem:
echo -n "MB "
free -m | grep Mem:
echo -n "KB "
free | grep Mem:
echo
echo -n "Pressione (ENTER) para continuar..."
read MSG
clear
sub_menu_0001
}
# ======================================================================================================
# Abaixo vamos checar o espaco disponivel as particoes desse servidor
# ======================================================================================================
ESPACO_DISPONIVEL_NO_SERVIDOR ()
{
clear
echo "-------------------------------------------------------------------------------------------------"
echo -n
echo -n "$(date "+%d/%m/%Y")"
echo -n " "
echo -n " ***** ORACLE BASIC SERVICES ***** "
echo -n " "
echo "$(date "+%T")"
echo "-------------------------------------------------------------------------------------------------"
echo " $(hostname) - $(hostname -i) - $(whoami)"
echo
LOG1="/tmp/espaco_no_servidor_1234_$(whoami)_pode_deletar_1234_1.log"
LOG2="/tmp/espaco_no_servidor_1234_$(whoami)_pode_deletar_1234_2.log"
df -H | grep -vE 'abc:/xyz/pqr | tmpfs |cdrom | Use' | awk '{ print $2 "|" $3 "|" $4 "|" $5 "|" $6 }' > $LOG1
cat $LOG1 | awk -F "|" '{
t_iso=$1
if ($1 == "|")
{ t_iso=" " }
printf("| %-6s | %-6s | %-11s | %-10s | %-50s | \n",$1,$2,$3,$4,$5)}' > $LOG2
clear
echo "-------------------------------------------------------------------------------------------------"
echo -n
echo -n "$(date "+%d/%m/%Y")"
echo -n " "
echo -n " ***** ORACLE BASIC SERVICES ***** "
echo -n " "
echo "$(date "+%T")"
echo "-------------------------------------------------------------------------------------------------"
echo " $(hostname) - $(hostname -i) - $(whoami)"
echo
echo "+--------+--------+-------------+------------+----------------------------------------------------+"
echo "| Total | Usado | Disponivel | % de Uso | FileSystem |"
echo "+--------+--------+-------------+------------+----------------------------------------------------+"
cat $LOG2
echo "+--------+--------+-------------+------------+----------------------------------------------------+"
rm $LOG1
rm $LOG2
if [ $(df -hP | grep -vE 'Filesystem' | awk '{x=$5;sub ("%","",x)}x>70' | wc -l) -eq 1 ]
then
LOG3="/tmp/espaco_no_servidor_1234_$(whoami)_pode_deletar_1234_3.log"
LOG4="/tmp/espaco_no_servidor_1234_$(whoami)_pode_deletar_1234_4.log"
df -hP | grep -vE 'Filesystem' | awk '{x=$5;sub ("%","",x)}x>70 { print $2 "|" $3 "|" $4 "|" $5 "|" $6 }' > $LOG3
cat $LOG3 | awk -F "|" '{
t_iso=$1
if ($1 == "|")
{ t_iso=" " }
printf("| %-6s | %-6s | %-11s | %-10s | %-50s | \n",$1,$2,$3,$4,$5)}' > $LOG4
echo
echo " +---------------------------------------------------------+"
echo " | Particao Com Mais de 70% Utilizacao |"
echo " +---------------------------------------------------------+"
echo
echo "+--------+--------+-------------+------------+----------------------------------------------------+"
echo "| Total | Usado | Disponivel | % de Uso | FileSystem |"
echo "+--------+--------+-------------+------------+----------------------------------------------------+"
cat $LOG4
echo "+--------+--------+-------------+------------+----------------------------------------------------+"
rm $LOG3
rm $LOG4
fi
echo
echo -n "Pressione (ENTER) para continuar..."
read MSG
clear
sub_menu_0001
}
# ======================================================================================================
# Abaixo vamos ver as instancias que estao online neste servidor;
# ======================================================================================================
INSTANCIAS_ONLINE ()
{
clear
echo "-------------------------------------------------------------------------------------------------"
echo -n
echo -n "$(date "+%d/%m/%Y")"
echo -n " "
echo -n " ***** ORACLE BASIC SERVICES ***** "
echo -n " "
echo "$(date "+%T")"
echo "-------------------------------------------------------------------------------------------------"
echo " $(hostname) - $(hostname -i) - $(whoami)"
echo
# ======================================================================================================
# parte comentada - nem todos os servidores terao so as instancias prd, trn e sml
# se tiver outra nao vai aparecer no display - deixei o comando que mostra tudo;
# ======================================================================================================
#
# LOG1="/tmp/espaco_no_servidor_1234_$(whoami)_pode_deletar_1234_1.log"
# LOG2="/tmp/espaco_no_servidor_1234_$(whoami)_pode_deletar_1234_2.log"
#
# ps -ef | grep smon | grep -v grep | awk '{print $8}'| awk -F "_" '{print$3}' > $LOG1
#
# cat $LOG1 | awk -F "|" '{
# t_iso=$1
#
# if ($1 == "prd")
# { t_iso="| prd - Producao |" }
#
# if ($1 == "trn")
# { t_iso="| trn - Treinamento |" }
#
# if ($1 == "sml")
# { t_iso="| sml - Simulacao |" }
#
# printf("%-10s\n",t_iso)}' > $LOG2
# echo "+--------------------+"
# cat $LOG2
# echo "+--------------------+"
# echo
# rm $LOG1
# rm $LOG2
ps -ef | grep smon | grep -v grep
echo
echo -n "Pressione (ENTER) para continuar..."
read MSG
clear
sub_menu_0001
}
# ======================================================================================================
# Abaixo vamos gerenciar os processos no Linux com o comando top
# ======================================================================================================
COMANDO_TOP ()
{
LOG1="/tmp/1234_$(whoami)_pode_deletar_1234_1.log"
clear
echo "-------------------------------------------------------------------------------------------------"
echo -n
echo -n "$(date "+%d/%m/%Y")"
echo -n " "
echo -n " ***** INFORMIX BASIC SERVICES ***** "
echo -n " "
echo "$(date "+%T")"
echo "-------------------------------------------------------------------------------------------------"
top -b -n 2 | head -n 55 > $LOG1 ; head -n 37 $LOG1|grep -v top | grep -v Cpu | grep -v Mem | grep -v Swap;
rm $LOG1 ;
echo
echo -n "Pressione qualquer tecla para continuar..."
read MSG
clear
sub_menu_0001
}
# ======================================================================================================
# Abaixo - Monitorar o I/O nos discos
# ======================================================================================================
IOSTAT_DISCO ()
{
clear
clear
echo "-------------------------------------------------------------------------------------------------"
echo -n
echo -n "$(date "+%d/%m/%Y")"
echo -n " "
echo -n " ***** INFORMIX BASIC SERVICES ***** "
echo -n " "
echo "$(date "+%T")"
echo "-------------------------------------------------------------------------------------------------"
echo
iostat -x 2 5
echo " +---------------------------------------------------------------------------------------------------------------------+ "
echo " | O uso alto de um disco pode haver uma maior chance de que um requerimento solicitando os dados do disco ira bloquear| "
echo " | (parar) ate que o disco estaja pronto para esse processo. A solucao geralmente envolve a divisao de sistemas de | "
echo " | arquivos em discos ou arrays, no entanto, o primeiro passo saber se voce tem este problema. | "
echo " +---------------------------------------------------------------------------------------------------------------------+ "
echo
echo -n "Pressione qualquer tecla para continuar..."
read MSG
clear
sub_menu_0001
}
# ======================================================================================================
# Nao remover a linha abaixo
# ======================================================================================================
Principal
0 comentários:
Enviar um comentário