Svenson's  Bulletin Board Forum Index Svenson's Bulletin Board
Bulletin Board for boat building and model airplane building enthusiasts.
 
AlbumAlbum   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

sql to return tablespace names, nodegroup, pgsz, totalpages

 
Post new topic   Reply to topic    Svenson's Bulletin Board Forum Index -> DB2
View previous topic :: View next topic  
Author Message
craig
Site Admin


Joined: 19 Feb 2006
Posts: 40

PostPosted: Fri Sep 11, 2009 12:19 pm    Post subject: sql to return tablespace names, nodegroup, pgsz, totalpages Reply with quote

with
tspacea as ( select 0 as p, TABLESPACE_NAME,sum(TOTAL_PAGES) as total_pages
from table( SNAPSHOT_CONTAINER ('',0)) as tspace1
group by tablespace_id,tablespace_name order by tablespace_id
),
tspaceb as ( select 1 as p, TABLESPACE_NAME,sum(TOTAL_PAGES) as total_pages
from table( SNAPSHOT_CONTAINER ('',1)) as tspace1
group by tablespace_id,tablespace_name order by tablespace_id
) ,
tspacec as ( select 2 as p, TABLESPACE_NAME,sum(TOTAL_PAGES) as total_pages
from table( SNAPSHOT_CONTAINER ('',2)) as tspace1
group by tablespace_id,tablespace_name order by tablespace_id
) ,
tspaced as ( select 3 as p, TABLESPACE_NAME,sum(TOTAL_PAGES) as total_pages
from table( SNAPSHOT_CONTAINER ('',3)) as tspace1
group by tablespace_id,tablespace_name order by tablespace_id
),
totals as ( select p, TABLESPACE_NAME,total_pages from tspacea a
union
select p, TABLESPACE_NAME,total_pages from tspaceb b
union
select p, TABLESPACE_NAME,total_pages from tspacec c
union
select p, TABLESPACE_NAME,total_pages from tspaced d
),
alltotals as ( select tablespace_name,sum(total_pages) as totpages from totals
group by TABLESPACE_NAME
order by tablespace_name
)
select tbspace,pagesize,ngname, totpages
from syscat.tablespaces,alltotals
where tbspace = tablespace_name;
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Svenson's Bulletin Board Forum Index -> DB2 All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group