How to fix DB2 Tablespace OFFLINE state issue?

Sometimes we face an error where one (or more) of our db2 tablespaces goes offline caused by loads, DB crashes, abnormal db2 services/or server shutdown, etc. So in this blogpost let us see how can we check which tablespace is in OFFLINE state and bring back tablespace’s state to ONLINE.

 Finding TableSpace State

To check which tablespace is OFFLINE, execute the below command:

SYNTAX:

db2 connect to <database_name>

db2 list tablespaces |egrep -i "ID|Name|State"

db2 list tablespaces show detail

 

If u see Tablespace state with 0x4000, then that tablespace is in Offline state

There are 2 methods to resolve the tablespace from offline to online as below.

Method1:

We can execute below DB2 commands to take off tablespace's OFFLINE state.

 db2 terminate

db2 force application all

db2 connect to <database_name>

 

Method 2: 

Perform ALTER Tablespace command to bring the tablespace up while the rest of the database is still up and deployed.

db2 connect to <database_name> db2 "ALTER TABLESPACE <TablespaceName> SWITCH ONLINE"


Comments

Popular posts from this blog

Db2 export command example using file format (del , ixf)

Phases of a load operation