Oracle重建awr步骤
1.稳妥起见,建议停机重建
2.如果是rac环境需要修改如下参数:
alter system set cluster_database = false scope = spfile;
3.执行如下脚本开始清除,执行速度很快,因为都是drop,如果遇到某个表不存在的报错,无须理会
@?/rdbms/admin/catnoawr.sql4.运行脚本执行重建
@?/rdbms/admin/catawrtb.sql5.运行脚本编译无效对象
@?/rdbms/admin/utlrp.sql6. 11g运行如下脚本
@?/rdbms/admin/execsvrm.sql运行这个脚本的时候,遇到如下报错:
BEGIN
*
ERROR at line 1:
ORA-04068: existing state of packages has been discarded
ORA-04061: existing state of package "SYS.DBMS_SWRF_INTERNAL" has been
invalidated
ORA-04065: not executed, altered or dropped package "SYS.DBMS_SWRF_INTERNAL"
ORA-06508: PL/SQL: could not find program unit being called:
"SYS.DBMS_SWRF_INTERNAL"
ORA-06512: at line 3解决办法是对包重新编译:
alter package dbms_swrf_internal compile;
alter package dbms_swrf_internal compile body;7.重新执行第六步
8.生成一个报告试试
exec dbms_workload_repository.create_snapshot;遇到如下报错:
SQL> exec dbms_workload_repository.create_snapshot;
BEGIN dbms_workload_repository.create_snapshot; END;
*
ERROR at line 1:
ORA-13518: Invalid database id (819500514)
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 99
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 122
ORA-06512: at line 1在MOS上找到一篇文章说了这个问题
ORA-13518 : 'Invalid Database Id' On Call to DBMS_WORKLOAD_REPOSITORY Package [ID 984447.1]
Changes
Recently AWR was recreated using catnoawr.sql and catawrtb.sql.
Cause
When a function / procedure is called from DBMS_WORKLOAD_REPOSITORY package, it refers table WRM$_DATABASE_INSTANCE to get dbid information.
As the AWR repositories has been recreated , the table doesn't not have any data present in it.
SQL> select * from WRM$_DATABASE_INSTANCE ;
no rows selected
Solution
The WRM$_DATABASE_INSTANCE gets populated with instance information when the instance is rebooted.
So, If you have recreated AWR using catnoawr.sql , catawrtb.sql , then you need to bounce the Instance .
On restart , the table will be populated with the requisite information.
Hence , better option for recreating AWR is to use startup restrict method.
After the recreation activity is completed , shutdown the database and open it normally.
9.重启后问题解决
10.修改rac 相关参数
alter system set cluster_database =truescope= spfile;11.生成awr报告
@$ORACLE_HOME/rdbms/admin/awrrpt.sql
2.如果是rac环境需要修改如下参数:
alter system set cluster_database = false scope = spfile;
3.执行如下脚本开始清除,执行速度很快,因为都是drop,如果遇到某个表不存在的报错,无须理会
@?/rdbms/admin/catnoawr.sql4.运行脚本执行重建
@?/rdbms/admin/catawrtb.sql5.运行脚本编译无效对象
@?/rdbms/admin/utlrp.sql6. 11g运行如下脚本
@?/rdbms/admin/execsvrm.sql运行这个脚本的时候,遇到如下报错:
BEGIN
*
ERROR at line 1:
ORA-04068: existing state of packages has been discarded
ORA-04061: existing state of package "SYS.DBMS_SWRF_INTERNAL" has been
invalidated
ORA-04065: not executed, altered or dropped package "SYS.DBMS_SWRF_INTERNAL"
ORA-06508: PL/SQL: could not find program unit being called:
"SYS.DBMS_SWRF_INTERNAL"
ORA-06512: at line 3解决办法是对包重新编译:
alter package dbms_swrf_internal compile;
alter package dbms_swrf_internal compile body;7.重新执行第六步
8.生成一个报告试试
exec dbms_workload_repository.create_snapshot;遇到如下报错:
SQL> exec dbms_workload_repository.create_snapshot;
BEGIN dbms_workload_repository.create_snapshot; END;
*
ERROR at line 1:
ORA-13518: Invalid database id (819500514)
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 99
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 122
ORA-06512: at line 1在MOS上找到一篇文章说了这个问题
ORA-13518 : 'Invalid Database Id' On Call to DBMS_WORKLOAD_REPOSITORY Package [ID 984447.1]
Changes
Recently AWR was recreated using catnoawr.sql and catawrtb.sql.
Cause
When a function / procedure is called from DBMS_WORKLOAD_REPOSITORY package, it refers table WRM$_DATABASE_INSTANCE to get dbid information.
As the AWR repositories has been recreated , the table doesn't not have any data present in it.
SQL> select * from WRM$_DATABASE_INSTANCE ;
no rows selected
Solution
The WRM$_DATABASE_INSTANCE gets populated with instance information when the instance is rebooted.
So, If you have recreated AWR using catnoawr.sql , catawrtb.sql , then you need to bounce the Instance .
On restart , the table will be populated with the requisite information.
Hence , better option for recreating AWR is to use startup restrict method.
After the recreation activity is completed , shutdown the database and open it normally.
9.重启后问题解决
10.修改rac 相关参数
alter system set cluster_database =truescope= spfile;11.生成awr报告
@$ORACLE_HOME/rdbms/admin/awrrpt.sql
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。