1

What is the command to get the name of tablespace of a given table in DB2 database ?

1 Answer 1

4

On Db2 for LUW you can use this query. You get one row per table data partition (1 row for a non range partitioned table).

SELECT 
    SD.TBSPACE AS DATA_SPACE
,   SL.TBSPACE AS LONG_SPACE
,   SI.TBSPACE AS INDEX_SPACE
FROM 
          SYSCAT.DATAPARTITIONS P
JOIN      SYSCAT.TABLESPACES   SD ON SD.TBSPACEID = P.TBSPACEID
LEFT JOIN SYSCAT.TABLESPACES   SL ON SL.TBSPACEID = P.LONG_TBSPACEID
LEFT JOIN SYSCAT.TABLESPACES   SI ON SI.TBSPACEID = P.INDEX_TBSPACEID
WHERE
    TABSCHEMA = 'YOUR_SCHEMA' 
AND TABNAME   = 'YOUR_TABLE'
1
  • thanks for reply, let me try this command .
    – user236778
    Apr 21, 2020 at 4:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.