vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Have written a litte sql for showing the utilization of the tablespace. (found it within the newsgroup from Paul Vernon). Looks fine for an one Partition System only. But how i can I see on which Partiton the Tablesapces reside. select substr(TABLESPACE_NAME,1, 18) as TABLESPACE_NAME, case when TABLESPACE_TYPE = 0 then 'DMS' else 'SMS' end as TBS_TYPE, int(TOTAL_PAGES) as TOTAL_PAGES, int(TOTAL_PAGES*PAGE_SIZE/1024/1024) as TOTAL_MB, int(USED_PAGES) as USED_PAGES, int(USED_PAGES*PAGE_SIZE/1024/1024) as USED_MB, int(FREE_PAGES) as FREE_PAGES, int(FREE_PAGES*PAGE_SIZE/1024/1024) as FREE_MB, ((USED_PAGES * 100) / TOTAL_PAGES) as PERC_USED from table (snapshot_tbs_CFG(cast(null as varchar(20)), -2 )) as x order by PERC_USED desc; Output: TABLESPACE_NAME TBS_TYPE TOTAL_PAGES TOTAL_MB USED_PAGES USED_MB FREE_PAGES FREE_MB PERC_USED ------------------ -------- ----------- ----------- ----------- ----------- ----------- ----------- -------------------- TEMPSPACE4 SMS 1 0 1 0 0 0 100 TEMPSPACE4 SMS 1 0 1 0 0 0 100 TEMPSPACE4 SMS 1 0 1 0 0 0 100 TEMPSPACE4 SMS 1 0 1 0 0 0 100 TEMPSPACE4 SMS 1 0 1 0 0 0 100 TEMPSPACE8K SMS 1 0 1 0 0 0 100 TEMPSPACE8K SMS 1409 11 1409 11 0 0 100 TEMPSPACE8K SMS 1409 11 1409 11 0 0 100 TEMPSPACE8K SMS 1409 11 1409 11 0 0 100 TEMPSPACE8K SMS 1409 11 1409 11 0 0 100 TEMPSPACE32K SMS 1 0 1 0 0 0 100 TEMPSPACE32K SMS 17 0 17 0 0 0 100 TEMPSPACE32K SMS 17 0 17 0 0 0 100 TEMPSPACE32K SMS 17 0 17 0 0 0 100 TEMPSPACE32K SMS 17 0 17 0 0 0 100 INDEXSPACE DMS 2560000 20000 2109456 16480 450512 3519 82 USERSPACE DMS 3000000 23437 2400736 18755 599200 4681 80 USERSPACE DMS 3000000 23437 2412256 18845 587680 4591 80 USERSPACE DMS 3000000 23437 2377088 18571 622848 4866 79 ...... -- regards Joachim Müller |
| |||
| I don't believe you can get the partition number from the snapshot table function. Use the following SQL to see partition numbers: select substr(tbspace,1,18), tbspaceid, substr(t.dbpgname,1,18), dbpartitionnum from syscat.tablespaces as t, syscat.dbpartitiongroupdef as d where t.dbpgname = d.dbpgname; You won't see any of your temp table spaces since SYSCAT.DBPARTITIONGROUPDEF doesn't contain partition numbers for temp table spaces. "Joachim Mueller" <jom0309@[--spam--]douglas-informatik.de> wrote in message news:bu8cd9$rli$1@news.dtag.de... > Have written a litte sql for showing the utilization of the tablespace. > (found it within the newsgroup from Paul Vernon). > Looks fine for an one Partition System only. > But how i can I see on which Partiton the Tablesapces reside. > > select substr(TABLESPACE_NAME,1, 18) as TABLESPACE_NAME, > case when TABLESPACE_TYPE = 0 > then 'DMS' > else 'SMS' > end as TBS_TYPE, > int(TOTAL_PAGES) as TOTAL_PAGES, > int(TOTAL_PAGES*PAGE_SIZE/1024/1024) as TOTAL_MB, > int(USED_PAGES) as USED_PAGES, > int(USED_PAGES*PAGE_SIZE/1024/1024) as USED_MB, > int(FREE_PAGES) as FREE_PAGES, > int(FREE_PAGES*PAGE_SIZE/1024/1024) as FREE_MB, > ((USED_PAGES * 100) / TOTAL_PAGES) as PERC_USED > from table (snapshot_tbs_CFG(cast(null as varchar(20)), -2 )) as x > order by PERC_USED desc; > > Output: > > TABLESPACE_NAME TBS_TYPE TOTAL_PAGES TOTAL_MB USED_PAGES USED_MB > FREE_PAGES FREE_MB PERC_USED > > ------------------ -------- ----------- ----------- ----------- ---------- - > ----------- ----------- -------------------- > > TEMPSPACE4 SMS 1 0 1 0 > 0 0 100 > > TEMPSPACE4 SMS 1 0 1 0 > 0 0 100 > > TEMPSPACE4 SMS 1 0 1 0 > 0 0 100 > > TEMPSPACE4 SMS 1 0 1 0 > 0 0 100 > > TEMPSPACE4 SMS 1 0 1 0 > 0 0 100 > > TEMPSPACE8K SMS 1 0 1 0 > 0 0 100 > > TEMPSPACE8K SMS 1409 11 1409 11 > 0 0 100 > > TEMPSPACE8K SMS 1409 11 1409 11 > 0 0 100 > > TEMPSPACE8K SMS 1409 11 1409 11 > 0 0 100 > > TEMPSPACE8K SMS 1409 11 1409 11 > 0 0 100 > > TEMPSPACE32K SMS 1 0 1 0 > 0 0 100 > > TEMPSPACE32K SMS 17 0 17 0 > 0 0 100 > > TEMPSPACE32K SMS 17 0 17 0 > 0 0 100 > > TEMPSPACE32K SMS 17 0 17 0 > 0 0 100 > > TEMPSPACE32K SMS 17 0 17 0 > 0 0 100 > > INDEXSPACE DMS 2560000 20000 2109456 16480 > 450512 3519 82 > > USERSPACE DMS 3000000 23437 2400736 18755 > 599200 4681 80 > > USERSPACE DMS 3000000 23437 2412256 18845 > 587680 4591 80 > > USERSPACE DMS 3000000 23437 2377088 18571 > 622848 4866 79 > ..... > > -- > > regards > Joachim Müller > > |
| |||
| You can use the following query to get the partition information. I hope you are aware that the snapshot table functions cannot be used from remote clients because you cannot implicitly attach to the instance from a remote client. This was in documented in known problems and workaround docs in fp 3. Thanks Amit (singleton at canada.com) WITH TEMP1 ( DBPGNAME, DBPARTITIONNUM, ALLNODES) AS ( SELECT DBPGNAME ,MIN(DBPARTITIONNUM) ,VARCHAR( CHAR(MIN(DBPARTITIONNUM)),50) FROM SYSCAT.DBPARTITIONGROUPDEF A GROUP BY DBPGNAME UNION ALL SELECT A.DBPGNAME ,A.DBPARTITIONNUM, (RTRIM(B.ALLNODES) || ', ' || CHAR(A.DBPARTITIONNUM)) FROM SYSCAT.DBPARTITIONGROUPDEF A , TEMP1 B WHERE A.DBPGNAME = B.DBPGNAME AND A.DBPARTITIONNUM > B.DBPARTITIONNUM ), TEMP2 (TBSPACE, DBPGNAME, ALLNODES) AS ( SELECT TBSPACE, F.DBPGNAME, F.ALLNODES FROM SYSCAT.TABLESPACES D LEFT OUTER JOIN ( SELECT C.DBPGNAME, C.ALLNODES FROM TEMP1 C WHERE DBPARTITIONNUM = ( SELECT MAX(DBPARTITIONNUM) FROM TEMP1 E WHERE C.DBPGNAME = E.DBPGNAME)) F ON D.DBPGNAME=F.DBPGNAME ), TEMP3 (TBSPACE, DBPGNAME, PARTITIONS ) AS (SELECT TBSPACE, COALESCE( DBPGNAME, 'IBMTEMPGROUP') , COALESCE( ALLNODES, CHAR((SELECT DBPARTITIONNUM FROM SYSCAT.DBPARTITIONGROUPDEF WHERE DBPGNAME='IBMCATGROUP' FETCH FIRST ROW ONLY )) ) FROM TEMP2) SELECT SUBSTR(TABLESPACE_NAME,1, 18) AS TABLESPACE_NAME, CASE WHEN TABLESPACE_TYPE = 0 THEN 'DMS' ELSE 'SMS' END AS TBS_TYPE, INT(TOTAL_PAGES) AS TOTAL_PAGES, INT(TOTAL_PAGES*PAGE_SIZE/1024/1024) AS TOTAL_MB, INT(USED_PAGES) AS USED_PAGES, INT(USED_PAGES*PAGE_SIZE/1024/1024) AS USED_MB, INT(FREE_PAGES) AS FREE_PAGES, INT(FREE_PAGES*PAGE_SIZE/1024/1024) AS FREE_MB, ((USED_PAGES * 100) / TOTAL_PAGES) AS PERC_USED, Y.DBPGNAME, Y.PARTITIONS FROM TABLE (SNAPSHOT_TBS_CFG(CAST(NULL AS VARCHAR(20)), -2 )) AS X LEFT OUTER JOIN TEMP3 AS Y ON RTRIM(X.TABLESPACE_NAME)= RTRIM(Y.TBSPACE) "Bill Pellett" <wpellett@prodigy.net> wrote in message news:<XxWNb.57465$Ee2.41821@newssvr31.news.prodigy .com>... > I don't believe you can get the partition number from the snapshot table > function. Use the following SQL to see partition numbers: > > select substr(tbspace,1,18), tbspaceid, substr(t.dbpgname,1,18), > dbpartitionnum from syscat.tablespaces as t, syscat.dbpartitiongroupdef as d > where t.dbpgname = d.dbpgname; > > You won't see any of your temp table spaces since SYSCAT.DBPARTITIONGROUPDEF > doesn't contain partition numbers for temp table spaces. > > > "Joachim Mueller" <jom0309@[--spam--]douglas-informatik.de> wrote in message > news:bu8cd9$rli$1@news.dtag.de... > > Have written a litte sql for showing the utilization of the tablespace. > > (found it within the newsgroup from Paul Vernon). > > Looks fine for an one Partition System only. > > But how i can I see on which Partiton the Tablesapces reside. > > > > select substr(TABLESPACE_NAME,1, 18) as TABLESPACE_NAME, > > case when TABLESPACE_TYPE = 0 > > then 'DMS' > > else 'SMS' > > end as TBS_TYPE, > > int(TOTAL_PAGES) as TOTAL_PAGES, > > int(TOTAL_PAGES*PAGE_SIZE/1024/1024) as TOTAL_MB, > > int(USED_PAGES) as USED_PAGES, > > int(USED_PAGES*PAGE_SIZE/1024/1024) as USED_MB, > > int(FREE_PAGES) as FREE_PAGES, > > int(FREE_PAGES*PAGE_SIZE/1024/1024) as FREE_MB, > > ((USED_PAGES * 100) / TOTAL_PAGES) as PERC_USED > > from table (snapshot_tbs_CFG(cast(null as varchar(20)), -2 )) as x > > order by PERC_USED desc; > > > > Output: > > > > TABLESPACE_NAME TBS_TYPE TOTAL_PAGES TOTAL_MB USED_PAGES USED_MB > > FREE_PAGES FREE_MB PERC_USED > > > > ------------------ -------- ----------- ----------- ----------- ---------- > - > > ----------- ----------- -------------------- > > > > TEMPSPACE4 SMS 1 0 1 > 0 > > 0 0 100 > > > > TEMPSPACE4 SMS 1 0 1 > 0 > > 0 0 100 > > > > TEMPSPACE4 SMS 1 0 1 > 0 > > 0 0 100 > > > > TEMPSPACE4 SMS 1 0 1 > 0 > > 0 0 100 > > > > TEMPSPACE4 SMS 1 0 1 > 0 > > 0 0 100 > > > > TEMPSPACE8K SMS 1 0 1 > 0 > > 0 0 100 > > > > TEMPSPACE8K SMS 1409 11 1409 > 11 > > 0 0 100 > > > > TEMPSPACE8K SMS 1409 11 1409 > 11 > > 0 0 100 > > > > TEMPSPACE8K SMS 1409 11 1409 > 11 > > 0 0 100 > > > > TEMPSPACE8K SMS 1409 11 1409 > 11 > > 0 0 100 > > > > TEMPSPACE32K SMS 1 0 1 > 0 > > 0 0 100 > > > > TEMPSPACE32K SMS 17 0 17 > 0 > > 0 0 100 > > > > TEMPSPACE32K SMS 17 0 17 > 0 > > 0 0 100 > > > > TEMPSPACE32K SMS 17 0 17 > 0 > > 0 0 100 > > > > TEMPSPACE32K SMS 17 0 17 > 0 > > 0 0 100 > > > > INDEXSPACE DMS 2560000 20000 2109456 > 16480 > > 450512 3519 82 > > > > USERSPACE DMS 3000000 23437 2400736 > 18755 > > 599200 4681 80 > > > > USERSPACE DMS 3000000 23437 2412256 > 18845 > > 587680 4591 80 > > > > USERSPACE DMS 3000000 23437 2377088 > 18571 > > 622848 4866 79 > > ..... > > > > -- > > > > regards > > Joachim Müller > > > > |
| |||
| Amit, thanks for your reply, if I run your query ,it's not the result I expect: WITH TEMP1 ( DBPGNAME, DBPARTITIONNUM, ALLNODES) AS ( SELECT DBPGNAME ,MIN(DBPARTITIONNUM) ,VARCHAR( CHAR(MIN(DBPARTITIONNUM)),50) FROM SYSCAT.DBPARTITIONGROUPDEF A GROUP BY DBPGNAME UNION ALL SELECT A.DBPGNAME ,A.DBPARTITIONNUM, (RTRIM(B.ALLNODES) || ', ' || CHAR(A.DBPARTITIONNUM)) FROM SYSCAT.DBPARTITIONGROUPDEF A , TEMP1 B WHERE A.DBPGNAME = B.DBPGNAME AND A.DBPARTITIONNUM > B.DBPARTITIONNUM ), TEMP2 (TBSPACE, DBPGNAME, ALLNODES) AS ( SELECT TBSPACE, F.DBPGNAME, F.ALLNODES FROM SYSCAT.TABLESPACES D LEFT OUTER JOIN ( SELECT C.DBPGNAME, C.ALLNODES FROM TEMP1 C WHERE DBPARTITIONNUM = ( SELECT MAX(DBPARTITIONNUM) FROM TEMP1 E WHERE C.DBPGNAME = E.DBPGNAME)) F ON D.DBPGNAME=F.DBPGNAME ), TEMP3 (TBSPACE, DBPGNAME, PARTITIONS ) AS (SELECT TBSPACE, COALESCE( DBPGNAME, 'IBMTEMPGROUP') , COALESCE( ALLNODES, CHAR((SELECT DBPARTITIONNUM FROM SYSCAT.DBPARTITIONGROUPDEF WHERE DBPGNAME='IBMCATGROUP' FETCH FIRST ROW ONLY )) ) FROM TEMP2) SELECT SUBSTR(TABLESPACE_NAME,1, 18) AS TABLESPACE_NAME, CASE WHEN TABLESPACE_TYPE = 0 THEN 'DMS' ELSE 'SMS' END AS TBS_TYPE, INT(TOTAL_PAGES) AS TOTAL_PAGES, INT(TOTAL_PAGES*PAGE_SIZE/1024/1024) AS TOTAL_MB, INT(USED_PAGES) AS USED_PAGES, INT(USED_PAGES*PAGE_SIZE/1024/1024) AS USED_MB, INT(FREE_PAGES) AS FREE_PAGES, INT(FREE_PAGES*PAGE_SIZE/1024/1024) AS FREE_MB, ((USED_PAGES * 100) / TOTAL_PAGES) AS PERC_USED, Y.DBPGNAME, Y.PARTITIONS FROM TABLE (SNAPSHOT_TBS_CFG(CAST(NULL AS VARCHAR(20)), -2 )) AS X LEFT OUTER JOIN TEMP3 AS Y ON RTRIM(X.TABLESPACE_NAME)= RTRIM(Y.TBSPACE) TABLESPACE_NAME TBS_TYPE TOTAL_PAGES TOTAL_MB USED_PAGES USED_MB FREE_PAGES FREE_MB PERC_USED DBPGNAME PARTITIONS ------------------ -------- ----------- ----------- ----------- ----------- ----------- ----------- -------------------- ------------------------------- ---------------------------------------------------------------------------- --------------------- -------------------------------------------------- SQL0347W The recursive common table expression "DB2DWP.TEMP1" may contain an infinite loop. SQLSTATE=01605 DLP_IDX DMS 50000 390 36032 281 13952 109 72 USERGROUP 2, 5 DLP_IDX DMS 50000 390 36032 281 13952 109 72 USERGROUP 2, 3, 4, 5 DLP_IDX DMS 50000 390 36032 281 13952 109 72 USERGROUP 2, 4, 5 DLP_IDX DMS 50000 390 36032 281 13952 109 72 USERGROUP 2, 3, 5 DLP_IDX DMS 50000 390 36032 281 13952 109 72 USERGROUP 2, 5 DLP_IDX DMS 50000 390 36032 281 13952 109 72 USERGROUP 2, 3, 4, 5 DLP_IDX DMS 50000 390 36032 281 13952 109 72 USERGROUP 2, 4, 5 DLP_IDX DMS 50000 390 36032 281 13952 109 72 USERGROUP 2, 3, 5 DLP_IDX DMS 50000 390 36032 281 13952 109 72 USERGROUP 2, 5 DLP_IDX DMS 50000 390 36032 281 13952 109 72 USERGROUP 2, 3, 4, 5 DLP_IDX DMS 50000 390 36032 281 13952 109 72 USERGROUP 2, 4, 5 DLP_IDX DMS 50000 390 36032 281 13952 109 72 USERGROUP 2, 3, 5 DLP_IDX DMS 50000 390 36032 281 13952 109 72 USERGROUP 2, 5 DLP_IDX DMS 50000 390 36032 281 13952 109 72 USERGROUP 2, 3, 4, 5 DLP_IDX DMS 50000 390 36032 281 13952 109 72 USERGROUP 2, 4, 5 DLP_IDX DMS 50000 390 36032 281 13952 109 72 USERGROUP 2, 3, 5 For each row I only need the Partition for the Tablespaces. Regards, Joachim "Amit" <aamit@hotmail.com> schrieb im Newsbeitrag news:85e31e0f.0401161555.422abe70@posting.google.c om... > You can use the following query to get the partition information. I > hope you are aware that the snapshot table functions cannot be used > from remote clients because you cannot implicitly attach to the > instance from a remote client. This was in documented in known > problems and workaround docs in fp 3. > Thanks > Amit (singleton at canada.com) > > WITH TEMP1 ( DBPGNAME, DBPARTITIONNUM, ALLNODES) AS ( SELECT DBPGNAME > ,MIN(DBPARTITIONNUM) ,VARCHAR( CHAR(MIN(DBPARTITIONNUM)),50) > FROM SYSCAT.DBPARTITIONGROUPDEF A > GROUP BY DBPGNAME UNION ALL > SELECT A.DBPGNAME ,A.DBPARTITIONNUM, (RTRIM(B.ALLNODES) || ', ' || > CHAR(A.DBPARTITIONNUM)) > FROM SYSCAT.DBPARTITIONGROUPDEF A , TEMP1 B > WHERE A.DBPGNAME = B.DBPGNAME > AND A.DBPARTITIONNUM > B.DBPARTITIONNUM ), > TEMP2 (TBSPACE, DBPGNAME, ALLNODES) AS > ( SELECT TBSPACE, F.DBPGNAME, F.ALLNODES FROM SYSCAT.TABLESPACES D > LEFT OUTER JOIN ( SELECT C.DBPGNAME, C.ALLNODES FROM TEMP1 C WHERE > DBPARTITIONNUM = ( SELECT MAX(DBPARTITIONNUM) FROM TEMP1 E WHERE > C.DBPGNAME = E.DBPGNAME)) F > ON D.DBPGNAME=F.DBPGNAME ), > TEMP3 (TBSPACE, DBPGNAME, PARTITIONS ) AS > (SELECT TBSPACE, COALESCE( DBPGNAME, 'IBMTEMPGROUP') , COALESCE( > ALLNODES, CHAR((SELECT DBPARTITIONNUM FROM SYSCAT.DBPARTITIONGROUPDEF > WHERE DBPGNAME='IBMCATGROUP' FETCH FIRST ROW ONLY )) ) FROM TEMP2) > SELECT SUBSTR(TABLESPACE_NAME,1, 18) AS TABLESPACE_NAME, > CASE WHEN TABLESPACE_TYPE = 0 > THEN 'DMS' > ELSE 'SMS' > END AS TBS_TYPE, > INT(TOTAL_PAGES) AS TOTAL_PAGES, > INT(TOTAL_PAGES*PAGE_SIZE/1024/1024) AS TOTAL_MB, > INT(USED_PAGES) AS USED_PAGES, > INT(USED_PAGES*PAGE_SIZE/1024/1024) AS USED_MB, > INT(FREE_PAGES) AS FREE_PAGES, > INT(FREE_PAGES*PAGE_SIZE/1024/1024) AS FREE_MB, > ((USED_PAGES * 100) / TOTAL_PAGES) AS PERC_USED, Y.DBPGNAME, > Y.PARTITIONS > FROM TABLE (SNAPSHOT_TBS_CFG(CAST(NULL AS VARCHAR(20)), -2 )) AS X > LEFT OUTER JOIN TEMP3 AS Y ON RTRIM(X.TABLESPACE_NAME)= > RTRIM(Y.TBSPACE) > > > > > > > > "Bill Pellett" <wpellett@prodigy.net> wrote in message news:<XxWNb.57465$Ee2.41821@newssvr31.news.prodigy .com>... > > I don't believe you can get the partition number from the snapshot table > > function. Use the following SQL to see partition numbers: > > > > select substr(tbspace,1,18), tbspaceid, substr(t.dbpgname,1,18), > > dbpartitionnum from syscat.tablespaces as t, syscat.dbpartitiongroupdef as d > > where t.dbpgname = d.dbpgname; > > > > You won't see any of your temp table spaces since SYSCAT.DBPARTITIONGROUPDEF > > doesn't contain partition numbers for temp table spaces. > > > > > > "Joachim Mueller" <jom0309@[--spam--]douglas-informatik.de> wrote in message > > news:bu8cd9$rli$1@news.dtag.de... > > > Have written a litte sql for showing the utilization of the tablespace. > > > (found it within the newsgroup from Paul Vernon). > > > Looks fine for an one Partition System only. > > > But how i can I see on which Partiton the Tablesapces reside. > > > > > > select substr(TABLESPACE_NAME,1, 18) as TABLESPACE_NAME, > > > case when TABLESPACE_TYPE = 0 > > > then 'DMS' > > > else 'SMS' > > > end as TBS_TYPE, > > > int(TOTAL_PAGES) as TOTAL_PAGES, > > > int(TOTAL_PAGES*PAGE_SIZE/1024/1024) as TOTAL_MB, > > > int(USED_PAGES) as USED_PAGES, > > > int(USED_PAGES*PAGE_SIZE/1024/1024) as USED_MB, > > > int(FREE_PAGES) as FREE_PAGES, > > > int(FREE_PAGES*PAGE_SIZE/1024/1024) as FREE_MB, > > > ((USED_PAGES * 100) / TOTAL_PAGES) as PERC_USED > > > from table (snapshot_tbs_CFG(cast(null as varchar(20)), -2 )) as x > > > order by PERC_USED desc; > > > > > > Output: > > > > > > TABLESPACE_NAME TBS_TYPE TOTAL_PAGES TOTAL_MB USED_PAGES USED_MB > > > FREE_PAGES FREE_MB PERC_USED > > > > > > ------------------ -------- ----------- ----------- ----------- ---------- > > - > > > ----------- ----------- -------------------- > > > > > > TEMPSPACE4 SMS 1 0 1 > > 0 > > > 0 0 100 > > > > > > TEMPSPACE4 SMS 1 0 1 > > 0 > > > 0 0 100 > > > > > > TEMPSPACE4 SMS 1 0 1 > > 0 > > > 0 0 100 > > > > > > TEMPSPACE4 SMS 1 0 1 > > 0 > > > 0 0 100 > > > > > > TEMPSPACE4 SMS 1 0 1 > > 0 > > > 0 0 100 > > > > > > TEMPSPACE8K SMS 1 0 1 > > 0 > > > 0 0 100 > > > > > > TEMPSPACE8K SMS 1409 11 1409 > > 11 > > > 0 0 100 > > > > > > TEMPSPACE8K SMS 1409 11 1409 > > 11 > > > 0 0 100 > > > > > > TEMPSPACE8K SMS 1409 11 1409 > > 11 > > > 0 0 100 > > > > > > TEMPSPACE8K SMS 1409 11 1409 > > 11 > > > 0 0 100 > > > > > > TEMPSPACE32K SMS 1 0 1 > > 0 > > > 0 0 100 > > > > > > TEMPSPACE32K SMS 17 0 17 > > 0 > > > 0 0 100 > > > > > > TEMPSPACE32K SMS 17 0 17 > > 0 > > > 0 0 100 > > > > > > TEMPSPACE32K SMS 17 0 17 > > 0 > > > 0 0 100 > > > > > > TEMPSPACE32K SMS 17 0 17 > > 0 > > > 0 0 100 > > > > > > INDEXSPACE DMS 2560000 20000 2109456 > > 16480 > > > 450512 3519 82 > > > > > > USERSPACE DMS 3000000 23437 2400736 > > 18755 > > > 599200 4681 80 > > > > > > USERSPACE DMS 3000000 23437 2412256 > > 18845 > > > 587680 4591 80 > > > > > > USERSPACE DMS 3000000 23437 2377088 > > 18571 > > > 622848 4866 79 > > > ..... > > > > > > -- > > > > > > regards > > > Joachim Müller > > > > > > |
| |||
| Not sure if I understand correctly. The last column of the query I posted showns the partitions that the tablespace exists on. The tablespace will exist on all partitions of the nodegroup (database partition group) that its defined on - not just one partition. Thanks Amit |
| |||
| oops - realised my query had some problems - here's the one that calculates the aggregates and returns the total for each tablespace If you want a query that returns the partition number for each row instead of aggregate, you can also achive that similarly using sql recursion (pass in the next node number as the secomd argument in SNAPSHOT_TBS_CFG ). I think partition number should be in the result set (and monitor elements) for tablespaces but was proabably left out due to an oversight. WITH TEMP1 ( DBPGNAME, DBPARTITIONNUM, ALLNODES, LEVEL) AS ( SELECT DBPGNAME ,MIN(DBPARTITIONNUM) ,VARCHAR( CHAR(MIN(DBPARTITIONNUM)),50), 0 FROM SYSCAT.DBPARTITIONGROUPDEF A GROUP BY DBPGNAME UNION ALL SELECT A.DBPGNAME ,A.DBPARTITIONNUM, (RTRIM(B.ALLNODES) || ', ' || CHAR(A.DBPARTITIONNUM)), B.LEVEL+1 FROM SYSCAT.DBPARTITIONGROUPDEF A , TEMP1 B WHERE A.DBPGNAME = B.DBPGNAME AND A.DBPARTITIONNUM > B.DBPARTITIONNUM ), TEMP2 (TBSPACE, DBPGNAME, ALLNODES) AS ( SELECT TBSPACE, F.DBPGNAME, F.ALLNODES FROM SYSCAT.TABLESPACES D LEFT OUTER JOIN ( SELECT C.DBPGNAME, C.ALLNODES FROM TEMP1 C WHERE C.LEVEL = ( SELECT MAX(LEVEL) FROM TEMP1 E WHERE C.DBPGNAME = E.DBPGNAME)) F ON D.DBPGNAME=F.DBPGNAME ), TEMP3 (TBSPACE, DBPGNAME, PARTITIONS ) AS (SELECT TBSPACE, COALESCE( DBPGNAME, 'IBMTEMPGROUP') , COALESCE( ALLNODES, CHAR((SELECT DBPARTITIONNUM FROM SYSCAT.DBPARTITIONGROUPDEF WHERE DBPGNAME='IBMCATGROUP' FETCH FIRST ROW ONLY )) ) FROM TEMP2), TEMP4 AS (SELECT TABLESPACE_NAME , CASE WHEN TABLESPACE_TYPE = 0 THEN 'DMS' ELSE 'SMS' END AS TBS_TYPE, SUM(TOTAL_PAGES) AS TOTAL_PAGES, SUM(TOTAL_PAGES*PAGE_SIZE)/1024/1024 AS TOTAL_MB, SUM(USED_PAGES) AS USED_PAGES, SUM(USED_PAGES*PAGE_SIZE)/1024/1024 AS USED_MB, SUM(FREE_PAGES) AS FREE_PAGES, SUM(FREE_PAGES*PAGE_SIZE)/1024/1024 AS FREE_MB, CASE WHEN SUM (TOTAL_PAGES) >0 THEN (SUM(USED_PAGES) * 100 / SUM (TOTAL_PAGES) ) ELSE NULL END AS PERC_USED FROM TABLE (SNAPSHOT_TBS_CFG(CAST(NULL AS VARCHAR(20)), -2 )) AS A GROUP BY TABLESPACE_NAME, TABLESPACE_TYPE ) SELECT A.*, B.DBPGNAME, B.PARTITIONS FROM TEMP4 A INNER JOIN TEMP3 B ON RTRIM(A.TABLESPACE_NAME) = RTRIM(B.TBSPACE) aamit@hotmail.com (Amit) wrote in message news:<85e31e0f.0401190901.5a442a90@posting.google. com>... > Not sure if I understand correctly. The last column of the query I > posted showns the partitions that the tablespace exists on. The > tablespace will exist on all partitions of the nodegroup (database > partition group) that its defined on - not just one partition. > > Thanks > Amit |
| |||
| Amit, thanks once more, but (a big BUT) sometimes the PERC_USED column is equal on all partitions, but most the the differ from partition to partition. What I want is to see which partition have reached the threshold for 85% so I can resize the container lying on this partition. Here is a better sample: TABLESPACE_NAME TBS_TYPE TOTAL_PAGES TOTAL_MB USED_PAGES USED_MB FREE_PAGES FREE_MB PERC_USED ------------------ -------- ----------- ----------- ----------- ----------- ----------- ----------- -------------------- USERSPACE DMS 3000000 23437 2382240 18611 617696 4825 79 USERSPACE DMS 3000000 23437 2410496 18832 589440 4605 80 USERSPACE DMS 3000000 23437 2406784 18803 593152 4634 80 USERSPACE DMS 3000000 23437 2421152 18915 578784 4521 80 INDEXSPACE DMS 2560000 20000 2022640 15801 537328 4197 79 INDEXSPACE DMS 2560000 20000 2024432 15815 535536 4183 79 INDEXSPACE DMS 2560000 20000 2014752 15740 545216 4259 78 INDEXSPACE DMS 2560000 20000 2096592 16379 463376 3620 81 You see that USERSPACE also INDEXSPACE have the same TOTAL_PAGES each on one of the four partitions. But USED_PAGES differs on the four partitions. Sorry for my bad english, it's hard to explain something thats not my native language;-) regards, Joachim "Amit" <aamit@hotmail.com> schrieb im Newsbeitrag news:85e31e0f.0401191548.680ee44@posting.google.co m... > oops - realised my query had some problems - here's the one that > calculates the aggregates and returns the total for each tablespace > If you want a query that returns the partition number for each row > instead of aggregate, you can also achive that similarly using sql > recursion (pass in the next node number as the secomd argument in > SNAPSHOT_TBS_CFG ). I think partition number should be in the result > set (and monitor elements) for tablespaces but was proabably left out > due to an oversight. > > > WITH TEMP1 ( DBPGNAME, DBPARTITIONNUM, ALLNODES, LEVEL) AS ( SELECT > DBPGNAME > ,MIN(DBPARTITIONNUM) ,VARCHAR( CHAR(MIN(DBPARTITIONNUM)),50), 0 > FROM SYSCAT.DBPARTITIONGROUPDEF A > GROUP BY DBPGNAME UNION ALL > SELECT A.DBPGNAME ,A.DBPARTITIONNUM, (RTRIM(B.ALLNODES) || ', ' || > CHAR(A.DBPARTITIONNUM)), B.LEVEL+1 > FROM SYSCAT.DBPARTITIONGROUPDEF A , TEMP1 B > WHERE A.DBPGNAME = B.DBPGNAME > AND A.DBPARTITIONNUM > B.DBPARTITIONNUM > ), > TEMP2 (TBSPACE, DBPGNAME, ALLNODES) AS > ( SELECT TBSPACE, F.DBPGNAME, F.ALLNODES FROM SYSCAT.TABLESPACES D > LEFT OUTER JOIN ( SELECT C.DBPGNAME, C.ALLNODES FROM TEMP1 C WHERE > C.LEVEL = ( SELECT MAX(LEVEL) FROM TEMP1 E WHERE > C.DBPGNAME = E.DBPGNAME)) F > ON D.DBPGNAME=F.DBPGNAME ), > TEMP3 (TBSPACE, DBPGNAME, PARTITIONS ) AS > (SELECT TBSPACE, COALESCE( DBPGNAME, 'IBMTEMPGROUP') , COALESCE( > ALLNODES, CHAR((SELECT DBPARTITIONNUM FROM SYSCAT.DBPARTITIONGROUPDEF > WHERE DBPGNAME='IBMCATGROUP' FETCH FIRST ROW ONLY )) ) FROM TEMP2), > TEMP4 AS > (SELECT TABLESPACE_NAME , CASE WHEN TABLESPACE_TYPE = 0 THEN 'DMS' > ELSE 'SMS' END AS > TBS_TYPE, SUM(TOTAL_PAGES) AS TOTAL_PAGES, > SUM(TOTAL_PAGES*PAGE_SIZE)/1024/1024 AS TOTAL_MB, SUM(USED_PAGES) AS > USED_PAGES, SUM(USED_PAGES*PAGE_SIZE)/1024/1024 AS USED_MB, > SUM(FREE_PAGES) > AS FREE_PAGES, SUM(FREE_PAGES*PAGE_SIZE)/1024/1024 AS FREE_MB, CASE > WHEN SUM (TOTAL_PAGES) >0 THEN (SUM(USED_PAGES) > * 100 / SUM (TOTAL_PAGES) ) ELSE NULL END AS PERC_USED FROM TABLE > (SNAPSHOT_TBS_CFG(CAST(NULL AS VARCHAR(20)), -2 )) AS A GROUP BY > TABLESPACE_NAME, TABLESPACE_TYPE ) > SELECT A.*, B.DBPGNAME, B.PARTITIONS FROM TEMP4 A INNER JOIN TEMP3 B > ON RTRIM(A.TABLESPACE_NAME) = RTRIM(B.TBSPACE) > > > > > aamit@hotmail.com (Amit) wrote in message news:<85e31e0f.0401190901.5a442a90@posting.google. com>... > > Not sure if I understand correctly. The last column of the query I > > posted showns the partitions that the tablespace exists on. The > > tablespace will exist on all partitions of the nodegroup (database > > partition group) that its defined on - not just one partition. > > > > Thanks > > Amit |
| |||
| You will either need to run the Tablespace Snaphot Query separately (maybe use a sql proc) for each partition (you can pass in the partition number to the table function) or use recursive sql (using a common table expression) to call the table function repeatedly with different partition numbers and show the results with the partition number as the last column. "Joachim Mueller" <jom0309@[--spam--]douglas-informatik.de> wrote in message news:<buis2q$93m$1@news.dtag.de>... > Amit, > > thanks once more, but (a big BUT) sometimes the PERC_USED column is equal on > all > partitions, but most the the differ from partition to partition. > What I want is to see which partition have reached the threshold for 85% so > I can resize the container > lying on this partition. > > Here is a better sample: > > TABLESPACE_NAME TBS_TYPE TOTAL_PAGES TOTAL_MB USED_PAGES USED_MB > FREE_PAGES FREE_MB PERC_USED > > ------------------ -------- ----------- ----------- ----------- ----------- > ----------- ----------- -------------------- > > > USERSPACE DMS 3000000 23437 2382240 18611 > 617696 4825 79 > > USERSPACE DMS 3000000 23437 2410496 18832 > 589440 4605 80 > > USERSPACE DMS 3000000 23437 2406784 18803 > 593152 4634 80 > > USERSPACE DMS 3000000 23437 2421152 18915 > 578784 4521 80 > > INDEXSPACE DMS 2560000 20000 2022640 15801 > 537328 4197 79 > > INDEXSPACE DMS 2560000 20000 2024432 15815 > 535536 4183 79 > > INDEXSPACE DMS 2560000 20000 2014752 15740 > 545216 4259 78 > > INDEXSPACE DMS 2560000 20000 2096592 16379 > 463376 3620 81 > > You see that USERSPACE also INDEXSPACE have the same TOTAL_PAGES each on one > of the four partitions. > But USED_PAGES differs on the four partitions. > > Sorry for my bad english, it's hard to explain something thats not my native > language;-) > > regards, > > Joachim > > "Amit" <aamit@hotmail.com> schrieb im Newsbeitrag > news:85e31e0f.0401191548.680ee44@posting.google.co m... > > oops - realised my query had some problems - here's the one that > > calculates the aggregates and returns the total for each tablespace > > If you want a query that returns the partition number for each row > > instead of aggregate, you can also achive that similarly using sql > > recursion (pass in the next node number as the secomd argument in > > SNAPSHOT_TBS_CFG ). I think partition number should be in the result > > set (and monitor elements) for tablespaces but was proabably left out > > due to an oversight. > > > > > > WITH TEMP1 ( DBPGNAME, DBPARTITIONNUM, ALLNODES, LEVEL) AS ( SELECT > > DBPGNAME > > ,MIN(DBPARTITIONNUM) ,VARCHAR( CHAR(MIN(DBPARTITIONNUM)),50), 0 > > FROM SYSCAT.DBPARTITIONGROUPDEF A > > GROUP BY DBPGNAME UNION ALL > > SELECT A.DBPGNAME ,A.DBPARTITIONNUM, (RTRIM(B.ALLNODES) || ', ' || > > CHAR(A.DBPARTITIONNUM)), B.LEVEL+1 > > FROM SYSCAT.DBPARTITIONGROUPDEF A , TEMP1 B > > WHERE A.DBPGNAME = B.DBPGNAME > > AND A.DBPARTITIONNUM > B.DBPARTITIONNUM > > ), > > TEMP2 (TBSPACE, DBPGNAME, ALLNODES) AS > > ( SELECT TBSPACE, F.DBPGNAME, F.ALLNODES FROM SYSCAT.TABLESPACES D > > LEFT OUTER JOIN ( SELECT C.DBPGNAME, C.ALLNODES FROM TEMP1 C WHERE > > C.LEVEL = ( SELECT MAX(LEVEL) FROM TEMP1 E WHERE > > C.DBPGNAME = E.DBPGNAME)) F > > ON D.DBPGNAME=F.DBPGNAME ), > > TEMP3 (TBSPACE, DBPGNAME, PARTITIONS ) AS > > (SELECT TBSPACE, COALESCE( DBPGNAME, 'IBMTEMPGROUP') , COALESCE( > > ALLNODES, CHAR((SELECT DBPARTITIONNUM FROM SYSCAT.DBPARTITIONGROUPDEF > > WHERE DBPGNAME='IBMCATGROUP' FETCH FIRST ROW ONLY )) ) FROM TEMP2), > > TEMP4 AS > > (SELECT TABLESPACE_NAME , CASE WHEN TABLESPACE_TYPE = 0 THEN 'DMS' > > ELSE 'SMS' END AS > > TBS_TYPE, SUM(TOTAL_PAGES) AS TOTAL_PAGES, > > SUM(TOTAL_PAGES*PAGE_SIZE)/1024/1024 AS TOTAL_MB, SUM(USED_PAGES) AS > > USED_PAGES, SUM(USED_PAGES*PAGE_SIZE)/1024/1024 AS USED_MB, > > SUM(FREE_PAGES) > > AS FREE_PAGES, SUM(FREE_PAGES*PAGE_SIZE)/1024/1024 AS FREE_MB, CASE > > WHEN SUM (TOTAL_PAGES) >0 THEN (SUM(USED_PAGES) > > * 100 / SUM (TOTAL_PAGES) ) ELSE NULL END AS PERC_USED FROM TABLE > > (SNAPSHOT_TBS_CFG(CAST(NULL AS VARCHAR(20)), -2 )) AS A GROUP BY > > TABLESPACE_NAME, TABLESPACE_TYPE ) > > SELECT A.*, B.DBPGNAME, B.PARTITIONS FROM TEMP4 A INNER JOIN TEMP3 B > > ON RTRIM(A.TABLESPACE_NAME) = RTRIM(B.TBSPACE) > > > > > > > > > > aamit@hotmail.com (Amit) wrote in message > news:<85e31e0f.0401190901.5a442a90@posting.google. com>... > > > Not sure if I understand correctly. The last column of the query I > > > posted showns the partitions that the tablespace exists on. The > > > tablespace will exist on all partitions of the nodegroup (database > > > partition group) that its defined on - not just one partition. > > > > > > Thanks > > > Amit |
| ||||
| Amit, thanks for your hints, I will give it a try... regards, Joachim "Amit" <aamit@hotmail.com> schrieb im Newsbeitrag news:85e31e0f.0401201953.32461319@posting.google.c om... > You will either need to run the Tablespace Snaphot Query separately > (maybe use a sql proc) for each partition (you can pass in the > partition number to the table function) or use recursive sql (using a > common table expression) to call the table function repeatedly with > different partition numbers and show the results with the partition > number as the last column. > > "Joachim Mueller" <jom0309@[--spam--]douglas-informatik.de> wrote in message news:<buis2q$93m$1@news.dtag.de>... > > Amit, > > > > thanks once more, but (a big BUT) sometimes the PERC_USED column is equal on > > all > > partitions, but most the the differ from partition to partition. > > What I want is to see which partition have reached the threshold for 85% so > > I can resize the container > > lying on this partition. > > > > Here is a better sample: > > > > TABLESPACE_NAME TBS_TYPE TOTAL_PAGES TOTAL_MB USED_PAGES USED_MB > > FREE_PAGES FREE_MB PERC_USED > > > > ------------------ -------- ----------- ----------- ----------- ---------- - > > ----------- ----------- -------------------- > > > > > > USERSPACE DMS 3000000 23437 2382240 18611 > > 617696 4825 79 > > > > USERSPACE DMS 3000000 23437 2410496 18832 > > 589440 4605 80 > > > > USERSPACE DMS 3000000 23437 2406784 18803 > > 593152 4634 80 > > > > USERSPACE DMS 3000000 23437 2421152 18915 > > 578784 4521 80 > > > > INDEXSPACE DMS 2560000 20000 2022640 15801 > > 537328 4197 79 > > > > INDEXSPACE DMS 2560000 20000 2024432 15815 > > 535536 4183 79 > > > > INDEXSPACE DMS 2560000 20000 2014752 15740 > > 545216 4259 78 > > > > INDEXSPACE DMS 2560000 20000 2096592 16379 > > 463376 3620 81 > > > > You see that USERSPACE also INDEXSPACE have the same TOTAL_PAGES each on one > > of the four partitions. > > But USED_PAGES differs on the four partitions. > > > > Sorry for my bad english, it's hard to explain something thats not my native > > language;-) > > > > regards, > > > > Joachim > > > > "Amit" <aamit@hotmail.com> schrieb im Newsbeitrag > > news:85e31e0f.0401191548.680ee44@posting.google.co m... > > > oops - realised my query had some problems - here's the one that > > > calculates the aggregates and returns the total for each tablespace > > > If you want a query that returns the partition number for each row > > > instead of aggregate, you can also achive that similarly using sql > > > recursion (pass in the next node number as the secomd argument in > > > SNAPSHOT_TBS_CFG ). I think partition number should be in the result > > > set (and monitor elements) for tablespaces but was proabably left out > > > due to an oversight. > > > > > > > > > WITH TEMP1 ( DBPGNAME, DBPARTITIONNUM, ALLNODES, LEVEL) AS ( SELECT > > > DBPGNAME > > > ,MIN(DBPARTITIONNUM) ,VARCHAR( CHAR(MIN(DBPARTITIONNUM)),50), 0 > > > FROM SYSCAT.DBPARTITIONGROUPDEF A > > > GROUP BY DBPGNAME UNION ALL > > > SELECT A.DBPGNAME ,A.DBPARTITIONNUM, (RTRIM(B.ALLNODES) || ', ' || > > > CHAR(A.DBPARTITIONNUM)), B.LEVEL+1 > > > FROM SYSCAT.DBPARTITIONGROUPDEF A , TEMP1 B > > > WHERE A.DBPGNAME = B.DBPGNAME > > > AND A.DBPARTITIONNUM > B.DBPARTITIONNUM > > > ), > > > TEMP2 (TBSPACE, DBPGNAME, ALLNODES) AS > > > ( SELECT TBSPACE, F.DBPGNAME, F.ALLNODES FROM SYSCAT.TABLESPACES D > > > LEFT OUTER JOIN ( SELECT C.DBPGNAME, C.ALLNODES FROM TEMP1 C WHERE > > > C.LEVEL = ( SELECT MAX(LEVEL) FROM TEMP1 E WHERE > > > C.DBPGNAME = E.DBPGNAME)) F > > > ON D.DBPGNAME=F.DBPGNAME ), > > > TEMP3 (TBSPACE, DBPGNAME, PARTITIONS ) AS > > > (SELECT TBSPACE, COALESCE( DBPGNAME, 'IBMTEMPGROUP') , COALESCE( > > > ALLNODES, CHAR((SELECT DBPARTITIONNUM FROM SYSCAT.DBPARTITIONGROUPDEF > > > WHERE DBPGNAME='IBMCATGROUP' FETCH FIRST ROW ONLY )) ) FROM TEMP2), > > > TEMP4 AS > > > (SELECT TABLESPACE_NAME , CASE WHEN TABLESPACE_TYPE = 0 THEN 'DMS' > > > ELSE 'SMS' END AS > > > TBS_TYPE, SUM(TOTAL_PAGES) AS TOTAL_PAGES, > > > SUM(TOTAL_PAGES*PAGE_SIZE)/1024/1024 AS TOTAL_MB, SUM(USED_PAGES) AS > > > USED_PAGES, SUM(USED_PAGES*PAGE_SIZE)/1024/1024 AS USED_MB, > > > SUM(FREE_PAGES) > > > AS FREE_PAGES, SUM(FREE_PAGES*PAGE_SIZE)/1024/1024 AS FREE_MB, CASE > > > WHEN SUM (TOTAL_PAGES) >0 THEN (SUM(USED_PAGES) > > > * 100 / SUM (TOTAL_PAGES) ) ELSE NULL END AS PERC_USED FROM TABLE > > > (SNAPSHOT_TBS_CFG(CAST(NULL AS VARCHAR(20)), -2 )) AS A GROUP BY > > > TABLESPACE_NAME, TABLESPACE_TYPE ) > > > SELECT A.*, B.DBPGNAME, B.PARTITIONS FROM TEMP4 A INNER JOIN TEMP3 B > > > ON RTRIM(A.TABLESPACE_NAME) = RTRIM(B.TBSPACE) > > > > > > > > > > > > > > > aamit@hotmail.com (Amit) wrote in message > > news:<85e31e0f.0401190901.5a442a90@posting.google. com>... > > > > Not sure if I understand correctly. The last column of the query I > > > > posted showns the partitions that the tablespace exists on. The > > > > tablespace will exist on all partitions of the nodegroup (database > > > > partition group) that its defined on - not just one partition. > > > > > > > > Thanks > > > > Amit |
| Thread Tools | |
| Display Modes | |
|
|