Category: Performance

Aug 30 2011

AWR Report Missing Statistic Data – WARNING: Since the DB Time is less than one second

Problem description:

     In AWR report in 11g have found the following warning message in the Top and All Statistics Informations are missing
"WARNING: Since the DB Time is less than one second, there was minimal foreground activity in the snapshot period. Some of the percentage values will be invalid."
Root Cause:
	Historical Data and Statistics are not colleted and available in Statistical Tables.
Proposed Solution:
[oracle@ORA01 ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/db_1
[oracle@ORA01 ~]$ echo $ORACLE_SID
ORCL
[oracle@ORA01 ~]$ cd $ORACLE_HOME
[oracle@ORA01 db_1]$ cd rdbms
[oracle@ORA01 rdbms]$ cd admin
[oracle@ORA01 admin]$ pwd
/u01/app/oracle/product/11.2.0/db_1/rdbms/admin
[oracle@ORA01 admin]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Mon Aug 29 20:51:52 2011
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Release 11.2.0.1.0 - Production

SQL> show parameter control_management_pack_access

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_management_pack_access       string      NONE

SQL> alter system set control_management_pack_access="DIAGNOSTIC+TUNING" scope=both;

System altered.

SQL> show parameter control_management_pack_access

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_management_pack_access       string      DIAGNOSTIC+TUNING
SQL>
      Once the above propsed solution is applied wait for an hour because default time to generate next Data Collection is after 1 hour. If you have any specific data collection interval please check after next data collection. It will be fine.

Proposed Another Solution:
	I think this is a known problem, several mentions on metalink. You could try to drop your AWR with the catnoawr.sql script, then re-create it with catawr.sql but of course you would lose all the histotical data. Or possibly, following the hints in the metalink articles
Feb 12 2011

Server Performance Data Collection – Collectl

Server Performance Data Collection

1. Disk

2. CPU

3. Network … Etc

There are a number of times in which you find yourself needing performance data. These can include benchmarking, monitoring a system’s general heath or trying to determine what your system was doing at some time in the past. Sometimes you just want to know what the system is doing right now. Depending on what you’re doing, you often end up using different tools, each designed to for that specific situation.

Unlike most monitoring tools that either focus on a small set of statistics, format their output in only one way, run either interatively or as a daemon but not both, collectl tries to do it all. You can choose to monitor any of a broad set of subsystems which currently include buddyinfo, cpu, disk, inodes, infiniband, lustre, memory, network, nfs, processes, quadrics, slabs, sockets and tcp.

By default it shows cpu, network and disk stats in brief format. The key point of this format is all output appears on a single line making it much easier to spot spikes or other anomalies in the output:

[oracle@Mudhalvan] collectl

while writing to an NFS mounted filesystem, collectl displays interrupts, memory usage and nfs activity with timestamps. Keep in mind that you can mix and match any data and in the case of brief format you simply need to have a window wide enough to accommodate your output.
[oracle@Mudhalvan] collectl -sjmf -oT

You can also display the same information in verbose format, in which case you get a single line for each type of data at the expense of more screen real estate, as can be seen in this example of network data during NFS writes. Note how you can actually see the network traffic stall while waiting for the server to physically write the data.
[oracle@Mudhalvan] collectl -sn –verbose -oT
[oracle@Mudhalvan] collectl -sJ -oTm

Output can also be saved in a rolling set of logs for later playback or displayed interactively in a variety of formats. If all that isn’t enough there are additional mechanisms for supplying data to external tools by generating output as s-expressions, a format of choice for some tools such as supermon or in another format called list-expressions. This output can be written to a file or sent over a socket. You can even create files in space-separated format for plotting with external packages like gnuplot or colplot, part of the collectl utilities project, which provides a web-based interface to gnuplot.

Collectl runs on all linux distros (it’s included as part of Fedora) and only requires perl. If the perl Time::Hires module is installed, you will be able to use fractional intervals and display timestamps in msecs. If the Compress::Zlib module is installed the recorded data will be compressed and therefore use on average 90% less storage when recording to a file. Also note that the above links are not for RPMs. If you’d rather work with RPMs there are far too many versions out there to link to and so I’m sorry to say you’re on your own.

Did you know there was an inconsistency in the way Linux reported disk metrics that wasn’t even noticed/fixed until the 2.6-14 kernel was released? Collectl did. Or how about the fact that network stats may not accurately reported by most network monitoring tools at one second intervals? See this page for a description of the problem and how you can get more accurate stats by simply running collectl at a sub-second interval.

You can have the updated version here

Feb 02 2011

Stored Outlines in 10g

Stored Outlines:
A stored outline is a collection of hints associated with a specific SQL statement that allows a standard execution plan to be maintained, regardless of changes in the system environment or associated statistics.
Plan stability is based on the preservation of execution plans at a point in time where the performance of a statement is considered acceptable.
The outlines are stored in the OL$, OL$HINTS, and OL$NODES tables, but the [USER|ALL|DBA]_OUTLINES and [USER|ALL|DBA]_OUTLINE_HINTS views should be used to display information about existing outlines.
Under normal running the optimizer chooses the most suitable execution plan for the current circumstances.
By using a stored outline you may be forcing the optimizer to choose a substandard execution plan, so you should monitor the affects of your stored outlines over time to make sure this isn’t happening. As a DBA you already know what works well today may not tomorrow with the same plan.

– Grant the necessary privileges.
CONN sys/password AS SYSDBA
GRANT CREATE ANY OUTLINE TO SCOTT;
GRANT EXECUTE_CATALOG_ROLE TO SCOTT;

The following example uses the CREATE OUTLINE statement to create an outline for a specified SQL statement. The statement is assigned to an outline category called SCOTT_OUTLINES to ease administration. If the category is not specified the outline is assigned to the default category.

CONN scott/tiger

— Create an outline for a specific SQL statement.
CREATE OUTLINE emp_dept FOR CATEGORY scott_outlines
ON SELECT e.empno, e.ename, d.dname FROM emp e, dept d WHERE e.deptno = d.deptno;

— Check the outline as been created correctly.
COLUMN name FORMAT A30
SELECT name, category, sql_text FROM user_outlines WHERE category = ‘SCOTT_OUTLINES’;

Nov 06 2010

DB Optimizer – SQL Performance Tool

DB Optimizer – SQL Performance Tool

http://vimeo.com/13678043

Sep 02 2010

Difference between locks and latches

Locks are used to protect the data or resourses from the simulteneous use of them by multiple sessions which might set them in inconsistant state… Locks are external mechanism, means user can also set locks on objects by using various oracle statements.

Latches are for the same purpose but works at internal level. Latches are used to Protect and control access to internal data structres like various SGA buffers.They are handled and maintained by oracle and we can’t access or set it.. this is the main difference

Apr 22 2010

ADDM(Automatic Database Diagnostic Monitor) in Oracle Database 10g

The Automatic Database Diagnostic Monitor (ADDM) analyzes data in the Automatic Workload Repository (AWR) to identify potential performance bottlenecks. For each of the identified issues it locates the root cause and provides recommendations for correcting the problem.

An ADDM analysis is performed every time an AWR snapshot is taken and the results are saved in the database provided the STATISTICS_LEVEL parameter is set to TYPICAL or ALL.

The ADDM analysis includes:

•CPU bottlenecks
•Undersized Memory Structures
•I/O capacity issues
•High load SQL statements
•High load PL/SQL execution and compilation, as well as high load Java usage
•RAC specific issues
•Sub-optimal use of Oracle by the application
•Database configuration issues
•Concurrency issues
•Hot objects and top SQL for various problem areas

ADDM analysis results are represented as a set of FINDINGs

Example ADDM Report

FINDING 1: 31% impact (7798 seconds)
————————————
SQL statements were not shared due to the usage of literals. This resulted in additional hard parses which were consuming significant database time.

RECOMMENDATION 1: Application Analysis, 31% benefit (7798 seconds)

ACTION: Investigate application logic for possible use of bind variables
instead of literals. Alternatively, you may set the parameter “cursor_sharing” to “force”.

RATIONALE: SQL statements with PLAN_HASH_VALUE 3106087033 were found to be using literals. Look in V$SQL for examples of such SQL statements.

In this example, the finding points to a particular root cause, the usage of literals in SQL statements, which is estimated to have an impact of about 31% of total DB time in the analysis period.

In addition to problem diagnostics, ADDM recommends possible solutions. When appropriate, ADDM recommends multiple solutions for the DBA to choose from. ADDM considers a variety of changes to a system while generating its recommendations.

Recommendations include:

•Hardware changes
•Database configuration
•Schema changes
•Application changes
•Using other advisors

ADDM Settings

Automatic database diagnostic monitoring is enabled by default and is controlled by the STATISTICS_LEVEL initialization parameter.
The STATISTICS_LEVEL parameter should be set to the TYPICAL or ALL to enable the automatic database diagnostic monitoring.
The default setting is TYPICAL.
Setting STATISTICS_LEVEL to BASIC disables many Oracle features, including ADDM, and is strongly discouraged.

ADDM analysis of I/O performance partially depends on a single argument, DBIO_EXPECTED

The value of DBIO_EXPECTED is the average time it takes to read a single database block in microseconds. Oracle uses the default value of 10 milliseconds

Set the value using
EXECUTE DBMS_ADVISOR.SET_DEFAULT_TASK_PARAMETER(‘ADDM’, ‘DBIO_EXPECTED’, 8000);

Diagnosing Database Performance Issues with ADDM

To diagnose database performance issues, ADDM analysis can be performed across any two AWR snapshots as long as the following requirements are met:

•Both the snapshots did not encounter any errors during creation and both have not yet been purged.

•There were no shutdown and startup actions between the two snapshots.

Using Enterprise Manager

The obvious place to start viewing ADDM reports is Enterprise Manager. The “Performance Analysis” section on the “Home” page is a list of the top five findings from the last ADDM analysis task.

Specific reports can be produced by clicking on the “Advisor Central” link, then the “ADDM” link. The resulting page allows you to select a start and end snapshot, create an ADDM task and display the resulting report by clicking on a few links.

Executing addmrpt.sql Script

The addmrpt.sql script can be used to create an ADDM report from SQL*Plus. The script is called as follows:

@/u01/app/oracle/product/10.1.0/db_1/rdbms/admin/addmrpt.sql

It then lists all available snapshots and prompts you to enter the start and end snapshot along with the report name.

Using DBMS_ADVISOR Package

The DBMS_ADVISOR package can be used to create and execute any advisor tasks, including ADDM tasks. The following example shows how it is used to create, execute and display a typical ADDM report:

BEGIN
— Create an ADDM task.
DBMS_ADVISOR.create_task (
advisor_name => ‘ADDM’,
task_name => ’970_1032_AWR_SNAPSHOT’,
task_desc => ‘Advisor for snapshots 970 to 1032.’);

— Set the start and end snapshots.
DBMS_ADVISOR.set_task_parameter (
task_name => ’970_1032_AWR_SNAPSHOT’,
parameter => ‘START_SNAPSHOT’,
value => 970);

DBMS_ADVISOR.set_task_parameter (
task_name => ’970_1032_AWR_SNAPSHOT’,
parameter => ‘END_SNAPSHOT’,
value => 1032);

— Execute the task.
DBMS_ADVISOR.execute_task(task_name => ’970_1032_AWR_SNAPSHOT’);
END;
/

– Display the report.
SET LONG 100000
SET PAGESIZE 50000
SELECT DBMS_ADVISOR.get_task_report(’970_1032_AWR_SNAPSHOT’) AS report
FROM dual;
SET PAGESIZE 24The value for the SET LONG command should be adjusted to allow the whole report to be displayed.

The relevant AWR snapshots can be identified using the DBA_HIST_SNAPSHOT view.

ADDM Views

•DBA_ADVISOR_TASKS

This view provides basic information about existing tasks, such as the task Id, task name, and when created.

•DBA_ADVISOR_LOG

This view contains the current task information, such as status, progress, error messages, and execution times.

•DBA_ADVISOR_RECOMMENDATIONS

This view displays the results of completed diagnostic tasks with recommendations for the problems identified in each run. The recommendations should be looked at in the order of the RANK column, as this relays the magnitude of the problem for the recommendation. The BENEFIT column gives the benefit to the system you can expect after the recommendation is carried out.

•DBA_ADVISOR_FINDINGS

This view displays all the findings and symptoms that the diagnostic monitor encountered along with the specific recommendation

Mar 24 2010

ORA-13516: AWR Operation failed: INTERVAL Setting is ZERO

===== ORA-13516: AWR Operation failed: INTERVAL Setting is ZERO

The above error message is because of the INTERVAL of snapshot setting is Zero. You can change the snapshot setting by using the following command. The below command set the interval to 60 mins

DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS( INTERVAL=>60 );

Mar 24 2010

How to create AWR Snapshot Manually

exec DBMS_WORKLOAD_REPOSITORY.create_snapshot();

Mar 24 2010

Views and Usage Related to AWR and ASH

* V$ACTIVE_SESSION_HISTORY – Displays the active session history (ASH) sampled every second.
* V$METRIC – Displays metric information.
* V$METRICNAME – Displays the metrics associated with each metric group.
* V$METRIC_HISTORY – Displays historical metrics.
* V$METRICGROUP – Displays all metrics groups.
* DBA_HIST_ACTIVE_SESS_HISTORY – Displays the history contents of the active session history.
* DBA_HIST_BASELINE – Displays baseline information.
* DBA_HIST_DATABASE_INSTANCE – Displays database environment information.
* DBA_HIST_SNAPSHOT – Displays snapshot information.
* DBA_HIST_SQL_PLAN – Displays SQL execution plans.
* DBA_HIST_WR_CONTROL – Displays AWR settings.

Mar 24 2010

How to run AWR Report awrrpt.sql

$cd ORACLE_HOME
$cd rdbms
$cd admin
$sqlplus /nolog
SQL>connect / as sysdba
SQL>@awrrpt.sql
Current Instance
~~~~~~~~~~~~~~~~

DB Id DB Name Inst Num Instance
———– ———— ——– ————
XXXX TEST 1 test

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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
———— ——– ———— ———— ————
* XXXXX 1 TEST test XXXXXX

Using XXXXX 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 without
specifying a number lists all completed snapshots.
Enter value for num_days:1
Enter value for num_days: 1
Listing the last day’s Completed Snapshots
Snap
Instance DB Name Snap Id Snap Started Level
———— ———— ——— —————— —–
test TEST 10401 24 Mar 2010 00:00 1
10402 24 Mar 2010 01:00 1
10403 24 Mar 2010 02:00 1
10404 24 Mar 2010 03:00 1
10405 24 Mar 2010 04:00 1
10406 24 Mar 2010 05:00 1

Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 1405
Begin Snapshot Id specified: 1405

Enter value for end_snap: 1406
End Snapshot Id specified: 1406

Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_10405_10406.html. To use this name,
press to continue, otherwise enter an alternative.

Enter value for report_name:awrrpt_1_10405_10406.html

This will generate a report into the current folder with “awrrpt_1_10405_10406.html” name

Alibi3col theme by Themocracy