I'm running the following queries over a private dblink (Oracle Database 19c):
delete from myschema.mytable@mydblink where SERVER = (select host_name from gv$instance);
insert into myschema.mytable@mydblink
select * from
(
select * from
(
SELECT
(select instance_name from gv$instance) as DB,
(select host_name from gv$instance) as SERVER,
to_char(SESSION_KEY) as SESSIONKEY,
INPUT_TYPE as INPUTTYPE,
STATUS,
TO_CHAR(START_TIME,'DD-MON-YY HH24:MI:SS') as STARTTIME,
TO_CHAR(END_TIME,'DD-MON-YY HH24:MI:SS') as ENDTIME,
-- time_taken_display as TIMETAKEN,
-- output_bytes_display as OUTPUTBYTES,
-- output_bytes_per_sec_display as OUTPUTBPS,
1 as ORDERDUMMY
FROM V$RMAN_BACKUP_JOB_DETAILS where end_time > sysdate - 3
union
select
(select instance_name from gv$instance) as DB,
(select host_name from gv$instance) as SERVER,
'has' as SESSIONKEY,
'no' as INPUTTYPE,
'recent' as STATUS,
'results' as STARTTIME,
null as ENDTIME,
-- null as TIMETAKEN,
-- null as OUTPUTBYTES,
-- null as OUTPUTBPS,
2 as ORDERDUMMY
from dual
)
order by orderdummy fetch first 1 row with ties
);
commit;
They work just fine to delete, insert, and commit the data like I want it to. The problem arises when I uncomment any one of the three column pairs. For example, if I uncomment the two TIMETAKEN lines (target table adjusted to match column needs), the query errors with:
Error report - SQL Error: ORA-02069: global_names parameter must be set to TRUE for this operation 02069. 00000 - "global_names parameter must be set to TRUE for this operation" *Cause: A remote mapping of the statement is required but cannot be achieved because global_names should be set to TRUE for it to be achieved *Action: Issue alter session set global_names = true if possible
Setting global_names = true does not help because the dblink name doesn't match the db name. I'd like to understand why the query works fine until I try to add any one of these three columns to the query...
*time_taken_display
*output_bytes_display
*output_bytes_per_sec_display
For what it's worth, I tried removing the end_time column and leaving time_taken_display in, and it errored out the same way, indicating time_taken_display being the culprit.
As usual, the Oracle documentation I found on global_names wasn't much help. Thanks in advance.