일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- cygwin
- perl string
- command & perl
- fdisk
- memory
- prompt
- rac
- oracle
- php5
- oracle install
- patch
- solaris network
- RHEL4
- PERL
- bash
- 오라클
- sqlplus
- Network
- Linux
- 연산자
- Oracle RAC
- perl + 정규표현식
- Unix
- mariaDB
- solaris
- dba
- grid
- perl one-liner
- SQL
- MySQL
Archives
- Today
- Total
DATA 전문가로 가는 길
[Unix/Linux] System Check List(시스템 체크 리스트) 본문
작성자 : 박상수
작성일자 : 2010.11.30
작업환경 : VMware7 [ RHEL4 ]
작성일자 : 2010.11.30
작업환경 : VMware7 [ RHEL4 ]
1. 시스템 체크리스트 (bash shell source)
[설명] CPU, Memory, Swap, Process, Oracle Database 10g Tablespace
위에 나열한 항목 외에 수많은 시스템 체크리스트를 작성 할 수 있습니다. 대표적으로 사용하는 시스템 체크를 하였고 그외 항목은 약간 수정하면 가능 할 것으로 판단 됩니다.
[2010-12-02 03:20:47]-[oracle@server102:~/scripts]
$ cat system_check.sh
#!/bin/bash
# RedHat Enterprise 4 System Check
# estenpark
tmp_fn="temp.tmp"
cpu_stat=`sar 1 3 |grep Average |perl -ane 'printf "$F[2]%"'`
mem_stat=`free -m |grep Mem |perl -ane 'printf "$F[2]M"'`
swap_stat=`free -m |grep Swap |perl -ane 'printf "$F[2]M"'`
echo "========================================================="
echo "System Cehck (Cpu, Memory, Swap)"
echo
echo "CPU : " $cpu_stat
echo "MEMORY : " $mem_stat
echo "SWAP : " $swap_stat
echo "========================================================="
ps_sshd=`ps -ef |grep -v grep |perl -ne 'printf 0 < $. if /sshd$/'`
ps_crond=`ps -ef |grep -v grep |perl -ne 'printf 0 < $. if /crond$/'`
echo "========================================================="
echo "Process Cehck (sshd, crond)"
echo
if [ $ps_sshd ]; then
echo "SSH Process Success"
else
echo "SSH Process Fail"
fi
if [ $ps_crond ]; then
echo "Cron Process Success"
else
echo "Cron Process Fail"
fi
echo "========================================================="
echo
sqlplus system/oracle @/home/oracle/tbs_check.sql |perl -ne 'printf"$_" if /\d\d\.\d\d\%$/' > $tmp_fn
echo "========================================================="
echo "Oracle 10g Tablespace Cehck"
echo
echo "Tablespace Used"
echo "---------------------------------------------------------"
cat $tmp_fn
echo "---------------------------------------------------------"
echo
echo "80% higher Tablespace"
echo "---------------------------------------------------------"
perl -ane 'printf"$_" if $F[4] >= 80' $tmp_fn
echo "---------------------------------------------------------"
echo
echo "========================================================="
cat /dev/null > $tmp_fn
[설명] Tablespac 사용량을 체크하기 위해서 작성한 SQL 문입니다.
[2010-12-02 03:24:48]-[oracle@server102:~]
$ cat tbs_check.sql
-- SQLPLUS CONFIGURE --
SET ECHO OFF
SET NEWPAGE 0
SET SPACE 0
SET PAGESIZE 0
SET FEEDBACK OFF
SET HEADING OFF
SET TRIMSPOOL ON
SET LINE 200
COL file# for 999
COL ts_name for a10
COL total_blocks for 9999999
COL used_blocks for 9999999
COL pct_used for a10
-- Tablespace Used SQL --
SELECT
-- distinct d.file_id file#,
d.tablespace_name ts_name,
d.bytes/1024/1024 MB,
d.bytes/8192 total_blocks,
sum(e.blocks) used_blocks,
to_char(nvl(round(sum(e.blocks)/(d.bytes/8192),4),0) * 100, '09.00') || '%' pct_used
FROM dba_extents e, dba_data_files d
WHERE d.file_id = e.file_id(+)
GROUP BY d.file_id, d.tablespace_name, d.bytes
ORDER BY 1,2
/
exit
위에 나열한 항목 외에 수많은 시스템 체크리스트를 작성 할 수 있습니다. 대표적으로 사용하는 시스템 체크를 하였고 그외 항목은 약간 수정하면 가능 할 것으로 판단 됩니다.
[2010-12-02 03:20:47]-[oracle@server102:~/scripts]
$ cat system_check.sh
#!/bin/bash
# RedHat Enterprise 4 System Check
# estenpark
tmp_fn="temp.tmp"
cpu_stat=`sar 1 3 |grep Average |perl -ane 'printf "$F[2]%"'`
mem_stat=`free -m |grep Mem |perl -ane 'printf "$F[2]M"'`
swap_stat=`free -m |grep Swap |perl -ane 'printf "$F[2]M"'`
echo "========================================================="
echo "System Cehck (Cpu, Memory, Swap)"
echo
echo "CPU : " $cpu_stat
echo "MEMORY : " $mem_stat
echo "SWAP : " $swap_stat
echo "========================================================="
ps_sshd=`ps -ef |grep -v grep |perl -ne 'printf 0 < $. if /sshd$/'`
ps_crond=`ps -ef |grep -v grep |perl -ne 'printf 0 < $. if /crond$/'`
echo "========================================================="
echo "Process Cehck (sshd, crond)"
echo
if [ $ps_sshd ]; then
echo "SSH Process Success"
else
echo "SSH Process Fail"
fi
if [ $ps_crond ]; then
echo "Cron Process Success"
else
echo "Cron Process Fail"
fi
echo "========================================================="
echo
sqlplus system/oracle @/home/oracle/tbs_check.sql |perl -ne 'printf"$_" if /\d\d\.\d\d\%$/' > $tmp_fn
echo "========================================================="
echo "Oracle 10g Tablespace Cehck"
echo
echo "Tablespace Used"
echo "---------------------------------------------------------"
cat $tmp_fn
echo "---------------------------------------------------------"
echo
echo "80% higher Tablespace"
echo "---------------------------------------------------------"
perl -ane 'printf"$_" if $F[4] >= 80' $tmp_fn
echo "---------------------------------------------------------"
echo
echo "========================================================="
cat /dev/null > $tmp_fn
[설명] Tablespac 사용량을 체크하기 위해서 작성한 SQL 문입니다.
[2010-12-02 03:24:48]-[oracle@server102:~]
$ cat tbs_check.sql
-- SQLPLUS CONFIGURE --
SET ECHO OFF
SET NEWPAGE 0
SET SPACE 0
SET PAGESIZE 0
SET FEEDBACK OFF
SET HEADING OFF
SET TRIMSPOOL ON
SET LINE 200
COL file# for 999
COL ts_name for a10
COL total_blocks for 9999999
COL used_blocks for 9999999
COL pct_used for a10
-- Tablespace Used SQL --
SELECT
-- distinct d.file_id file#,
d.tablespace_name ts_name,
d.bytes/1024/1024 MB,
d.bytes/8192 total_blocks,
sum(e.blocks) used_blocks,
to_char(nvl(round(sum(e.blocks)/(d.bytes/8192),4),0) * 100, '09.00') || '%' pct_used
FROM dba_extents e, dba_data_files d
WHERE d.file_id = e.file_id(+)
GROUP BY d.file_id, d.tablespace_name, d.bytes
ORDER BY 1,2
/
exit
2. 결과화면
[설명] 스크립트를 실행하면 아래와 같이 시스템 체크리스트를 하실 수 있습니다.
[2010-12-02 03:27:18]-[oracle@server102:~/scripts]
$ ./system_check.sh
=========================================================
System Cehck (Cpu, Memory, Swap)
CPU : 1.01%
MEMORY : 458M
SWAP : 22M
=========================================================
=========================================================
Process Cehck (sshd, crond)
SSH Process Success
Cron Process Success
=========================================================
=========================================================
Oracle 10g Tablespace Cehck
Tablespace Used
---------------------------------------------------------
EXAMPLE 100 12800 8728 68.19%
HAKSA 20 2560 128 05.00%
HAKSA 128 00.00%
SYSAUX 250 32000 31912 99.73%
SYSTEM 490 62720 61448 97.97%
UNDO01 14 1792 872 48.66%
UNDOTBS1 35 4480 1520 33.93%
USERS 5 640 376 58.75%
---------------------------------------------------------
80% higher Tablespace
---------------------------------------------------------
SYSAUX 250 32000 31912 99.73%
SYSTEM 490 62720 61448 97.97%
---------------------------------------------------------
=========================================================
[2010-12-02 03:27:18]-[oracle@server102:~/scripts]
$ ./system_check.sh
=========================================================
System Cehck (Cpu, Memory, Swap)
CPU : 1.01%
MEMORY : 458M
SWAP : 22M
=========================================================
=========================================================
Process Cehck (sshd, crond)
SSH Process Success
Cron Process Success
=========================================================
=========================================================
Oracle 10g Tablespace Cehck
Tablespace Used
---------------------------------------------------------
EXAMPLE 100 12800 8728 68.19%
HAKSA 20 2560 128 05.00%
HAKSA 128 00.00%
SYSAUX 250 32000 31912 99.73%
SYSTEM 490 62720 61448 97.97%
UNDO01 14 1792 872 48.66%
UNDOTBS1 35 4480 1520 33.93%
USERS 5 640 376 58.75%
---------------------------------------------------------
80% higher Tablespace
---------------------------------------------------------
SYSAUX 250 32000 31912 99.73%
SYSTEM 490 62720 61448 97.97%
---------------------------------------------------------
=========================================================
'OS > Fundamental' 카테고리의 다른 글
[Unix/Linux] Solaris - Hard Disk 추가 및 구성 (1) | 2010.12.03 |
---|---|
[Unix/Linux] VMware Network [NAT - ssh, winscp 사용 방법] (0) | 2010.12.03 |
[Unix/Linux] Solaris 9 - 네트워크 설정, SSH 접속, Shell 리눅스 사용, Xstart 설정(중요) (4) | 2010.11.30 |
[Unix/Linux] RHEL4 - LVM 생성 및 제거 방법 (0) | 2010.11.19 |
[Unix/Linux] VMware 환경에서 Disk 추가 및 마운트 (0) | 2010.11.18 |
Comments