Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 7: DB2 Tables and Tablespaces


Tablespace States

A tablespace state tells you whether the space is usable or blocked by a pending utility or a failed operation.

What tablespace states are

  • DB2 tracks the status of every tablespace and partition. The status is shown by the -DISPLAY DATABASE command:-
  • -DISPLAY DATABASE(MM01DB) SPACENAM(*)

    -START DATABASE(MM01DB) SPACENAM(EMPTS)
  • A normal tablespace shows status RW, which means read-write and fully usable.
  • Restrictive states block some or all access until the pending condition is resolved.
  • Advisory states warn you that something should be done, but access is still allowed.

Common restrictive states

  • COPY pending - the tablespace was loaded or reorganized and needs an image copy before it can be recovered. Run the COPY utility to clear it.
  • CHECK pending - rows may break a referential or check constraint, usually after a LOAD. Run CHECK DATA to clear it.
  • REBUILD pending - an index on the table needs rebuilding. Run REBUILD INDEX to clear it.
  • REORG pending - the table definition changed and needs reorganization. Run REORG TABLESPACE to clear it.
  • STOPPED - the tablespace was stopped by an operator or by DB2 after an error. Start it with the -START DATABASE command.

Checking and clearing states

  • Step 1 - run -DISPLAY DATABASE(dbname) SPACENAM(*) to see the status of every tablespace in the database.
  • Step 2 - note the status code, for example COPY, CHKP or REORP, on the tablespace or partition.
  • Step 3 - run the matching utility: COPY for COPY pending, CHECK DATA for CHECK pending, REORG for REORG pending, REBUILD INDEX for REBUILD pending.
  • Step 4 - if the tablespace is stopped, start it with -START DATABASE(dbname) SPACENAM(tsname).
  • Step 5 - display again to confirm the status is back to RW before letting applications in.





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant