重庆思庄Oracle、Redhat认证学习论坛

标题: ORA-20000: Unable to gather statistics concurrently: Resource manager plan is... [打印本页]

作者: jiawang    时间: 2023-8-23 09:35
标题: ORA-20000: Unable to gather statistics concurrently: Resource manager plan is...
一、现象

    While attempting to gathering statistics on Oracle 12c, receive ORA-20000 error as follows:

SQL> begin dbms_stats.gather_schema_stats(  ownname=> 'CS',cascade=> DBMS_STATS.AUTO_CASCADE, estimate_percent=> DBMS_STATS.AUTO_SAMPLE_SIZE,
2  degree=> 8,no_invalidate=> DBMS_STATS.AUTO_INVALIDATE,  granularity=> 'AUTO',method_opt=> 'FOR ALL INDEXED COLUMNS SIZE AUTO',  options=> 'GATHER
');end;
3
4  /
begin dbms_stats.gather_schema_stats(  ownname=> 'CS',cascade=> DBMS_STATS.AUTO_CASCADE, estimate_percent=> DBMS_STATS.AUTO_SAMPLE_SIZE,
*

ERROR at line 1:
ORA-20000: Unable to gather statistics concurrently: Resource manager plan is
not active or is not managing CPU usage
ORA-06512: at "SYS.DBMS_STATS", line 35991
ORA-06512: at line 1

    Database was recently upgraded from 11.2 to 12c with concurrent setting to true in both versions

SQL> select dbms_stats.get_prefs ('CONCURRENT') from dual;

DBMS_STATS.GET_PREFS('CONCURRENT')
--------------------------------------------------------------------------------
TRUE

    Statistics Gathering worked fine on the earlier version

二、解决方法

To avoid the error, either Enable Resource Manager OR Disable concurrent statistics gathering by setting the CONCURRENT preference to OFF. You will need to restart the database to enable these changes.

以下方法二选一:

Enable Resource Manager:

SQL> alter system set resource_manager_plan = 'DEFAULT_PLAN' scope=spfile;

Disable concurrent statistics gathering by setting the CONCURRENT preference to OFF:

SQL> exec dbms_stats.set_global_prefs('CONCURRENT', 'FALSE');







欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2