zoukankan      html  css  js  c++  java
  • 存储过程收集统计信息ORA-20000报错解决记录

    存储过程如下:
    create or replace procedure ad.table_analyse_bill( p_BillMonth in number,--bill_month
    p_tail in number,
    p_nInsId in number,
    p_nSeqId in number, --no use
    p_nStatus out number,
    p_szErrorMsg out varchar2
    ) is
    v_sql varchar2(2000);
    table_name varchar2(200);
    v_BillMonth number(8);
    begin
    v_BillMonth:=to_number(substr(to_char(p_BillMonth),1,6));
    v_sql := 'CA_CYCLE_RUN';
    table_name:='CA_CYCLE_RUN'||'_'||p_tail;
    dbms_stats.gather_table_stats(ownname=>'AD',tabname =>upper(table_name),degree => 20,no_invalidate => FALSE );
    /*v_sql := 'CA_POCKET';
    table_name:='CA_POCKET'||'_'||p_tail;
    dbms_stats.gather_table_stats(ownname=>'AD',tabname =>upper(table_name),degree => 20,no_invalidate => FALSE );*/
    /*v_sql := 'CA_BILL';
    table_name:='CA_BILL'||'_'||p_tail||'_'||v_BillMonth;
    dbms_stats.gather_table_stats(ownname=>'AD',tabname =>upper(table_name),degree => 20,no_invalidate => FALSE );*/
    /*v_sql := 'CA_BILL_ITEM';
    table_name:='CA_BILL_ITEM'||'_'||p_tail||'_'||v_BillMonth;
    dbms_stats.gather_table_stats(ownname=>'AD',tabname =>upper(table_name),degree => 20,no_invalidate => FALSE );*/
    /*v_sql := 'CA_BILL_PROD';
    table_name:='CA_BILL_PROD'||'_'||p_tail||'_'||v_BillMonth;
    dbms_stats.gather_table_stats(ownname=>'AD',tabname =>upper(table_name),degree => 20,no_invalidate => FALSE );*/
     
     
    p_nStatus := 0;
    p_szErrorMsg := 'Runing successed: table_analyse_bill';
    exception
    when others then
    p_nStatus:=-1;
    p_szErrorMsg:='encounter a exception,sqlcode:'||sqlcode||',sqlerrm:'||sqlerrm||',sql:'||v_sql;
    Dbms_Output.put_line(p_szErrorMsg);
    return;
     
    end;
     
    第一个报错,该用户收集统计信息权限不足
    Ora-20000: Unable To Gather Statistics Concurrently, Insufficient Privileges [ID 1329367.1
    SOLUTION:
    FND_STATS is a wrapper of DBMS_STATS. FND_STATS internally calls DBMS_STATS. To adopt the Concurrent Statistics Gathering feature, user (through which generating stats is being executed) should have the below three privileges:
    - MANAGE ANY QUEUE
    - CREATE JOB
    - MANAGE SCHEDULER
    Because the Gather Tablestatistics is run as APPS user in the database and this user does not have above priviliges, the concurrent request or the FND_STATS or DBMS_STATS fails.
     
    赋权后使用AD用户重新登录,调用存储过程
    sqlplus AD/hdyYYHJ8_28jh@10.11.59.108/SHWLW
    declare
    p_BillMonth number:=2018131;
    p_tail number:=0;
    p_nInsId number:=NULL;
    p_nSeqId number:=NULL;
    p_nStatus number:=0;
    p_szErrorMsg varchar2(200):='';
    begin
    ad.table_analyse_bill(p_BillMonth,p_tail,p_nInsId,p_nSeqId,p_nStatus,p_szErrorMsg);
    end;
    /
    出现第二个报错,
    Unable To Gather Statistics, Receive "ORA-20000: Resource Manager Plan Is Not Active or is not managing CPU usage" Error Following Upgrade to 12c (文档 ID 2049013.1)
    SOLUTION:
    alter system set resource_manager_plan = 'DEFAULT_PLAN' scope=both
     

  • 相关阅读:
    希望多年以后的自己不再如此迷茫
    【转载】撒旦(Satan 4.2)勒索病毒最新变种加解密分析
    java单例模式
    关于double/float 两种基本类型精度丢失的总结
    关于ecplise中一些很实用的技巧
    安装SQL Server和卸载SQL Server步骤
    我进入部门的第一周
    mysql数据库在Linux和windows下免安装实现以及框架开发碰到的问题
    jenkins发布docker到mesos
    u盘作为git仓库,完成不同地方的代码同步
  • 原文地址:https://www.cnblogs.com/kawashibara/p/9875447.html
Copyright © 2011-2022 走看看