The document describes troubleshooting an issue with Automatic Workload Repository (AWR) on an Oracle database. It shows the user receiving errors when trying to create AWR snapshots. The user then runs scripts to reinitialize the AWR schema, which drops and recreates all the necessary AWR tables. After this, AWR functions like creating snapshots work successfully.
Whitepaper: Mining the AWR repository for Capacity Planning and Visualization
Resolving ORA-13516 error when creating AWR snapshot in Oracle
1. SQL> BEGIN
DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT (); 2
END;
/ 3 4
BEGIN
*
ERROR at line 1:
ORA-13516: AWR Operation failed: AWR Schema not initialized
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 14
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 37
ORA-06512: at line 2
SQL> show user
USER is "SYS"
SQL> BEGIN
DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT (); 2
END;
/ 3 4
BEGIN
*
ERROR at line 1:
ORA-13516: AWR Operation failed: AWR Schema not initialized
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 14
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 37
ORA-06512: at line 2
SQL> exec DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT ();
BEGIN DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT (); END;
*
ERROR at line 1:
ORA-13516: AWR Operation failed: AWR Schema not initialized
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 14
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 37
ORA-06512: at line 1
SQL> conn /as sysdba
Connected.
SQL>
SQL> exec DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT ();
BEGIN DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT (); END;
*
ERROR at line 1:
ORA-13516: AWR Operation failed: AWR Schema not initialized
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 14
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 37
ORA-06512: at line 1
SQL> ORA-13516
SP2-0042: unknown command "ORA-13516" - rest of line ignored.
SQL>
SQL>
SQL> select open_mode fro
2
SQL> select status from v$database;
select status from v$database
*
ERROR at line 1:
ORA-00904: "STATUS": invalid identifier
2. SQL> select status from v$instance;
STATUS
------------
OPEN
SQL> @?/rdbms/admin/CATNOAWR.SQL
SP2-0310: unable to open file
"/testdb/oradb/db/tech_st/11.1.0/rdbms/admin/CATNOAWR.SQL"
SQL> @?/rdbms/admin/catnoawr.sql
PL/SQL procedure successfully completed.
Type dropped.
Type dropped.
Type dropped.
Type dropped.
Type dropped.
Type dropped.
Type dropped.
Type dropped.
Type dropped.
Type dropped.
Type dropped.
Type dropped.
Type dropped.
Type dropped.
Type dropped.
Type dropped.
8. Table dropped.
Table dropped.
Table dropped.
Table dropped.
Table dropped.
Table dropped.
Table dropped.
Table dropped.
Table dropped.
Table dropped.
Table dropped.
Table dropped.
Table dropped.
Table dropped.
Table dropped.
Table dropped.
SQL> @?/rdbms/admin/catawrtb.sql
Session altered.
Table created.
drop table WRH$_FILESTATXS_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
9. Table altered.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Index created.
drop table WRH$_SQLSTAT_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Index created.
Table created.
Table created.
Table created.
Table created.
Table created.
10. Table created.
drop table WRH$_SYSTEM_EVENT_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Table created.
Table created.
Table created.
Table created.
drop table WRH$_WAITSTAT_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Table created.
Table created.
drop table WRH$_LATCH_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Table created.
drop table WRH$_LATCH_CHILDREN_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
11. Table created.
Table altered.
Table created.
drop table WRH$_LATCH_PARENT_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Table created.
drop table WRH$_LATCH_MISSES_SUMMARY_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Table created.
drop table WRH$_EVENT_HISTOGRAM_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Table created.
Table created.
Table created.
drop table WRH$_DB_CACHE_ADVICE_BL
*
12. ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Table created.
Table created.
drop table WRH$_ROWCACHE_SUMMARY_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Table created.
Table created.
drop table WRH$_SGASTAT_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
13. Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
drop table WRH$_SYSSTAT_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Table created.
drop table WRH$_SYS_TIME_MODEL_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Table created.
drop table WRH$_OSSTAT_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
14. Table altered.
Table created.
drop table WRH$_PARAMETER_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Table created.
Table created.
Table created.
Table created.
Table created.
drop table WRH$_SEG_STAT_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Table created.
Table created.
Table created.
Index created.
Table created.
Index created.
Table created.
15. Index created.
Table created.
Index created.
Table created.
Index created.
Table created.
drop table WRH$_DLM_MISC_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Table created.
Table created.
Table created.
drop table WRH$_INST_CACHE_TRANSFER_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Table created.
drop table WRH$_ACTIVE_SESSION_HISTORY_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
16. Table altered.
Table created.
drop table WRH$_TABLESPACE_STAT_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Table created.
Table created.
Table created.
Index created.
Table created.
Table created.
drop table WRH$_SERVICE_STAT_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Table created.
drop table WRH$_SERVICE_WAIT_CLASS_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
17. Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
drop table WRH$_INTERCONNECT_PINGS_BL
*
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
Table altered.
Type created.
18. Type created.
Synonym created.
Synonym created.
Grant succeeded.
Grant succeeded.
Type created.
Type created.
Synonym created.
Synonym created.
Grant succeeded.
Grant succeeded.
Type created.
Type created.
Type created.
Type created.
Type created.
Type created.
Type created.
Type created.
Synonym created.
Synonym created.
19. Synonym created.
Synonym created.
Synonym created.
Synonym created.
Synonym created.
Synonym created.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Type created.
Type created.
Type created.
Type created.
Synonym created.
Synonym created.
Synonym created.
20. Synonym created.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Session altered.
SQL> @?/rdbms/admin/awrrpt.sql
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ -------- ------------
2028137520 HLIT 1 HLIT
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Would you like an HTML report, or a plain text report?
Enter 'html' for an HTML report, or 'text' for plain text
Defaults to 'html'
Enter value for report_type: html
Type Specified: html
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21. Using 2028137520 for database Id
Using 1 for instance number
declare
*
ERROR at line 1:
ORA-20200: Database/Instance 2028137520/1 does not exist in
DBA_HIST_DATABASE_INSTANCE
ORA-06512: at line 23
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 -
64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
You have mail in /usr/spool/mail/oratest
$ ORA-20200: Database/Instance 2028137520/1 does not exist in
ksh: ORA-20200:: not found.
$
$ sqlplus '/as sysdba'
SQL*Plus: Release 11.1.0.7.0 - Production on Wed May 15 12:13:54 2013
Copyright (c) 1982, 2008, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select dbid from v$database;
DBID
----------
2028137520
SQL> select instance_number from v$instance;
INSTANCE_NUMBER
---------------
1
SQL> define dbid=2028137520
SQL> define inst_num=1
SQL> @?/rdbms/admin/awrrpt.sql
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ -------- ------------
2028137520 HLIT 1 HLIT
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Would you like an HTML report, or a plain text report?
Enter 'html' for an HTML report, or 'text' for plain text
Defaults to 'html'
Enter value for report_type: html
Type Specified: html
Instances in this Workload Repository schema
22. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ -------- ------------ ------------ ------------
* 2028137520 1 HLIT HLIT hlifetest
Using 2028137520 for database Id
Using 1 for instance number
Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the most recent
(n) days of snapshots being listed. Pressing <return> without
specifying a number lists all completed snapshots.
Enter value for num_days: 1
Listing the last day's Completed Snapshots
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 1
Begin Snapshot Id specified: 1
Enter value for end_snap: 1
End Snapshot Id specified: 1