There's a few known bugs in this area
Known issue of ORA-01555 in Active Dataguard (ADG) (Doc ID 1951318.1)
ORA-1555 from query on RAC ADG Physical Standby Database (Doc ID 19614585.8)
Known issues of Wrong Results in Active Data Guard(ADG) (Doc ID 2490469.1)
so I think this is going to be one you'll need to take up with Support.
Some ideas for a workaround (which I know is not ideal)
1) Try materialize the data in the query
Current query:
select [query1]
union all
select [query2]
Rewrite as
with local_data as ( select /*+ materialize */ [query1] )
select ... from local_data
union all
select [query2]
2) If that doesn't work, could you wrap this logic in a pipeline function, eg
SQL> select empno, ename from scott.emp
2 union all
3 select deptno, dname from scott.dept;
EMPNO ENAME
---------- --------------
7369 SMITH
7499 ALLEN
7521 WARD
7566 JONES
7654 MARTIN
7698 BLAKE
7782 CLARK
7788 SCOTT
7839 KING
7844 TURNER
7876 ADAMS
7900 JAMES
7902 FORD
7934 MILLER
10 ACCOUNTING
20 RESEARCH
30 SALES
40 OPERATIONS
18 rows selected.
SQL>
SQL>
SQL> create global temporary table local_copy
2 ( empno number, ename varchar2(30))
3 on commit preserve rows
4 /
Table created.
SQL>
SQL> create or replace
2 type each_row as object ( empno number, ename varchar2(30))
3 /
Type created.
SQL>
SQL> create or replace
2 type row_list as table of each_row
3 /
Type created.
SQL>
SQL> create or replace
2 procedure get_the_remote_data is
3 pragma autonomous_transaction;
4 begin
5 delete local_copy;
6 insert into local_copy
7 select empno, ename from scott.emp;
8 commit;
9 end;
10 /
Procedure created.
SQL>
SQL>
SQL> create or replace
2 function workaround_issue return row_list pipelined is
3
4 begin
5 get_the_remote_data;
6
7 for i in
8 ( select empno, ename from local_copy
9 union all
10 select deptno, dname from scott.dept
11 )
12 loop
13 pipe row ( each_row(i.empno, i.ename));
14 end loop;
15 return;
16 end;
17 /
Function created.
SQL>
SQL> select * from workaround_issue();
EMPNO ENAME
---------- ------------------------------
7369 SMITH
7499 ALLEN
7521 WARD
7566 JONES
7654 MARTIN
7698 BLAKE
7782 CLARK
7788 SCOTT
7839 KING
7844 TURNER
7876 ADAMS
7900 JAMES
7902 FORD
7934 MILLER
10 ACCOUNTING
20 RESEARCH
30 SALES
40 OPERATIONS
18 rows selected.