Switching read-only secondary to administration mode and then back to secondary mode - possible?
(too old to reply)
Steve Nixon
2017-09-19 19:17:21 UTC
I tried looking this up in the documentation but can't seem to get a straight answer on it. Hoped that maybe a guru has experienced it before.

I have an instance (Informix 12.10.FC9) running on an AIX server that is configured to be doing replication (HDR Secondary). I'm trying to perform a special "UNLOAD TO <filename>" of some of the tables in a database, but I need to be sure that the tables are not being updated/changed during the unload for data integrity.

The problem I have is that the database I'm extracting data from is a production server that operates 24/7. So getting users to log off for 30 minutes or such is not an option.

My thought was that I could somehow use the read-only secondary for this, provided that I somehow stop the changes from being applied on that server for the duration of the data extraction.

What I came up with to date is the following, that seems to work:

1) onmode -ky the secondary

2) On secondary, comment out the entries for primary instance in /etc/services and $INFORMIXDIR/etc/sqlhosts

3) On primary, comment out the entries for secondary instance (in the same files mentioned above)

4) oninit the secondary instance. It comes up as "Blocked on CKPT", but starts up in read-only mode.

5) Do my UNLOAD TO <filename> on the desired tables

6) Go back and repeat steps 1-4 and reverse the changes in the sqlhosts and services files.

But I'm wondering if there is a simpler way to make the secondary instance be read-only but NOT be receiving updates from the primary that may change the stored data for the duration of my queries.

I was looking at "onmode -j". Administration mode.
What I was hoping to get answered was these two questions:

First, if I put a read-only secondary into admin mode, will it continue to receive updated logs and apply changes received from primary?

Second, after placing the read-only secondary in admin mode using onmode -j, can it revert back to a secondary if I onmode -ky and oninit it afterwards? I know that if I issue onmode -d standard, it becomes standalone, and I would need a fresh ontape to re-establish HDR. But can you go from administration mode back to read-only secondary mode without having to prepare a new backup?

Thanks in advance for any advice.

Steve N.
Steve Nixon
2017-09-20 18:22:57 UTC
After posting, I think I found part of my answer. This URL states that in Admin mode, the HDR remains on. So I don't believe I can use this to temporarily isolate the secondary from logical log updates.

2017-09-21 09:39:42 UTC
You could temporarily demote the HDR secondary to an RSS and then take advantage of STOP_APPLY.

Do this on the HDR secondary
- create <absolute_path_to_log_dir>
ensuring '700 informix:informix' permissions
- onmode -wf LOG_STAGING_DIR=<absolute_path_to_log_dir>
- onmode -d RSS <primary_name>
- onmode -wm STOP_APPLY=1
(make sure no transaction is open on your target table)
- ... perform your unload ...
- onmode -wm STOP_APPLY=0
- onmode -d secondary <primary_name>
Steve Nixon
2017-09-21 19:22:50 UTC
Post by AndreasL
You could temporarily demote the HDR secondary to an RSS and then take advantage of STOP_APPLY.
Thanks Andreas.
I will investigate and see if that would work for our situation. Time to break out my test servers again... ;-)