If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Size of DB2 Schema

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-21-10, 09:05
DB_N00b DB_N00b is offline
Registered User
 
Join Date: Jan 2010
Posts: 152
Size of DB2 Schema

Does anyone know how i can find out the size of my db2 schema?
thanks in advance

DB_N00b
Reply With Quote
  #2 (permalink)  
Old 09-21-10, 09:23
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
You can check the tablespace size if you store schemas in different tablespaces
Reply With Quote
  #3 (permalink)  
Old 09-21-10, 09:26
DB_N00b DB_N00b is offline
Registered User
 
Join Date: Jan 2010
Posts: 152
Thats actually not what i going to do.

I want to see the size of an excisting db schema :-)
Reply With Quote
  #4 (permalink)  
Old 09-21-10, 09:31
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
You can use get_dbsize_info if you have one schema or you can query the catalog
Reply With Quote
  #5 (permalink)  
Old 09-21-10, 09:32
DB_N00b DB_N00b is offline
Registered User
 
Join Date: Jan 2010
Posts: 152
whats the command?
Reply With Quote
  #6 (permalink)  
Old 09-21-10, 09:39
DB_N00b DB_N00b is offline
Registered User
 
Join Date: Jan 2010
Posts: 152
I have a link on the IBM Info Center, but its not working properly.

Quote:
Example 1: Get the database size and capacity using a default refresh window of 30 minutes. The database size and capacity will be recalculated when the cached data is older than 30 minutes.

CALL GET_DBSIZE_INFO(?, ?, ?, -1)
Reply With Quote
  #7 (permalink)  
Old 09-21-10, 09:41
DB_N00b DB_N00b is offline
Registered User
 
Join Date: Jan 2010
Posts: 152
I have no idea what this means ...

can anyone help?
Reply With Quote
  #8 (permalink)  
Old 09-21-10, 10:08
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
I posted something earlier that you might use:

Script Library

Your runstats need to be current.

Andy
Reply With Quote
  #9 (permalink)  
Old 09-22-10, 05:30
DB_N00b DB_N00b is offline
Registered User
 
Join Date: Jan 2010
Posts: 152
Sorry, but your scripts dont help me much.
Reply With Quote
  #10 (permalink)  
Old 09-22-10, 08:48
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Why did they not help you?

Andy
Reply With Quote
  #11 (permalink)  
Old 04-27-11, 09:31
DB_N00b DB_N00b is offline
Registered User
 
Join Date: Jan 2010
Posts: 152
I dont know which one to use. All i want is to get the size of one schema i have in my database
Reply With Quote
  #12 (permalink)  
Old 04-27-11, 10:58
MarkhamDBA MarkhamDBA is offline
Registered User
 
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
Quote:
Originally Posted by DB_N00b View Post
I dont know which one to use. All i want is to get the size of one schema i have in my database
i don't think 'schema size' makes sense - schema is not a physical object. what makes sense is the size of all objects under certain schema. then you probably need to write a query to find all objects (tables, indexes) and calculate and sum their sizes to get total size.
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS
Reply With Quote
  #13 (permalink)  
Old 04-27-11, 17:59
DebianDog DebianDog is offline
Registered User
 
Join Date: Apr 2011
Posts: 17
simple

Code:
db2 "select sum(NPAGES)*4096 from syscat.tables where TABSCHEMA = 'MYSCHEMA'" and type = 'T'
Will get you close...if you have 4k pages that is

a DBA should make this table his or her best friend

Code:
db2 describe table syscat.tables
Reply With Quote
  #14 (permalink)  
Old 04-28-11, 06:08
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by DebianDog View Post
Code:
db2 "select sum(NPAGES)*4096 from syscat.tables
Does not account for the size of indexes; are they part of a schema?
Reply With Quote
  #15 (permalink)  
Old 04-28-11, 08:25
DebianDog DebianDog is offline
Registered User
 
Join Date: Apr 2011
Posts: 17
Quote:
Originally Posted by n_i View Post
Does not account for the size of indexes; are they part of a schema?
Oh right DUH like it would be that easy. Yes you would have to multiply NLEAF times page size then add the two together. What I get for hurrying.

You may be able to modify this query to suit your needs as it will find the index size for 1 table.

Code:
SELECT DEC(( FLOAT(( Sum(CAST(nleaf AS BIGINT)) * x.pagesize )) /
                    FLOAT(( 1024 * 1024 )) ), 8, 3) "Index_size_in_MBs"
FROM   syscat.indexes i,
       (SELECT s.tabschema,
               s.tabname,
               st.pagesize
        FROM   syscat.tables s,
               sysibm.systablespaces st
        WHERE  s.index_tbspace = st.tbspace) AS x
WHERE  x.tabname = i.tabname
       AND i.tabname = 'YOUR_TABLE_NAME'
GROUP  BY x.pagesize
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On