cancel
Showing results for 
Search instead for 
Did you mean: 

manipulating sysremoteusers.confirm_received

Baron
Participant
0 Kudos
1,451

I have an installation of 2 DBs replicating using DBRemote.

I lost the productive Cons. DB, but I have a backup of before 2 days (so now Remote DB. is dated 10.12.2019 and Cons. DB is dated 08.12.2019).

Now I want to use this 2 days old Cons. DB, but it misses all the transactions of Remote DB since 2 days (between 08.12.2019 - 10.12.2019).

What can I do in order to enforce the remote DB to resend all the transactions up 08.12.2012 (knowing that the Remote DB. was replicating against the lost Cons. till 10.12.2019, and knowing that the transaction logs of Remote DB still has the transactions of more than 2 days ago)?

I tried to manipulate the SYSREMOTEUSERS: I changed log_send, log_sent, confirm_sent values on Remote DB and set it to the values of log_receieved, confirm_received on the backup Cons. DB (i.e. -2 days), and, additionally I changed the log_received, confirm_received values on Remote DB and set it to the values of log_send, log_sent, confirm_sent on the backup Cons.

When I read the table SYSREMOTEUSERS then I see all the values are correct as I want, and when I start DBREMOTE then I see that the remote DB is generating the wanted packets (between 8.12.2019 - 10.12.2019) (The amount of generated packets tell me that they contain 2 days transactions), but the problem is that DBREMOTE additionaly (and unintendently) changes the value of confirm_received (on Remote DB) to the value of 10.12.2019!

In other words, after starting DBREMOTE the value of confirm_received is set back to the last value!! and I dont know from where it could remember this offset (having that I have overritten SYSREMOTEUSERS)

As a result, the Cons. DB does not accept those generated packets, because the confirmation offset is bigger than its current offset (the error message says, packets dont belong me!!).

I know that manipulating SYSREMOTEUSERS is not documented, but how is considered to solve such situations? (Replicated against backed up cons.).

Accepted Solutions (0)

Answers (1)

Answers (1)

JimDiaz
Participant

You should duplicate this on a test database but I believe this can be fixed using SetRemoteUser. If you still have the original databases before any attempts made above, post the result of SELECT * FROM Sys.SysRemoteUser from all three databases and I'll give you a hand. Basically you need to set log_sent, confirm_sent, log_received, confirm_received, resend and rereceive on all three databases to make this work.

Since the consolidated is the old backup you will need to use it's xxx_sent numbers because these are tied to the database log files. You will need to use the consolidated log_received as well to force the remotes to resend from the last good receive. As for the confirmed_xxx this is why we need to look at the SysRemoteUser results.

Of course if any transactions were applied to the cons after the last backup these will be lost.

There are other issues you should be aware of, for example if the remotes xxx_received are > the cons xxx_sent this means you will eventually resend offsets that the remotes have already received. Depending on what these transactions were there may be failures while applying at the remotes (transactions already exist).

This is not a guaranteed process, that's why backups are so important but I expect you know that.

Merry Christmas

Jim

Baron
Participant
0 Kudos

Thanks for your help. Here I am posting the Sysremoteusers of one of the Remotes (as XML):

<sysremoteusers><log_send>2218767807</log_send><log_sent>2218767807</log_sent><confirm_sent>2218767807</confirm_sent><send_count>35351</send_count><resend_count>211</resend_count><log_received>19142614683</log_received><confirm_received>19142614683</confirm_received><receive_count>84094</receive_count><rereceive_count>1</rereceive_count></sysremoteusers>

What I want to do is to manipulate the offsets on this Remote (return it one day back).

I've manipulated SYSREMOTEUSERS on Remote so it looks like this:

<sysremoteusers><log_send>2218767807</log_send><log_sent>2215558422</log_sent><confirm_sent>2215558422</confirm_sent><send_count>34290</send_count><resend_count>211</resend_count><log_received>19122857111</log_received><confirm_received>19122857111</confirm_received><receive_count>84038</receive_count><rereceive_count>1</rereceive_count></sysremoteusers>

NOTE: Here there is no way to manipulate the log_send

Here I start DBREMOTE against this Remote and it works partially fine, because it sends the messages exactly in the range as I want (between between 02215558422 - 2218819601), but it additionally and unintentionly changes the value of confirm_received into 19142614683, so the reading looks like this:

<sysremoteusers><log_send>2218819601</log_send><log_sent>2218819601</log_sent><confirm_sent>2215558422</confirm_sent><send_count>34342</send_count><resend_count>211</resend_count><log_received>19122857111</log_received><confirm_received>19142614683</confirm_received><receive_count>84038</receive_count><rereceive_count>1</rereceive_count></sysremoteusers>.

Now of course those generated messages will be rejected by the (backed up) cons. (error looks like this):

Log offset sent to user 'Remote1' is '19122857111', but the message header indicates user 'DB111_user' has received log offset '019142614683'.

Knowing that the reading of Sysremoteusers on Cons. (backup, 1 day before) is like this:

<sysremoteusers><log_sent>19122857111</log_sent><confirm_sent>19122857111</confirm_sent><send_count>84038</send_count><resend_count>1</resend_count><log_received>2215558422</log_received><confirm_received>2215558422</confirm_received><receive_count>34290</receive_count><rereceive_count>211</rereceive_count></sysremoteusers>
Baron
Participant
0 Kudos

So my main problem is that the DBREMOTE changes the value of confirm_received from 19122857111 to 19142614683!!

How can I prevent this happening? And from where does remember this value?

JimDiaz
Participant
0 Kudos

Don't worry about log_send take a look at the SYS.sa_setremoteuser procedure this is how you should be manipulated SYSREMOTEUSERS it doesn't care about send. Remember the remotes sent is the cons received. Since the cons is old you need to use it's values on the remote for all procedure parameters SYS.sa_setremoteuser( p_user_id unsigned integer, Cons User Id p_log_sent numeric(20), 2215558422 p_confirm_sent numeric(20), 2215558422 p_send_count integer,34290 p_resend_count integer, 211 p_log_received numeric(20), 19122857111 p_confirm_received numeric(20),19122857111 p_receive_count integer,84038 p_rereceive_count integer 1 )

Baron
Participant
0 Kudos

Yes, log_send does not bother me, and my main problem is that I can't set the value of confirm_received on the remote.

So in my case I can not set the confirm_received on remote to the old value of 19122857111!

Indeed the procedure SYS.sa_setremoteuser can set this wanted value, but as soon as I start DBREMOTE against this remote, then the Remote distinguishes somehow that the value 19122857111 is a manipulated value and sets it back to 19142614683, and this is the myterious part for me.

Actually I could overcome this situation with a some 'ugly' workaround, so that I did not change the confirm_received on the remote, but I have manipulated the log_sent & confirm_sent on the Cons. to a bigger value (19142614683).

Here of course the problem was that the current offset of the Cons. was smaller than 19142614683, so that I had to manipulate it too using (DBLOG -x -z).

This solution was ugly, because I created a gap in the transaction log files of the cons. (there are no transactions between 19122857111 and 19142614683), but at least the DBRMOTE does not complain anymore.