Á¦°¡ ¿øÇÏ´Â °á°ú´Â...´ÙÀ½°ú °°Àºµ¥¿ä...
------------------------------------------------
DATE | NAME | STATUS |
------------------------------------------------
2009-07-08-22:12:07:08| TS_TEMP_16K | 0x0000 |
2009-07-08-22:12:07:08| TS_DBA_D00 | 0x0000 |
2009-07-08-22:12:07:08| TS_TEMP_32K | 0x0000 |
2009-07-08-22:12:07:08|TS_ENTMT_D00 | 0x0000 |
2009-07-08-22:12:07:08|TS_ENTMT_I00 | 0x0000 |
2009-07-08-22:12:07:08| TS_QP_D | 0x0000 |
2009-07-08-22:12:07:08| TS_OCMT_D01 | 0x0000 |
2009-07-08-22:12:07:08| TS_OCMT_I01 | 0x0000 |
2009-07-08-22:12:07:08| TS_TEST_D00 | 0x0000 |
2009-07-08-22:12:07:08|_MANAGE_D00 | 0x0000 |
------------------------------------------------
Á¦°¡ ¸¸µç ½ºÅ©¸³Æ®°¡ À߸øµÇ¾î...´ÙÀ½°ú °°ÀÌ ³ª¿À³×¿ä.
=============================================================
2009-07-08:22:12:20 | TS_TEMP_16K |
TS_DBA_D00 | |
TS_TEMP_32K | |
TS_ENTMT_D00 | |
TS_ENTMT_I00 | |
TS_QP_D | |
TS_OCMT_D01 | |
TS_OCMT_I01 | |
TS_TEST_D00 | |
TS_MANAGE_D00 | 0x0000 |
0x0000 | |
0x0000 | |
0x0000 | |
0x0000 | |
0x0000 | |
0x0000 | |
0x0000 | |
0x0000 | |
Á¦°¡ ¸¸µç ¼Ò½º´Â ´ÙÀ½°ú °°½À´Ï´Ù¸¸...
SNUM=1
while true
do
#----------------------------------
if [ "${SNUM}" -eq 1 ];then
cat << HEAD1 >> \n
DATE | NAME | STATUS |
HEAD1
fi
#----------------------------------
DATE=`date +%Y-%m-%d:%H:%M:%S`
GETSNAP_TBS=`db2 list tablespaces`
NAME= `echo "$GETSNAP_TBS" |grep "Name" |cut -d= -f2 |awk '{print $1}'`
STATUS=`echo "$GETSNAP_TBS" |grep "State" |cut -d= -f2 |awk '{print $1}'`
RDATA="$DATE $NAME $STATUS"
echo "$RDATA" |awk '{printf "%20s | %15s | %10s|\n", $1, $2, $3}'
sleep 3
done
¾îµð°¡ À߸øµÈ°Ç°¡¿ä?
Âü°íÀûÀ¸·Î »ó±âÇÑ ½ºÅ©¸³Æ®°¡ Ç׸ñÀ» °¡Á®¿À´Â ¿øº»ÈÀÏÀÇ ³»¿ëÀº ´ÙÀ½°ú °°½À´Ï´Ù.
Tablespace ID = 1
Name = TS_TEMP_16K
Type = Database managed space
Contents = System Temporary data
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 7
Name = TS_DBA_D00
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 12
Name = TS_TEMP_32K
Type = Database managed space
Contents = System Temporary data
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 34
Name = TS_ENTMT_D00
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 35
Name = TS_ENTMT_I00
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 44
Name = TS_QP_D
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 48
Name = TS_OCMT_D01
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 49
Name = TS_OCMT_I01
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 50
Name = TS_TEST_D00
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 57
Name = TS_MANAGE_D00
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
DB21011I In a partitioned database server environment, only the table spaces
on the current node are listed.
GETSNAP_TBS="list"
count=`cat "$GETSNAP_TBS" | grep "Name" | cut -d= -f2 | gawk '{print $1}' | paste -s`
cnt=`cat "$GETSNAP_TBS" | grep "Name" | cut -d= -f2 | gawk '{print $1}' | wc -l`
echo "------------------------------------------------------"
echo " DATE | NAME | STATUS "
echo "------------------------------------------------------"
for i in `echo $count`
do
DATE=`date +%Y-%m-%d:%H:%M:%S`
NAME=`cat "$GETSNAP_TBS" | grep "Name" | cut -d= -f2 | gawk '{print $1}' | tail -n"$cnt" | head -n1`
STATUS=`cat "$GETSNAP_TBS" | grep "State" | cut -d= -f2 | gawk '{print $1}' | tail -n"$cnt" | head -n1`
RDATA="$DATE $NAME $STATUS"
echo "$RDATA" | gawk '{printf "%20s | %14s | %10s \n", $1, $2, $3}'
sleep 1
cnt=`expr $cnt - 1`
done
Å×½ºÆ®ÇÑ °á°ú...±â´ëÇÑ °á°ú°¡ ³ª¿ÀÁö ¾Ê¾Ò½À´Ï´Ù.
ÀÏ´ÜÀº...
Àû¾îÁֽŠlist¶ó´Â °ÍÀº Á¦°¡ ¿Ã·Áµå¸° ¿¹Á¦(¼Ò½º)¸¦
list¶ó´Â ÈÀÏ·Î ¸¸µç ÈÄ ÀÌ ÈÀÏÀ» ÀÌ¿ëÇÏ¿© ³»¿ëÀ»
ÇÊÅ͸µ Çϴ°ÍÀε¥...±×·¸´Ù ÇÏ´õ¶óµµ...
´ÙÀ½°ú °°ÀÌ °á°ú°¡ ³ª¿É´Ï´Ù.
# sh tbschk.sh
Usage: paste [-s] [-d List] File...
tbschk.sh[3]: gawk: not found.
tbschk.sh[4]: gawk: not found.
------------------------------------------------------
DATE | NAME | STATUS
------------------------------------------------------
¶ÇÇÑ...gwak¸¦ awk·Î ¹Ù²Ù°í Çߴµ¥µµ...
´ÙÀ½°ú °°Àº °á°ú°¡ ³ª¿É´Ï´Ù...
# sh tbschk.sh
Usage: paste [-s] [-d List] File...
------------------------------------------------------
DATE | Name | STATUS
------------------------------------------------------
Áú¹® ³»¿ë°ú commentÀÇ ½ºÅ©¸³Æ®¸¦ ºñ±³/¿¬±¸ÇÏ´Â °ÍÀÌ ÁÁÀ» µí ÇÕ´Ï´Ù.
Á¦°¡ ÀÛ¼ºÇÑ°ÍÀº ¸®´ª½ºÀÇ bash_shell¿¡¼ Å×½ºÆ®¸¦ ÇÑ°Í ÀÔ´Ï´Ù.
DB2¸¦ »ç¿ëÇϽô °ÍÀ» º¸´Ï AIX °°Àºµ¥ ´Ù½ÃÇѹø ÇغÁ¾ß ÇÒ°Í °°³×¿ä.
Áï, $count¿Í $cntÀÇ °ªÀ» È®ÀÎ ÇϽðí, NAME°ú STATUS ÀÇ tail °ªÀÌ ¹¹°¡ ³ª¿À´ÂÁö È®ÀÎÇÏ½Ã¸é ¿øÇÏ´Â °á°ú°¡ ³ª¿À¸®¶ó »ý°¢ µË´Ï´Ù.
³ª¸ÓÁö ½ºÅ©¸³Æ®µéÀº ºñ½ÁÇÑ °Í °°³×¿ä.
gawk, awk µéÀº »ó°ü¾ø³×¿ä.