Friday, 30 September 2011

How to do DB2 Administration when DB2 instance id is locked.


How to do DB2 administration when the instance id is locked or sudo is revoked.
  1. Login to the server with your personal id (id should be a member of db2admin group)
  2. Find the instance home directory using lsuser command or finger command.
  3. Switch to the instance home directory.
  4. Now go to sqllib directory and execute db2profile. This will setup the environment for particular instance.
  5. Now attach to the instance using the following command.
  6. Now we can perform almost all the administration tasks, with out instance id. (Only thing is our id should be part of db2admin group).
  7. Certain specific utility like db2pd, db2top may not work due to restrictions, but still we are good to go with other normal DBA activity.
In this way we can perform all the administration tasks, even instance id is locked or sudo is not working.

Thursday, 16 June 2011

Tablespace States

Table space states

The current status of a table space is reflected by its state. The table space states most commonly associated with recovery are:

  • Backup pending. A table space is put in this state after a point-in-time rollforward operation, or after a load operation with the no copy option. The table space must be backed up before it can be used. (If it is not backed up, the table space cannot be updated, but read-only operations are allowed.)
  • Restore pending. A table space is put in this state if a rollforward operation on that table space is cancelled, or if a rollforward operation on that table space encounters an unrecoverable error, in which case the table space must be restored and rolled forward again. A table space is also put in this state if, during a restore operation, the table space cannot be restored.
  • Rollforward-in-progress. A table space is put in this state when a rollforward operation on that table space is in progress. Once the rollforward operation completes successfully, the table space is no longer in rollforward-in-progress state. The table space can also be taken out of this state if the rollforward operation is cancelled.
  • Rollforward pending. A table space is put in this state after it is restored, or following an input/output (I/O) error. After it is restored, the table space can be rolled forward to the end of the logs or to a point in time. Following an I/O error, the table space must be rolled forward to the end of the logs.