How to rebuild or install AWR for Oracle 10g/11g

Source: Internet
Author: User

If you encounter a large amount of AWR data in your daily work, you can clear it as follows:
SQL> select distinct dbid, db_name, instance_name from wrm $ _ database_instance;
DBID DB_NAME INSTANCE_NAME
-----------------------------------
2691876695 MYDB mydb

Run the following script to clear AWR data:
SQL> @? \ Rdbms \ admin \ catnoawr. SQL
(Omitted)

If you do not restart, clear the sharing pool.
Alter system flush shared_pool;

Run the reconstruction AWR script:
SQL> @? \ Rdbms \ admin \ catawrtb. SQL
(Omitted)

Session changed

SQL> @? \ Rdbms \ admin \ utlrp. SQL

(Omitted)


The following script must be run for Oracle 11g:
SQL> @? \ Rdbms \ admin \ execsvrm. SQL

SQL> exec dbms_workload_repository.create_snapshot;

The PL/SQL process is successfully completed.

If you do not re-compile the stored procedure, the following issues will be prompted when you execute the snapshot process:

SQL> exec dbms_workload_repository.create_snapshot;
BEGIN dbms_workload_repository.create_snapshot; END;

*
Row 3 has an error:
ORA-13516: AWR operation failed: AWR Schema not initialized
ORA-06512: In "SYS. DBMS_WORKLOAD_REPOSITORY", line 99
ORA-06512: In "SYS. DBMS_WORKLOAD_REPOSITORY", line 122
ORA-06512: In line 1

After the stored procedure is re-compiled, the stored procedure runs normally.

Run again every five minutes:
SQL> exec dbms_workload_repository.create_snapshot;

The PL/SQL process is successfully completed.
SQL> @? /Rdbms/admin/awrrpt. SQL

Note that in the RAC environment, you need to cancel the Cluster Parameters and modify them again after the execution is complete:
Alter system set cluster_database = false scope = spfile;

Of course, after reconstruction, we need to further check whether the related objects have exceptions. For objects with exceptions, re-compile:

Pool objects. lst
Set pagesize500
Set linesize 100

Select substr (comp_name,) comp_name, status, substr (version,) version
From dba_registry
Order by comp_name;

Select substr (object_name,) object_name, substr (owner,) owner, object_type
From dba_objects
Where status = 'invalid' order by owner, object_type;

Select owner, object_type, count (*)
From dba_objects
Where status = 'invalid'
Group by owner, object_type order by owner, object_type;

Spool off

Alter package <schema name>. <package_name> compile;
Alter package <schema name>. <package_name> compile body;
Alter view <schema name>. <view_name> compile;
Alter trigger <schema). <trigger_name> compile;

For more information about Oracle, see Oracle topics page http://www.bkjia.com/topicnews.aspx? Tid = 12

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.