Results 1 to 13 of 13
  1. #1
    Join Date
    Oct 2010
    Posts
    19

    Unanswered: DB2 HADR takeover problem

    Hello!
    I have problem with takeover HADR on my servers.

    Quote Originally Posted by Primary Server, database name DB97HADR
    DB21085I Instance "db2inst1" uses "64" bits and DB2 code release "SQL09071" with level identifier "08020107". Informational tokens are "DB2 v9.7.0.1", "s091114", "IP23031", and Fix Pack "1".
    Quote Originally Posted by Standby Server, database name DB97HADR
    DB21085I Instance "db2inst1" uses "64" bits and DB2 code release "SQL09071" with level identifier "08020107". Informational tokens are "DB2 v9.7.0.1", "s091114", "IP23031", and Fix Pack "1".
    Quote Originally Posted by Client, Windows 7 x64 Enterprise
    DB21085I Instance "DB2" uses "32" bits and DB2 code release "SQL09072" with level identifier "08030107". Informational tokens are "DB2 v9.7.200.358", "s100514", "IP23083", and Fix Pack "2".
    Both servers running on Solaris x64 (not SPARC). At the client (Windows 7 x64) databases cataloged primary as "DB97PRM" and standby as "DB97STB". I try to connect to the primary database - everything ok, but to standby i can't to connect.

    After i try to make take over, via syntax
    Code:
    db2 takeover hadr on db DB97STB user db2inst1 using db2inst1
    So, my primary database now is "DB97STB" and stanby is "DB97PRM".

    After this, i can connect to standby database and to primary database.

    1) Is this normal? I believe not.
    2) And now i can't make takeover again to change "DB97STB" to standby and "DB97PRM" to primary

    Code:
    db2 takeover hadr on db DB97PRM user db2inst1 using db2inst1
    ====
    SQL1770N  Takeover HADR cannot complete. Reason code = "4".
    This error means "The command was issued against a standard or HADR primary database."

    Help me please to understand, why i can't change my primary database back after takeover command?

    Thanks in advance.
    Last edited by Daniil.Monin; 02-04-11 at 11:01.

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    You cannot connect to a standby database. The fact that you can connect to both primary and expected standby database after the takeover means that the former primary did not convert to standby. Verify both databases' states after the takeover by looking at the database snapshot or db2pd -hadr output.

  3. #3
    Join Date
    Oct 2010
    Posts
    19
    Yeah, i know. But i can. See my output of db2pd.

    Quote Originally Posted by DB97STB
    bash-3.00$ db2pd -db DB97HADR -hadr

    Database Partition 0 -- Database DB97HADR -- Active -- Up 0 days 01:01:54

    HADR Information:
    Role State SyncMode HeartBeatsMissed LogGapRunAvg (bytes)
    Primary Peer Sync 0 0
    Quote Originally Posted by DB97PRM
    bash-3.00$ db2pd -db DB97HADR -hadr

    Database Partition 0 -- Database DB97HADR -- Standby -- Up 0 days 01:01:22

    HADR Information:
    Role State SyncMode HeartBeatsMissed LogGapRunAvg (bytes)
    Standby Peer Sync 0 0
    Now i try to connect from client:

    C:\Windows\system32>db2 connect to DB97PRM user db2inst1 using xxx

    Database Connection Information

    Database server = DB2/SUNX8664 9.7.1
    SQL authorization ID = DB2INST1
    Local database alias = DB97PRM


    C:\Windows\system32>db2 connect to DB97STB user db2inst1 using xxx

    Database Connection Information

    Database server = DB2/SUNX8664 9.7.1
    SQL authorization ID = DB2INST1
    Local database alias = DB97STB


    C:\Windows\system32>db2 takeover hadr on db DB97PRM user db2inst1 using xxx BY force
    SQL1770N Takeover HADR cannot complete. Reason code = "4".
    Last edited by Daniil.Monin; 02-04-11 at 11:40.

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    If you have set up automatic client reroute you may be connecting to the new primary while thinking that it's the old primary.

    Also, do you have read on standby enabled?

  5. #5
    Join Date
    Oct 2010
    Posts
    19
    Quote Originally Posted by n_i View Post
    If you have set up automatic client reroute you may be connecting to the new primary while thinking that it's the old primary.
    Ok, now i see my connection on new primary database via "db2 list application". It's really reroute me to the new primary database.

    Quote Originally Posted by n_i View Post
    Also, do you have read on standby enabled?
    Sorry, you mean
    ConnectStatus ConnectTime Timeout
    Connected Fri Feb 4 23:19:01 2011 (1296839941) 3
    ?
    Last edited by Daniil.Monin; 02-04-11 at 11:50.

  6. #6
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by Daniil.Monin View Post

    Sorry, you mean
    ?
    HADR reads on standby feature - IBM DB2 9.7 for Linux, UNIX, and Windows

  7. #7
    Join Date
    Oct 2010
    Posts
    19
    Thank you, but "reads on standby" not enabled.

  8. #8
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Well, since you know that your connections to DB97PRM are redirected to DB97STB, I guess your command "db2 takeover hadr on db DB97PRM" ends up running on the current primary. You can verify that by looking at db2diag.log.

    If that's the case you will need to run the takeover command on the correct server, not on the client (unless you disable ACR).

  9. #9
    Join Date
    Oct 2010
    Posts
    19
    Yes, you are right. My takeover command try to run on the current primary database instead standby.

    It's very-very bad for me...

    See below.

    2011-02-05-00.32.53.401719+360 E737469E472 LEVEL: Event
    PID : 1662 TID : 378 PROC : db2sysc 0
    INSTANCE: db2inst1 NODE : 000 DB : DB97HADR
    APPHDL : 0-9265 APPID: xxxx.61019.110204153634
    AUTHID : DB2INST1
    EDUID : 378 EDUNAME: db2agent (DB97HADR) 0
    FUNCTION: DB2 UDB, base sys utilities, sqeDBMgr:tartUsingLocalDatabase, probe:13
    START : Received TAKEOVER HADR command.

    2011-02-05-00.32.53.401984+360 I737942E607 LEVEL: Warning
    PID : 1662 TID : 378 PROC : db2sysc 0
    INSTANCE: db2inst1 NODE : 000 DB : DB97HADR
    APPHDL : 0-9265 APPID: xxxx.61019.110204153634
    AUTHID : DB2INST1
    EDUID : 378 EDUNAME: db2agent (DB97HADR) 0
    FUNCTION: DB2 UDB, High Availability Disaster Recovery, hdrTakeoverCheckDb, probe:64700
    MESSAGE : Cannot takeover HADR on a standard database or primary database
    DATA #1 : Hexdump, 4 bytes
    0x0000000200FE58D4 : 16F9 FFFF ....
    Thank you, n_i.

  10. #10
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    What is it that you are trying to do? If you want to create a homebrew cluster monitor, consider issuing remote commands on the servers (not on the client) via ssh with PK authentication - the way it's typically done.

  11. #11
    Join Date
    Oct 2010
    Posts
    19
    Well, i need cover "takeover" via c++ code on windows machine:

    Code:
    SQL_API_RC SQL_API_FN
    db2gHADRTakeover (
    db2Uint32 versionNumber,
    void * pParmStruct,
    struct sqlca * pSqlca);
    The first "takeover" is ok, but second fail with error.

    Yes, i know, i can make a wrapper for ssh and send commands on server via ssh, but it is, i think, not good and more expensive for me.
    Last edited by Daniil.Monin; 02-04-11 at 13:21.

  12. #12
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1

  13. #13
    Join Date
    Oct 2010
    Posts
    19
    n_i,
    I will read those articles, thank you again!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •