If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > DB2 HADR takeover problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-04-11, 09:55
Daniil.Monin Daniil.Monin is offline
Registered User
 
Join Date: Oct 2010
Posts: 19
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 10:01.
Reply With Quote
  #2 (permalink)  
Old 02-04-11, 10:18
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
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.
Reply With Quote
  #3 (permalink)  
Old 02-04-11, 10:34
Daniil.Monin Daniil.Monin is offline
Registered User
 
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:

Quote:
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 10:40.
Reply With Quote
  #4 (permalink)  
Old 02-04-11, 10:40
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
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?
Reply With Quote
  #5 (permalink)  
Old 02-04-11, 10:46
Daniil.Monin Daniil.Monin is offline
Registered User
 
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
Quote:
ConnectStatus ConnectTime Timeout
Connected Fri Feb 4 23:19:01 2011 (1296839941) 3
?

Last edited by Daniil.Monin; 02-04-11 at 10:50.
Reply With Quote
  #6 (permalink)  
Old 02-04-11, 11:15
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
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
Reply With Quote
  #7 (permalink)  
Old 02-04-11, 11:20
Daniil.Monin Daniil.Monin is offline
Registered User
 
Join Date: Oct 2010
Posts: 19
Thank you, but "reads on standby" not enabled.
Reply With Quote
  #8 (permalink)  
Old 02-04-11, 11:49
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
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).
Reply With Quote
  #9 (permalink)  
Old 02-04-11, 11:57
Daniil.Monin Daniil.Monin is offline
Registered User
 
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.

Quote:
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.
Reply With Quote
  #10 (permalink)  
Old 02-04-11, 12:04
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
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.
Reply With Quote
  #11 (permalink)  
Old 02-04-11, 12:16
Daniil.Monin Daniil.Monin is offline
Registered User
 
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 12:21.
Reply With Quote
  #13 (permalink)  
Old 02-04-11, 12:29
Daniil.Monin Daniil.Monin is offline
Registered User
 
Join Date: Oct 2010
Posts: 19
n_i,
I will read those articles, thank you again!
Reply With Quote
Reply

Tags
hadr, hadr takeover fail, takeover

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On