티스토리 뷰
#------------------------------------------*
# DB ENVIRONMENT SETTING
#------------------------------------------*
./db_env.h
#------------------------------------------*
# JOB VARIABLE DEFINE
#------------------------------------------*
DB_USR=system/password
JOB_DIR=/bin
SQL_DIR=/sql
LOG_DIR=/log
JOB_ID=pr_tablespaceinfo
PROC_ID=PR_TABLESPACEINFO
JOB_DATE=`date +%Y%m%d`
LOG_FILE=$LOG_DIR/$JOB_ID-$JOB_DATE.log
RETVAL=0
#------------------------------------------*
# JOB START
#------------------------------------------*
echo `date +%Y/%m/%d:%H:%M:%S` === $JOB_ID Start !!! === >>$LOG_FILE
#
# MAKE SQL STATEMENT
#
(
echo "
set echo off
set verify off
set pagesize 0
set feedback off
var pr_return varchar2(100);
var pr_errmsg varchar2(1000);
INSERT INTO COM.CM_TABLESPACEINFO
(
DBNM ,
YMD , /* 일자 */
TABLESPACE_NAME , /* 테이블스페이스명 */
MAXMAXBYTES_GB , /* 맥스사이즈 */
BYTES_GB , /* 할당량 */
USED_GB , /* 사용량 */
USED_PERCENT , /* 사용비율 */
FREE_GB , /* 사용가능량 */
FREE_RATE /* 사용가능비율 */
)
SELECT 'DBNAME' DBNM,
TO_CHAR(SYSDATE,'YYYYMMDD') YMD,
DDF.TABLESPACE_NAME TABLESPACE_NAME,
ROUND(DDF.MAXBYTES/1024/1024/1024,2) MAXMAXBYTES_GB,
ROUND(DDF.BYTES/1024/1024/1024,2) BYTES_GB,
ROUND((DDF.BYTES - DFS.BYTES)/1024/1024/1024,2) USED_GB,
ROUND(((DDF.BYTES - DFS.BYTES) / DDF.BYTES) * 100, 2) USED_PERCENT,
ROUND(DFS.BYTES/1024/1024/1024,2) FREE_GB,
ROUND((1 - ((DDF.BYTES - DFS.BYTES) / DDF.BYTES)) * 100, 2) FREE_RATE
FROM (
SELECT TABLESPACE_NAME,
SUM(BYTES) BYTES,
SUM(MAXBYTES) MAXBYTES
FROM DBA_DATA_FILES
GROUP BY TABLESPACE_NAME
UNION ALL
SELECT TABLESPACE_NAME,
SUM(BYTES) BYTES,
SUM(MAXBYTES) MAXBYTES
FROM DBA_TEMP_FILES
GROUP BY TABLESPACE_NAME
) DDF,
(
SELECT TABLESPACE_NAME,
SUM(BYTES) BYTES
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME
UNION ALL
SELECT TABLESPACE_NAME,
SUM(FREE_SPACE) BYTES
FROM DBA_TEMP_FREE_SPACE
GROUP BY TABLESPACE_NAME
) DFS
WHERE DDF.TABLESPACE_NAME = DFS.TABLESPACE_NAME(+)
ORDER BY 3;
commit;
print pr_return;
print pr_errmsg;
exit sql.sqlcode
"
) | cat > $SQL_DIR/$PROC_ID.sql
#
# EXECUTE JOB
#
if /usr/bin/test ! -e /log/$JOB_ID.chk ; then
#-- CHECK FILE CREATE
echo `date +%Y/%m/%d:%H:%M:%S` | cat > /BESTIN/COM/log/$JOB_ID.chk
RETVAL=`sqlplus -s $DB_USR @$SQL_DIR/$PROC_ID >>$LOG_FILE`
RETVAL=$?
echo `date +%Y/%m/%d:%H:%M:%S` return vlue = $RETVAL >>$LOG_FILE
echo `date +%Y/%m/%d:%H:%M:%S` === $JOB_ID End !!! === >>$LOG_FILE
#-- CHECK FILE DELETE
rm /BESTIN/COM/log/$JOB_ID.chk
exit $RETVAL
else
echo `date +%Y/%m/%d:%H:%M:%S` Job Duplicate Error !!! == $JOB_CNT == >>$LOG_FILE
exit 1
fi
- Total
- Today
- Yesterday
- 과학
- 설탕
- 챔픽스 후기 금연
- 흡연
- 챔픽스 후기
- 상식
- 생명과학
- 유전자
- 100일
- 지진
- 금단증상
- 금연일기
- java
- 믹스커피
- 부작용
- 금연
- 오라클
- 윈도우10
- 냄새
- 다이어트
- 인공지능
- 보건소
- 챔픽스
- oracle
- 단백질
- 통신
- DNA
- 뇌
- 보건
- 의료
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |