Oracle10g使用$ORACLE_HOME/rdbms/admin/awrrpt.sql报错

时间:2023-03-10 03:38:15
Oracle10g使用$ORACLE_HOME/rdbms/admin/awrrpt.sql报错
Enter value for report_name: 
Using the report name awrrpt_1_591_593.html
select output from table(dbms_workload_repository.awr_report_html( :dbid,
*
ERROR at line 1:
ORA-04063: package body "SYS.DBMS_WORKLOAD_REPOSITORY" has errors
Report written to awrrpt_1_591_593.html

查看无效对象:
DBMS_SWRF_REPORT_INTERNAL和DBMS_WORKLOAD_REPOSITORY均无效
尝试编译DBMS_WORKLOAD_REPOSITORY,报错:对象DBMS_SWRF_REPORT_INTERNAL无效
尝试编译DBMS_SWRF_REPORT_INTERNAL报错:
PLS-00753:malformed or corrupted wrapped unit
DBMS_SWRF_REPORT_INTERNAL
使用如下命令,查看错误代码
$ sqlplus / as sysdba 
SQL>set serveroutput on 
SQL> alter package DBMS_SWRF_REPORT_INTERNAL compile; 
SQL>show error 
SQL> alter package DBMS_SWRF_REPORT_INTERNAL compile body; 
SQL>show error 
SQL> alter package DBMS_WORKLOAD_REPOSITORY compile; 
SQL> alter package DBMS_WORKLOAD_REPOSITORY compile body; 
SQL>show error 
查找相关资料,使用如下sql修复包
$sqlplus "/as sysdba" 
SQL> @?/rdbms/admin/catawrtb.sql 
SQL> @?/rdbms/admin/dbmsawr.sql 
SQL> @?/rdbms/admin/prvtawr.plb 
SQL> @?/rdbms/admin/utlrp.sql 
SQL> @?/rdbms/admin/awrrpt.sql 
--If error still exists, please restart the database and try again.... 
SQL> shutdown immediate 
SQL> startup 
SQL> @?/rdbms/admin/awrrpt.sql

测试环境测试通过
正在正式环境也测试:
Using the report name awrrpt_1_52549_52550.html
select output from table(dbms_workload_repository.awr_report_html( :dbid,
                         *
ERROR at line 1:
ORA-04045: errors during recompilation/revalidation of SYS.DBMS_SWRF_REPORT_INTERNAL
ORA-04030: out of process memory when trying to allocate 4120 bytes (PLS non-lib hp,pdz2M87_Allocate_Permanent)
ORA-06508: PL/SQL: could not find program unit being called: "SYS.DBMS_SWRF_REPORT_INTERNAL"
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 309
ORA-06512: at line 1
Report written to awrrpt_1_52549_52550.html

排查:
根据文档
Diagnosing and Resolving ORA-4030 Errors (文档 ID 233869.1)排查
Oracle建议重建awr库:
How to Recreate The AWR ( AUTOMATIC WORKLOAD ) Repository ? (文档 ID 782974.1)
但是动作太大,无法在产品环境试验