Closed lvxiaorun closed 1 day ago
I tried to write a connection demo with ojdbc8, and captured the packet, I found that each time only one redirection will successfully establish the connection and execute the statement successfully. I find that there are some parameters in the redirection returned packet, among which I think the parameter INSTANCE_NAME is more critical. The jdk takes these parameters with it when initiating a second connection, but go-ora only changes the connection address without taking these parameters with it.
when use latest go-ora with oracle 19.7 rac,
It has two instance, we called them rac_ins1,rac_ins2
when we use service_name to create connection and run query,
`
`
It get a error "no available servers to connect to"
I check the go-ora source code,find the error appear in.
I run the code once more with trace log, in the log,I find that, when connect to rac_ins1, it get a redirect reply, the target is rac_ins2, then try to connect to rac_ins2,it get a redirect reply, the target is rac_ins1, finally,it return error.It seems that the two instance mutual redirect. The redirect packet as it (It's the same before every redirect)
Read packet: 00000000 00 0a 00 00 05 02 00 00 01 0e
By the way,if I edit the "AddServer" func as this,(make it redirect more times) `
`
It will redirect between rac_ins1 and rac_ins2 util more than 7 times redirect.Finally get the above error “no available servers to connect to”
I looked it up,This may be related to the following two parameters,“load_balance” and "faliover", but setting them is not currently supported in go-ora.
Looking forward to your reply to the above questions.Thanks.