In my original thread here: How can I fix ORA: 01013 (user requested cancel...) when trying to link Oracle tables in MS Access? I describe an issue attempting to link Oracle tables into a Microsoft Access (office 365) database. The process timed out after entry of a UID and password.
As I researched the problem, I was able to determine that the ODBC drivers and DSN work for ADO, Toad, and Microsoft Power BI (when using a specific query against an Oracle table). I was never able to log entries in the Oracle V$SQL table from either Access or Excel to further troubleshoot the problem.
However, tonight, I was able to get Power BI to recreate the same behavior by attempting to connect through the DSN and browse the tables in Oracle. Oracle captured the SQL call and the result is this gem:
SELECT
*
FROM
(
SELECT
NULL table_qualifier,
o1.owner table_owner,
o1.object_name table_name,
DECODE(o1.owner, 'SYS', DECODE(o1.object_type, 'TABLE', 'SYSTEM TABLE', 'VIEW', 'SYSTEM VIEW', o1.object_type), 'SYSTEM'
, DECODE(o1.object_type, 'TABLE', 'SYSTEM TABLE', 'VIEW', 'SYSTEM VIEW', o1.object_type), o1.object_type) table_type,
NULL remarks
FROM
all_objects o1
WHERE
o1.object_type IN ('TABLE',
'VIEW'
)
UNION
SELECT
NULL table_qualifier,
s.owner table_owner,
s.synonym_name table_name,
'SYNONYM' table_type, null remarks
FROM
all_objects o3,
all_synonyms s
WHERE
o3.object_type IN (
'TABLE',
'VIEW'
)
AND s.table_owner = o3.owner
AND s.table_name = o3.object_name
UNION
SELECT
NULL table_qualifier,
s1.owner table_owner,
s1.synonym_name table_name,
'SYNONYM' table_type,
NULL remarks
FROM
all_synonyms s1
WHERE
s1.db_link IS NOT NULL
) tables
WHERE
1 = 1
AND ( table_type = 'TABLE'
OR table_type = 'VIEW' )
ORDER BY
4,
2,
3
I don't know where to start with this query. The second and third subqueries in the union statement are filtered out by the final where clause, so they are useless. The first subquery is attempting to retrieve a list of tables/schemas from all_objects. If I restrict that chunk of SQL to the first 100,000 rows and run it in SQLPLUS, the runtime is over 20 minutes in Oracle 18c (XE). I presume that is because that object is constantly updating, even as the query is running.
The details of the MS ODBC specification to which Oracle certifies are way over my head, so I don't know whether to continue pursuing tickets with Microsoft, or whether to turn my attention to Oracle as the culprit for the problem.
Any and all advice appreciated. I really need to know which party is responsible for the SQL above.
Thanks!