Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database size check 1

Status
Not open for further replies.

Mag0007

MIS
Feb 15, 2005
829
US
How can I check how the size of a database?

I am new to DB2 so please give me a lot of details.

 
db2 list tablespaces show detail

Multiply the number of free pages from each tablespace by the page size of the tablespace. Add all the tablespaces.

For ex:
Tablespace ID = 2
Name = USERSPACE1
Detailed explanation:
Normal
Total pages = 25600
Useable pages = 25584
Used pages = 544
Free pages = 25040
Page size (bytes) = 4096

544*4096
Do the same for all the tablespaces and then add them all up.
 
Ha! what if I have over 1600 tablespaces?

Also, 1 tablespace = 1 table from DB schema right? or something very different?
 
Do I also need to connect to the database? How do I do that?

CONNECT <dbname> ?

 
db2 connect to <db_name> user <uid> using <pwd>
db2 list tablespaces show detail
db2 terminate
Since you have a lot of tablespaces, you probably need to write a script to calculate the size.

1 tablespace is NOT equal to 1 table.
Schema can span multiple tablespaces. Tables reside in a tablespace.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top