Wednesday, February 4, 2015

Start and stop HADR DB2 database

Here are the steps to STOP HADR DB2 database:
-------------------------------------------------

1. Deactivate HADR on standby database:

db2 deactivate db DB2DB01
DB20000I  The DEACTIVATE DATABASE command completed successfully.

2. Stop HADR on standby database:

db2 STOP HADR ON DB DB2DB01
DB20000I  The STOP HADR ON DATABASE command completed successfully.


Similar scripts you would need to run on primary database as well:

1. Deactivate HADR on Primary  database:
db2 deactivate db DB2DB01
DB20000I  The DEACTIVATE DATABASE command completed successfully

2. Stop HADR on Primary database:
db2 stop hadr on database DB2DB01 as primary
DB20000I  The STOP HADR ON DATABASE command completed successfully.

Here are the steps to START HADR DB2 database:
-------------------------------------------------

1. Activate HADR on standby database:

 db2 activate db DB2DB01
 DB20000I  The ACTIVATE DATABASE command completed successfully.    
      
2. Start HADR on standby database:
      
 db2 START HADR ON DB DB2DB01 AS STANDBY
 DB20000I  The START HADR ON DATABASE command completed successfully.

Samilar scripts you would need to run on primary database as well:

1. Activate HADR on Primary database:

db2 activate db DB2DB01
DB20000I  The ACTIVATE DATABASE command completed successfully.

2. Start HADR on Primary database:

db2 start hadr on database DB2DB01 as primary
DB20000I  The START HADR ON DATABASE command completed successfully.

6 comments:

  1. wrong steps ...
    all reverse ..

    ReplyDelete
  2. while stopping we need to stop primary first and stop secondary while starting first standby and primary..

    regards,
    Babukiran

    ReplyDelete
  3. can anyone provide order of stop and start including deactivation of database ?

    ReplyDelete
    Replies
    1. 1) Deactivate the primary database
      2) Stop DB2 on the primary database
      3) Deactivate the standby database
      4) Stop DB2 on the standby database

      Delete
    2. No!!!

      1) Stop HADR on primary (so it stop shipping his logs to the standby)
      2) Deactivate Standby
      3) Stop HADR on standby

      Delete
    3. Can some one brief me on the exacts steps for shutting down and starting up both the HADR nodes at the same time.

      Im planninng for an DC movement activity where i need to shutdown and move out both my Primary and Secondary servers at the same time and have to Bring them up at a diffrent site

      Im Thinking the follwing , please advise if the approach is correct :

      ON PRIMARY (First)

      db2 deactivate db
      db2 stop hadr on db
      db2 terminate
      db2stop
      shutdown

      ON STANDBY (Second)

      db2 deactivate db
      db2 stop hadr on db
      db2 terminate
      db2stop
      shutdown

      AFTER RELOCATION

      ON STANDBY (First)

      Bootup server
      db2start
      db2 start hadr on database as standby
      db2 activate db

      ON PRIMARY (Second)

      Bootup server
      db2start
      db2 start hadr on database as primary
      db2 activate db

      Delete