Trying to execute some queries in a HADR database with RoS (Read only Standby) with a union operator or with a subselect, I got the error SQL1773N reason code 5.
What is the reason? they are operations that do not generate writes.
Union
with hist(start_time, operationtype) as (
select start_time, operationtype
from sysibmadm.db_history
where operation = 'B' )
select 'delta', timestampdiff(8, current timestamp - char(timestamp(max(start_time))))
from hist
where operationtype = 'D' or operationtype = 'E'
union all
select 'delta', timestampdiff(8, current timestamp - char(timestamp(max(start_time))))
from hist
where operationtype = 'I' or operationtype = 'O'
Subselect
with hist(start_time, operationtype) as (
select start_time, operationtype
from sysibmadm.db_history
where operation = 'B' )
select 'delta', operationtype, start_time, timestampdiff(8, current timestamp - char(timestamp(start_time)))
from hist
where start_time = (
select max(start_time)
from hist
where operationtype = 'D' or operationtype = 'E')