DBMS_OPTIM_BUNDLE and the standby database?

I could have sworn that I had blogged about it. Aleksey had a comment on the blog and I could not find the answer. But I knew that I had discussed this topic with several people in email already. Maybe it has fallen off my long list of future blog posts. No worries, here it is: DBMS_OPTIM_BUNDLE and the standby database?

DBMS_OPTIM_BUNDLE and the standby database?

Photo by 张 嘴 on Unsplash

DBMS_OPTIM_BUNDLE – short recap

I have a longer list of DBMS_OPTIM_BUNDLE blog posts, and you can easily navigate to them here. In very short, you will use the package to enable potentially behavior changing optimizer fixes which are disabled by default in Release Updates to prevent any accidental change.

 

DBMS_OPTIM_BUNDLE and standby databases

Well, this was Aleksey’s question:

How to enable optim_fixes in standby database?

And to be frank, this is a very legit question. At first, using DBMS_OPTIM_BUNDLE on the primary doesn’t propagate to any of your standby databases, regardless whether it is a physical or a logical standby. This means, neither the parameter change nor the execution of the DBMS_OPTIM_BUNDLE package call gets into your standby.

Then the question is: How do I tell my standby database(s) about the changes on the primary? If you don’t do this, you may end up with a totally different behavior of your database in case you have set DBMS_OPTIM_BUNDLE‘s _fix_control settings on the primary after a switchover or a failover?

This could become really dangerous for an application which is used to benefit from all those fixes, and apparently they are gone. And even better, when you setup Application Continuity, and your application users luckily didn’t even recognize this switch – but you have different settings now? With 19.27.0, this would apply to far over 200 fixes.

Luckily, MOS Note: 2147007.1 – Managing “installed but disabled” bug fixes in Database Release Updates using DBMS_OPTIM_BUNDLE has an answer to this question.

 

How do you solve this?

You need to end managed recovery mode on your standby, then OPEN it, use an ALTER SYSTEM command to set all the _FIX_CONTROL settings you have on the primary, then bring the standby back into MOUNT state and enable managed recovery mode again.

The MOS note says:

STANDBY DATABASE CONSISTENCY

Any “installed but disabled” execution plan bug fixes that are enabled using the “DBMS_OPTIM_BUNDLE” package will *not* be propagated by ‘redo’ to downstream databases. If you have any standby databases, then you will need to repeat the same command(s) to enable or disable fixes on all standby databases as well.

This can be done only when the standby database is in read only mode . Once it is in read-only mode , use the same steps as mentioned earlier to enable or disable the fixes .

Please remember that you need to do this every time you add new settings with DBMS_OPTIM_BUNDLE – on every standby.

 

Quick annotation based on your feedbacks

Well, I never said I’m the smartest here. For sure I am not. But I’m really happy that you shared your improvements to my process with me. The approach I like the most is the one Daniele shared below:

  1. Convert your physical standby into a snapshot standby
    1. Redo shipping will continue
    2. A GRP will be set automatically
  2. Then adjust the parameter since the standby is now open read/write
  3. Then convert it back to a physical standby
    1. It will automatically flashback to the GRP
    2. It will then consume and apply all the shipped redo to synch again
    3. The changes from the SPFILE will remain since the SPFILE is not affected by the flashback operation

Pretty smart – like it!

Thanks, Daniele!!

 

Further Links and Information

–Mike