728x90
반응형
https://www.ibm.com/docs/en/db2/11.5?topic=database-administration
https://www.ibm.com/docs/en/db2/11.5?topic=SSEPGG_11.5.0/com.ibm.db2.luw.wn.doc/doc/i0060823.html
Discontinued routine or viewDeprecated sinceNew routine or viewReplaced since
SNAPSHOT_AGENT table function | MON_GET_AGENT table function and MON_GET_CONNECTION table function | Version 10.5 and Version 9.7 |
SNAPSHOT_APPL table function | MON_GET_CONNECTION table function and MON_GET_UNIT_OF_WORK table function | Version 9.7 |
SNAPSHOT_APPL_INFO table function | MON_GET_CONNECTION table function and MON_GET_UNIT_OF_WORK table function | Version 9.7 |
SNAPSHOT_BP table function | MON_GET_BUFFERPOOL table function | Version 9.7 |
SNAPSHOT_CONTAINER table function | MON_GET_CONTAINER table function | Version 9.7 |
SNAPSHOT_DATABASE table function | MON_GET_DATABASE table function and MON_GET_TRANSACTION_LOG table function | Version 10.5 |
SNAPSHOT_DBM table function | MON_GET_INSTANCE table function | Version 10.5 |
SNAPSHOT_DYN_SQL table function | MON_GET_PKG_CACHE_STMT table function | Version 9.7 |
SNAPSHOT_FCM table function | MON_GET_FCM table function | Version 9.7 Fix Pack 2 |
SNAPSHOT_FCMNODE table function | MON_GET_FCM_CONNECTION_LIST table function | Version 9.7 Fix Pack 2 |
SNAPSHOT_FILEW procedure | SNAP_WRITE_FILE procedure | Version 9.1 |
SNAPSHOT_LOCK table function | MON_GET_APPL_LOCKWAIT table function, MON_GET_LOCKS table function, MON_FORMAT_LOCK_NAME table function | Version 9.7 Fix Pack 1 |
SNAPSHOT_LOCKWAIT table function | MON_GET_APPL_LOCKWAIT table function, MON_GET_LOCKS table function, and MON_FORMAT_LOCK_NAME table function | Version 9.7 Fix Pack 1 |
SNAPSHOT_QUIESCERS table function | SNAP_GET_TBSP_QUIESCER table function | Version 9.1 |
SNAPSHOT_RANGES table function | SNAP_GET_TBSP_RANGE table function | Version 9.1 |
SNAPSHOT_STATEMENT table function | MON_GET_ACTIVITY table function and MON_CURRENT_SQL administrative view | Version 10.5 and Version 9.7 Fix Pack 1 |
SNAPSHOT_SUBSECT table function | SNAP_GET_SUBSECTION table function | Version 9.1 |
SNAPSHOT_SWITCHES table function | SNAP_GET_SWITCHES table function | Version 9.1 |
SNAPSHOT_TABLE table function | MON_GET_TABLE table function | Version 9.7 |
SNAPSHOT_TBREORG table function | MON_GET_UTILITY table function and SNAP_GET_TAB_REORG table function | Version 10.5 and Version 9.1 |
SNAPSHOT_TBS table function | MON_GET_TABLESPACE table function | Version 9.7 |
SNAPSHOT_TBS_CFG table function | MON_GET_TABLESPACE table function and MON_GET_REBALANCE_STATUS table function | Version 9.7 and Version 10.1 |
SNAPSHOT_UTIL table function | MON_GET_UTILITY table function | Version 10.5 |
SNAPSHOT_UTIL_PROG table function | SNAPUTIL_PROGRESS administrative view and SNAP_GET_UTIL_PROGRESS table function | Version 9.1 |
SQLCACHE_SNAPSHOT table function | MON_GET_PKG_CACHE_STMT table function | Version 9.7 |
SNAPSHOT_TBS table function | MON_GET_TABLESPACE table function | Version 9.7 |
SNAPSHOT_TBS_CFG table function | MON_GET_TABLESPACE table function and MON_GET_REBALANCE_STATUS table function | Version 9.7 and Version 10.1 |
https://www.ibm.com/docs/ko/db2/9.7?topic=routines-snapshot-tbs
https://www.ibm.com/docs/ko/db2/11.5?topic=functions-mon-get-tablespace-get-table-space-metrics
https://www.ibm.com/docs/en/db2/9.7?topic=routines-snapshot-tbs-cfg
db2 "select substr(tbs_cfg.tablespace_name,1,20) tablespace, cast(tbs_cfg.tablespace_state as smallint) as state ,case tbs_cfg.tablespace_type when 1 then 'SMS' else 'DMS' end type , cast(page_size as integer) page_size ,(total_pages * page_size) / 1024 / 1024 as total_size_mb ,(used_pages * page_size) /1024 / 1024 as used_size_mb ,(free_pages * page_size) /1024 / 1024 as free_size_mb , case tablespace_type when 1 then 100 else dec((tbs_cfg.used_pages * 100.00)/tbs_cfg.total_pages, 5, 2) end as ratio from table(snapshot_tbs_cfg('sample', -2)) as tbs_cfg order by tablespace; " |
db2 "select substr(tbs_cfg.tbsp_name,1,20) tablespace, cast(tbs_cfg.tbsp_state as smallint) as state ,case tbs_cfg.tbsp_type when 1 then 'SMS' else 'DMS' end type , cast(tbsp_page_size as integer) page_size ,(tbsp_total_pages * tbsp_page_size) / 1024 / 1024 as total_size_mb ,(tbsp_used_pages * tbsp_page_size) /1024 / 1024 as used_size_mb ,(tbsp_free_pages * tbsp_page_size) /1024 / 1024 as free_size_mb , case tbsp_type when 1 then 100 else dec((tbs_cfg.tbsp_used_pages * 100.00)/tbs_cfg.tbsp_total_pages, 5, 2) end as ratio from table(MON_GET_TABLESPACE('', -2)) as tbs_cfg order by tablespace; " |
https://www.ibm.com/docs/ko/db2/11.1?topic=functions-decimal-dec
decimal 함수
: 숫자의 10진수 표시, 숫자의 문자열 표시 또는 날짜 시간 값을 리턴
DECIMAL(ABC,15,2)
데이터 형변환을 위한 함수로 데이터를 15자리, 소수점 2자리로 사용
SELECT varchar(tbsp_name, 30) as tbsp_name, reclaimable_space_enabled, tbsp_free_pages, tbsp_page_top, tbsp_usable_pages FROM TABLE(MON_GET_TABLESPACE('',-2)) AS t ORDER BY tbsp_free_pages ASC |
SELECT varchar(tbsp_name, 30) as tbsp_name, member, tbsp_type, pool_data_p_reads FROM TABLE(MON_GET_TABLESPACE('',-2)) AS t ORDER BY pool_data_p_reads DESC |
테이블스페이스 컨테이너 사용량
SELECT DISTINCT substr(container.tbsp_name,1,20) AS TABLESPACE ,substr(container.container_name,1,50) AS container_name ,CAST (container.total_pages AS integer) AS total_pages ,CAST (container.usable_pages AS integer) AS usable_pages ,CAST (container.total_pages*tbs_cfg.tbsp_page_size/1024/1024 AS int) AS total_size_M ,CAST (container.usable_pages*tbs_cfg.tbsp_page_size/1024/1024 AS int) AS usable_pages_M ,CASE container.accessible WHEN 1 THEN 'YES' WHEN 0 THEN 'NO' ELSE CAST (container.accessible AS char(1)) END access FROM table(MON_GET_CONTAINER ('',-2))AS container, table(MON_GET_TABLESPACE('',-2)) AS tbs_cfg WHERE container.tbsp_id=tbs_cfg.tbsp_id ORDER BY TABLESPACE, container_name; |
select substr(tbs_cfg.tbsp_name,1,20) tbsp ,cast(tbs_cfg.tbsp_state as smallint) as state ,case tbs_cfg.tbsp_type when 1 then 'SMS' else 'DMS' end type ,cast(tbsp_page_size as integer) page_size ,(tbsp_total_pages * tbsp_page_size) / 1024 / 1024 as total_size_mb ,(tbsp_used_pages * tbsp_page_size) / 1024 / 1024 as used_size_mb ,case tbsp_type when 1 then 0 else dec((tbs_cfg.tbsp_used_pages * 100.00)/tbs_cfg.tbsp_total_pages,5,2) end as ratio from table(MON_GET_TABLESPACE('',-2)) as tbs_cfg where tbs_cfg.tbsp_name not like 'SYS%' union select 'TOTAL' tbsp ,cast(sum(tbsp_state) as smallint) as state ,'TOTAL' as type ,0 tbsp_page_size ,sum((tbsp_total_pages * tbsp_page_size) / 1024 / 1024) as total_size_mb ,sum((tbsp_used_pages * tbsp_page_size) / 1024 / 1024) as used_size_mb ,dec(sum(tbs_t.tbsp_used_pages * 100.00)/sum(tbs_t.tbsp_total_pages),5,2) as ratio from table(MON_GET_TABLESPACE('',-1)) as tbs_t where tbsp_name not like 'SYS%' order by type, ratio desc; |
select substr(tbs_cfg.tbsp_name,1,20) TABLESPACE ,tbs_cfg.tbsp_state,tbs_cfg.tbsp_type ,cast(tbsp_page_size as integer) page_size ,(tbsp_total_pages * tbsp_page_size) / 1024 / 1024 as total_size_mb ,(tbsp_used_pages * tbsp_page_size) / 1024 / 1024 as used_size_mb from table(MON_GET_TABLESPACE('',-1)) as tbs_cfg where tbs_cfg.tbsp_name not like 'SYS%' UNION select 'TOTAL' TABLESPACE, 'TOTAL' tbsp_state, 'TOTAL' TYPE ,0 tbsp_page_size ,sum((tbsp_total_pages * tbsp_page_size) / 1024 / 1024) as total_size_mb ,sum((tbsp_used_pages * tbsp_page_size) / 1024 / 1024) as used_size_mb from table(MON_GET_TABLESPACE('',-1)) as tbs_t where tbs_t.tbsp_name not like 'SYS%'; |
728x90
반응형
'Intern > DB2' 카테고리의 다른 글
[DB2] 메모리 모델 (0) | 2021.11.22 |
---|---|
[DB2] 버퍼풀 (0) | 2021.11.22 |
[DB2] STOGROUP (0) | 2021.10.12 |
[DB2] 카탈로그 (0) | 2021.10.07 |
[DB2] Backup & Restore (0) | 2021.09.24 |