How do I find the size of a DB2 (luw) database?

12,235

Solution 1

When connected to a database as db2admin (or with similar permissions), use the following command:

 call get_dbsize_info(?,?,?,-1);

The first three parameters are output parameters:

Value of output parameters
--------------------------
Parameter Name  : SNAPSHOTTIMESTAMP
Parameter Value : 2014-06-17-13.59.55.049000

Parameter Name  : DATABASESIZE
Parameter Value : 334801764352

Parameter Name  : DATABASECAPACITY
Parameter Value : 1115940028416

Return Status = 0

The size is given in bytes, so divide by 1024^3 to get Gb.

The final parameter is how often the snapshot is refreshed. -1 is to use default settings.

Further reading...

Note: This command does not take into account logs, etc. - so, it may appear much larger on disk.

Solution 2

Use db2top

l(for session)

p(when press small p it will show the total size of db n used size of db)

Share:
12,235
ESP
Author by

ESP

IBM Maximo technical consultant

Updated on July 16, 2022

Comments

  • ESP
    ESP almost 2 years

    I know you can look at the size of an uncompressed backup, but that's not practical.

    Is there a command to find the size of the database while it is online? (In Linux/Unix/windows)

  • ESP
    ESP over 9 years
    How exactly have you created the I and P keys in your post? Pretty cool! Is db2top only for UNIX?
  • Burgi
    Burgi about 7 years
    @ESP you use the HTML tag <kbd></kbd>