![데이터베이스: 0403-009 지정된 번호는 이 명령에 유효하지 않습니다. [닫기]](https://linux55.com/image/72911/%EB%8D%B0%EC%9D%B4%ED%84%B0%EB%B2%A0%EC%9D%B4%EC%8A%A4%3A%200403-009%20%EC%A7%80%EC%A0%95%EB%90%9C%20%EB%B2%88%ED%98%B8%EB%8A%94%20%EC%9D%B4%20%EB%AA%85%EB%A0%B9%EC%97%90%20%EC%9C%A0%ED%9A%A8%ED%95%98%EC%A7%80%20%EC%95%8A%EC%8A%B5%EB%8B%88%EB%8B%A4.%20%5B%EB%8B%AB%EA%B8%B0%5D.png)
수신된 오류 데이터베이스: 0403-009 지정된 번호가 이 명령에 유효하지 않습니다.
암호::
#!/usr/bin/ksh
#set -x
WORKFILE="/tmp/oatest.out"
DDLFILE="/tmp/oatest.ddl"
TODOFILE="/tmp/oatest.todo"
LOCKFILE="/tmp/oatest.lck"
function cleanup
{
chmod 666 $WORKFILE
rm $WORKFILE
chmod 666 $TODOFILE
if [ -f $LOCKFILE ]; then
rm $LOCKFILE
fi
exit
}
if [[ $# -lt 1 || $# -gt 2 ]]; then
echo "Usage: $0 [INSTANCE] [DATABASE]"
cleanup
fi
if [[ $# -eq 1 ]]; then
typeset -l DBNAME=$1
typeset -u DBUPPER=$1
else
if [[ $# -eq 2 ]]; then
if [[ $2 == "all" ]]; then
typeset -l DBNAME="all"
else
typeset -l DBNAME=$2
fi
typeset -u DBUPPER=$2
fi
fi
typeset -u INSTUPPER=$1
typeset -l INSTLOWER=$1
typeset -i PROBLEMS=0
typeset -i DB2ACTIVE=0
typeset -i DBAVAIL=0
typeset -i NUMDB=0
typeset -i DBTEST=1
while [ -f $LOCKFILE ]; do
echo "oatest.lck lock file exists - waiting 15 seconds..."
sleep 15
done
touch $LOCKFILE
if [[ ! -f $WORKFILE ]]; then
touch $WORKFILE
fi
chmod 666 $WORKFILE
echo "" > $TODOFILE
chmod 754 $TODOFILE
if [[ DB2ACTIVE -eq 1 && DBAVAIL -eq 1 ]]; then
sudo -u $INSTLOWER sh -c ". /home/prods/db2/$INSTUPPER/.profile \
>/dev/null 2>&1;echo \"connect to $DBNAME;\" > $DDLFILE; echo \"select \
tbsp_auto_resize_enabled,tbsp_name from table(snap_get_tbsp('',-1)) as t \
where tbsp_type=0;\" >> $DDLFILE; db2 -tf $DDLFILE" > $WORKFILE
cat $WORKFILE|grep -v select|grep -v ${INSTUPPER}|grep -v ${DBUPPER} \
|egrep '0|1'|while read STATE TABSPACE; do
if [[ $STATE -eq 1 ]]; then
echo "OK - Autoresize enabled for $TABSPACE"
else
echo "ERROR - Autoresize disabled for $TABSPACE"
PROBLEMS=$PROBLEMS+1
fi
done
else
echo "ERROR - Cannot check tablespace autoresizing as db2 is inactive"
fi
++++++
디버그 모드::
+ [[ DB2ACTIVE -eq 1 ]]
+ [[ DBAVAIL -eq 1 ]]
+ sudo -u uom15c sh -c . /home/prods/db2/UOM15C/.profile >/dev/null 2>&1;echo "connect to mdmdb;" > /tmp/oatest.ddl; echo "select tbsp_auto_resize_enabled,tbsp_name from table(snap_get_tbsp('',-1)) as t where tbsp_type=0;" >> /tmp/oatest.ddl; db2 -tf /tmp/oatest.ddl
+ 1> /tmp/oatest.out
+ cat /tmp/oatest.out
+ read STATE TABSPACE
+ grep -v select
+ grep -v UOM15C
+ grep -v MDMDB
+ egrep 0|1
oatest[696]: Database: 0403-009 The specified number is not valid for this command.
답변1
교체를 시도하다
if [[ DB2ACTIVE -eq 1 && DBAVAIL -eq 1 ]]; then
통과
if [[ ${DB2ACTIVE} -eq 1 && ${DBAVAIL} -eq 1 ]]; then
올바른 DB2 ID를 제공하지 않은 것 같습니다.
답변2
다음과 같이 변경한 후 작동했습니다.
앞으로:
if [[ $STATE -eq 1 ]]; then
뒤쪽에:
if [[ "$STATE" == 1 ]]; then