Is this a Microsoft or an Oracle Problem?

一个人想着一个人 提交于 2019-12-06 09:58:59

This looks like an Oracle problem. Although the error is a direct result of the ODBC timeout settings, that query should not take 20 minutes to finish running.

The first thing to try when running into a data dictionary performance issue is to gather statistics on the data dictionary. This provides Oracle with more information about the sizes of the objects, so it can make better decisions on how to join the tables.

begin
    dbms_stats.gather_fixed_objects_stats;
    dbms_stats.gather_dictionary_stats;
end;
/

If that doesn't work you'll want to shrink the query to the smallest size possible that still has the problem. There are three queries UNION ALL'd together, chances are only one of them is slow. Then we can work on optimizing that one query.

(But tuning a query is a process that requires a lot of back-and-forth, and is difficult to do over the Internet. You might want to try to find a local database administrator who can help. Since you're using Express Edition, you can't contact Oracle Support for help.)

If I were able to change the SQL call from Power BI, I find that the following query produces identical output. It runs in less than one second on the laptop where Oracle is installed along with Power BI. That contrasts with almost 30 minutes for the original query. Microsoft, you may want to take a look at how your products connect to the newer Oracle products via DSN:

SELECT
    *
FROM
    (
        SELECT
            NULL table_qualifier,
            o1.owner         table_owner,
            o1.object_name   table_name,
            o1.object_type table_type,
            NULL remarks
        FROM
            all_objects o1
        WHERE
            o1.object_type = 'TABLE' and
            o1.owner not in ('SYS','SYSTEM')
        UNION
        SELECT
            NULL table_qualifier,
            o1.owner         table_owner,
            o1.object_name   table_name,
            o1.object_type table_type,
            NULL remarks
        FROM
            all_objects o1
        WHERE
            o1.object_type = 'VIEW' and
            o1.owner not in ('SYS','SYSTEM')
    ) tables
ORDER BY
    4,
    2,
    3
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!