• 存储过程收集统计信息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
     

  • 相关阅读:
    增强iOS应用程序性能的提示和技巧(25个)
    [iOS]用instancetype代替id作返回类型有什么好处?
    把cygwin加入右键菜单
    NSRange
    Centos7下安装MySQL
    (转)php 操作redis全部方法。
    unbuntu 安装php5.6
    unbuntu 安装nginx
    unbuntu 安装MySQL
    Ubuntu16.04下实现MySQL主从复制
  • 原文地址:https://www.cnblogs.com/kawashibara/p/9875447.html
Copyright © 2020-2023  润新知