Last week (on October 4th) I presented a webinar for IOUG titled "Winning Performance Challenges in Oracle Standard Editions". For those who missed the webinar a recording is available here: http://www.ioug.org/p/cm/ld/fid=153
Abstract:
Oracle Diagnostics and Tuning packs offer comprehensive valuable performance diagnostics and tuning features such as: AWR, ADDM, ASH, ASH Analytics, etc. These optional packs can be licensed only on top of the Oracle Enterprise Edition. Without these packs, diagnosing performance issues may become a very complex task – even for advanced DBAs. In this session we will explore how you could leverage Oracle’s Statspack report and dictionary views to diagnose performance issues even without using any expensive editions and packs. In addition we will see how Quest tools can help DBAs to diagnose and solve even the most complex performance issues without relying on the Diagnostics and Tuning packs and for all the Oracle Database editions.
Slide Deck:
Slide deck is also available (https://www.slideshare.net/PiniDibask/winning-performance-challenges-in-oracle-standard-editions)
I'd like to thank everyone who attended and if you have any follow-up questions feel free to contact me (Pini.Dibask@Quest.com).
Showing posts with label Performance Tuning. Show all posts
Showing posts with label Performance Tuning. Show all posts
Tuesday, October 9, 2018
Monday, April 30, 2018
IOUG Collaborate 2018 - Slide Decks are Available!
Last week I presented 3 sessions at my favorite Oracle conference - the IOUG Collaborate.
The slide decks for my presentations are now available:
Data Guard for Beginners
ASM Conepts, Architecture and Best Practices
Get the Oracle Performance Diagnostics Capabilities You Need without Spending a Fortune
I'd like to thank everybody who attended my sessions! Hope to see you again next year.
The slide decks for my presentations are now available:
Data Guard for Beginners
ASM Conepts, Architecture and Best Practices
Get the Oracle Performance Diagnostics Capabilities You Need without Spending a Fortune
I'd like to thank everybody who attended my sessions! Hope to see you again next year.
Thursday, August 31, 2017
Common misconception about how Oracle handles deadlocks
Introduction
In today's blog post, I'd like to uncover a common misconception about how Oracle handles deadlocks, but first let's talk about what deadlock is. Deadlock is a locking scenario that occurs when two or more sessions are blocked as they wait because of a lock that is being held by the other session. Oracle Database automatically detects this scenario and handles this because otherwise, they will wait forever as both of them are blocked and waiting to each other’s locked resources. But the question is how does Oracle handle this? some would say that Oracle handles these scenarios by terminating one of the sessions which is known to be as the "deadlock victim" - well, that's wrong. Others would say that by rolling-back the entire transaction of one of the sessions - well, that's also wrong. So how Oracle really handles deadlock scenarios?Deadlock Illustration
Let's see a quick example of how deadlock occurs
Step 1
Session #1 performs an update of a row (employee #151) and acquires a lock on that row
SQL> UPDATE employee
SET first_name = 'David'
WHERE employee_id = 151;
1 row updated.
Step 2
Step 3
Step 4
Session #2 performs an update of a row (employee #39) and acquires a lock on that row
SQL> UPDATE employee
SET first_name = 'Greg'
WHERE employee_id = 39;
1 row updated.
Step 3
Session #1 performs an update of a row (employee #39) and is now waiting since a lock has been acquired on the same row which has not been released yet as session #2 transaction is still active
UPDATE employee
SET first_name = 'Mark'
WHERE employee_id = 39;
Session #2 performs an update of a row (employee #151) and is now waiting since a lock has been acquired on the same row which has not been released yet as session #1 transaction is still active.
SQL> UPDATE employee
SET first_name = 'John'
WHERE employee_id = 151;
At this stage both sessions (session #1 and session #2) are blocked and waiting to each other’s locked resources - that's exactly what deadlock is.
So how Oracle handles deadlock scenarios?
The way Oracle handles deadlock scenarios is not by terminating one of the sessions or performing a transaction-level rollback, it's actually just by performing a statement-level rollback to one of the sessions. The session that its statement is being rolled back, will encounter an “ORA-00060: Deadlock detected while waiting for resource.” error message (that will also be recorded in the alert log file).
Wednesday, March 29, 2017
Changes in AWR behavior in versions 12cR1 and 12cR2
Introduction
AWR reports are available as part of the Diagnostics pack (extra cost option to the Enterprise Edition). AWR reports are commonly used by Oracle DBAs and they can be extremely useful when diagnosing performance issues. In this short article I will show the differences between AWR in version 12c Release 1 (12.1) and 12c Release 2 (12.2)
12c Release 1 (12.1) with Multitenant
In Oracle 12c Release 1, Oracle introduced the Multitenant architecture (I've posted a separate article to cover the great benefits of Oracle Multitenant. Read more here). However, the main challenge with Oracle 12cR1 is that AWR data is stored at the CDB$ROOT container level. This has several implications:
- AWR reports are available only at CDB level - it is not possible to run AWR for a specific pluggable database.
- AWR management operations (e.g. snapshots schedule, data retention, taking manual snapshots, purging snapshots) could be done only at CDB level.
- Unplugged PDB does not contain AWR information, so when unplugging a PDB and plugging it into a different CDB all the AWR data will be lost.
Having said that, it's important to mention that even that it is only possible to generate AWR reports at CDB level, Oracle added column "PDB Name" to the tables in the AWR so it allows us to understand to which PDB the information is associated with. Here is an example:
12c Release 2 (12.2) with Multitenant
Good new is that in Oracle 12c Release 2, Oracle added AWR at PDB-Level meaning that AWR information will also be stored in each PDB (under SYSAUX tablespace). This has several implications:
- AWR reports are available at both CDB and PDB level
- AWR management operations (e.g. snapshots schedule, data retention, taking manual snapshots, purging snapshots) can be done at both CDB and PDB level
- Unplugged PDB does contain AWR information, so when unplugging a PDB and plugging it into a different CDB all the AWR data will be available.
Let's see an example of how it looks like when running AWR report in 12c Release 2:
As you can see, Oracle enables us to choose whether we would like to run a CDB-level AWR report by specifying "AWR_ROOT" which is the default, or running a PDB-level AWR report by specifying "AWR_PDB". If you choose PDB-level AWR, Oracle will generate a report that displays performance data only for a particular PDB, as follows:
Pro Tip
In Oracle 12c Release 2, Oracle will automatically create AWR snapshots only at CDB-level by default. If you would like to change this default behavior and enable automatic AWR snapshots for PDBs, you would need to alter the new AWR_PDB_AUTOFLUSH_ENABLED parameter which can be set at either CDB level or PDB level.
Wednesday, March 9, 2016
Oracle 12c Improved Column Addition
Introduction
In my "Oracle 12c Improved Defaults" article, I review the enhancements of column defaults in Oracle 12c."Oracle 12c Improved Column Addition" is a continuation article because it covers performance improvements for adding a new column with a default value to an existing table.
Before Oracle 11g
Prior to Oracle 11g, adding a new column with a default value to an existing table, requires updating all the rows in the table which is a very long and high consuming operation, especially if the table is big.
Oracle 11g
In Oracle 11g a new feature named "Metadata-only value" was introduced. This means that upon every new column addition with a default value, Oracle will not update every row in a table, but rather make a small metadata-only change in the data dictionary. As a result, every time that a user queries the table, Oracle will obtain the default value from the data dictionary. This feaure allows us to add a new column with a default value within milliseconds instead of waiting for a long time and generating lots of redo and undo which may impact the entire database.
In the following example, a table named "TEST" is being created and populated with 100,000 rows.
Afterwards, we will test the time it takes to add a new column with a default value:
Afterwards, we will test the time it takes to add a new column with a default value:
SQL> CREATE TABLE TEST (ID NUMBER);
Table created.
SQL>BEGIN
FOR i in 1 .. 100000 LOOP
EXECUTE IMMEDIATE 'INSERT INTO test VALUES (:i)' USING i;
END LOOP;
END;
/
PL/SQL PROCEDURE successfully completed.
SQL> COMMIT;
Commit complete.
SQL>set timing ON
SQL> ALTER TABLE test ADD string1 VARCHAR2(20) DEFAULT 'DUMMY TEXT' NOT NULL;
Table altered.
Elapsed: 00:00:00.10
As you can see in the above demonstration, the column addition operation completed instantly.However, this feature works only if the column was added with the NOT NULL constraint.
Let us see what will happen if we will try to add a nullable column with a default value (i.e. a column that doesn't have the NOT NULL constraint):
SQL> ALTER TABLE test ADD string2 VARCHAR2(20) DEFAULT 'DUMMY TEXT'; Table altered. Elapsed: 00:01:08.17Now, the operation took more than 1 minute! This table is only populated with 100K rows. Imagine how much time it would take if a table contains hundreds of millions of rows ...
Oracle 12c
In Oracle 12c, Oracle took the "metadata-only value" feature one step further.
Now, this feature is supports nullable column, as per the below demonstration:
As you can see, in Oracle 12c adding a column with a default value is an instant operation, regardless of the the nullable attribute.
Now, this feature is supports nullable column, as per the below demonstration:
SQL> ALTER TABLE test ADD string VARCHAR2(20) DEFAULT 'DUMMY TEXT'; Table altered. Elapsed: 00:00:00.06
Thursday, March 3, 2016
My article was published in the OTN!
Hi everyone,
I'm honored and grateful that my new article "Verifying I/O Activity Balance Across Disks in ASM" was published in the OTN.
The article describes Oracle Automatic Storage Management's mirroring and striping capabilities, focusing on how to identify unbalanced I/O operations.
Click here to read the full atricle: https://community.oracle.com/docs/DOC-995178
Tuesday, February 16, 2016
Creating Multiple Indexes on the same column or set of columns
Introduction
Oracle 11g Introduced a nice feature named "Invisible Indexes" which allows us to mark an index as invisible. This index will still be maintained by Oracle during DML operations like a "regular" index but it is being ignored by the optimizer, i.e. execution plans will not use the invisible indexes.
Oracle 12c leverages the "Invisible Indexes" feature by allowing us create multiple indexes on the same column or set of columns, as long as only one index is visible and all the indexes are different, i.e. it is impossible to create 2 B-Tree indexes on the same column, even if one of them is invisible.
Demonstration
For this demonstration, we will create a table of employees and populate it with 10 records:
SQL> CREATE TABLE EMP
2 (
3 id NUMBER,
4 name VARCHAR2 (20),
5 salary NUMBER,
6 hire_date DATE
8 );
Table created.
SQL> insert into EMP value values (1, 'DAVID', 8500, '07-APR-15');
1 row created.
SQL> insert into EMP value values (2, 'JOHN', 10000, '17-MAR-15');
1 row created.
SQL> insert into EMP value values (3, 'JANE', 13500, '23-DEC-15');
1 row created.
SQL> insert into EMP value values (4, 'DAN', 15000, '02-JAN-15');
1 row created.
SQL> insert into EMP value values (5, 'RACHEL', 19000, '20-FEB-15');
1 row created.
SQL> insert into EMP value values (6, 'BRAD', 20000, '25-JUN-15');
1 row created.
SQL> insert into EMP value values (7, 'TIM', 15000, '16-MAR-15');
1 row created.
SQL> insert into EMP value values (8, 'KELLY', 9000, '28-APR-15');
1 row created.
SQL> insert into EMP value values (9, 'NICK', 7500, '04-FEB-15');
1 row created.
SQL> insert into EMP value values (10, 'ERIK', 6000, '09-JUL-15');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from EMP;
ID NAME SALARY HIRE_DATE
---------- -------------------- ---------- ---------
1 DAVID 8500 07-APR-15
2 JOHN 10000 17-MAR-15
3 JANE 13500 23-DEC-15
4 DAN 15000 02-JAN-15
5 RACHEL 19000 20-FEB-15
6 BRAD 20000 25-JUN-15
7 TIM 15000 16-MAR-15
8 KELLY 9000 28-APR-15
9 NICK 7500 04-FEB-15
10 ERIK 6000 09-JUL-15
10 rows selected.
Now, we will create 2 different indexes on the "id" column, the first index will be a visible B-Tree index, and the second index will be an invisible Bitmap index:SQL> CREATE INDEX BTREE_IDX ON EMP (ID);
Index created.
SQL> CREATE BITMAP INDEX BITMAP_IDX ON EMP (ID);
CREATE BITMAP INDEX BITMAP_IDX ON EMP (ID)
*
ERROR at line 1:
ORA-01408: such column list already indexed
SQL> CREATE BITMAP INDEX BITMAP_IDX ON EMP (ID) INVISIBLE;
Index created.
The error in the second statement is expected, because the B-Tree index is visible and as previously mentioned, only one index can be visible at a time. Using USER_INDEXES dictionary view, it is possible to determine the current status of the indexes:select index_name, index_type, visibility from user_indexes where TABLE_NAME = 'EMP' INDEX_NAME INDEX_TYPE VISIBILIT ---------- --------------------------- --------- BTREE_IDX NORMAL VISIBLE BITMAP_IDX BITMAP INVISIBLEIf we want to test the performance of the SQL statements, or investigate the execution plans after switching between the indexes, it can be done very easily, as follows:
SQL> ALTER INDEX BTREE_IDX INVISIBLE; Index altered. SQL> ALTER INDEX BITMAP_IDX VISIBLE; Index altered. SQL> SELECT index_name, index_type, visibility FROM user_indexes WHERE TABLE_NAME = 'EMP'; INDEX_NAME INDEX_TYPE VISIBILIT ---------- --------------------------- --------- BTREE_IDX NORMAL INVISIBLE BITMAP_IDX BITMAP VISIBLE
Summary
In this article I have demonstrated a new 12c feature that allows create more than one index on a column or set of columns, assuming the indexes are from different types.
This can be useful when you want to test the impact of different indexes easily without dropping and creating a new index. However, it is important to bear in mind that additional indexes means additional overhead during DML operations. This additional overhead is necessary in order to maintain the indexes, therefore use this feature with cautious
Monday, December 14, 2015
Oracle Multiprocess and Multithreaded Architecture
Introduction
The Oracle process architecture of Windows operating system is a different process architecture comparing to Linux/Unix operating systems. On Windows, each Oracle instance has one single process that is multithreded, i.e. each background process is a thread within the single "father" process, therefore the "processes" tab in the the task manager will display only one "oracle.exe" process per each instance, as you can see in the following screenshot (taken from one of our Oracle environments):On Linux/Unix on the other hand, each background process is a different OS process so by looking for all the processes you should expect to get a long list of Oracle processes, as you can see the following screenshot (taken from one of our Oracle on Linux environments):
Oracle 12c Multiprocess and Multithreaded Architecture
By default, the pre-12c Oracle process architecture remains the same in Oracle 12c. However, in Oracle 12c you can enable the multithreaded architecture on Unix/Linux that will cause Oracle processes on Linux/Unix to run as threads - similar to the process architecture on Windows. In order to do so, simply set the THREADED_EXECUTION initialization parameter to TRUE (default value is FALSE). This is a static parameter (SCOPE=SPFILE), therefore requires restarting the instance in order for the changes to take effect.
Demonstration
First, I will connect to one of our 12c Oracle Linux environments and set the THREADED_EXECUTION to be TRUE:
SQL> alter system set THREADED_EXECUTION=true scope=spfile; System altered. SQL> shu immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup Total System Global Area 1073741824 bytes Fixed Size 2932632 bytes Variable Size 692060264 bytes Database Buffers 373293056 bytes Redo Buffers 5455872 bytes Database mounted. Database opened.
Now I will check how many Oracle processes I have on the Linux environment:
As you can see, now there are much less processes than before. Most of the background processes now run as threads instead of processes but some of them might still run as operating system processes (like the PMON and the DB Writer processes).
Important things to keep in mind
- OS authentication is not allowed with the multithreaded architecture. If you will try to connect via an OS authentication (for example, by connecting with "/ AS SYSDBA") you will encounter "ORA-01017: invalid username/password; logon denied", therefore you must use a password file for connecting with a SYSDBA/SYSOPER user.
- When the THREADED_EXECUTION parameter is set to TRUE, you must set the DEDICATED_THROUGH_BROKER_LISTENER parameter to ON in your listener.ora file. When that parameter is set, the listener knows that it should not spawn an OS process when a connect request is received, instead it passes the request to the database so that a database thread is spawned and answers the connection.
- In RAC environments all nodes must have the same value for the THREADED_EXECUTION parameter.
Summary
In this post I've reviewed the process architecture in Linux/Unix vs. Windows and demonstrated the new 12c Multithreaded option. This feature can be useful in order to reduce the number of OS processes in scenarios where you have many Oracle instances on the same machine which may cause a higher overhead as a result of a very high number of OS processes.
Useful Links
Sunday, November 15, 2015
12c New feature - Invisible Rows A.K.A In-Database Archiving
Introduction
In Oracle Database 12c (12.1.0.1 to be more specific) Oracle introduced a new feature named "In-Database Archiving" which allows to mark specific rows as invisible (archived) so they will not be visible. For example, if someone queries a table that is configured with this feature enabled then all the rows that are marked as archived will be invisible unless the session has enabled to see archived data. The rows that are archived can be compressed in order to reduce the storage of the database and also improve backup performance.So how does it work?
In order to configure a table with the In-Database Archiving feature enable, you will need to use the ROW ARCHIVAL clause during the CREATE TABLE command, or if the table already exists then you can use the ROW ARCHIVAL clause using the ALTER TABLE command.
Once you enable this feature, Oracle will create additional column named ORA_ARCHIVE_STATE. By default, this column contains the value '0' for each row which means that the row is visible. If you will change to value to be '1' then the row will be invisible. If you will disable this feature using the ALTER TABLE ... NO ARCHIVAL command then Oracle will automatically drop
this column.
this column.
Demonstration
In this demonstration I will perform the following steps:
- Create a new table named "test" and enable the ROW Archival feature for this table
- Populate the table with 2 rows
- Query the table including the ORA_ARCHIVE_STATE column to see that that the additional column contains only the default '0' values:
- Mark "David" as invisible by changing the ORA_ARCHIVE_STATE value to be '1'
- Query again the table to verify that "David" is actually invisible
- Allow the session to view the invisible data using the ALTER SESSION SET ROW ARCHIVAL VISIBILITY = ALL command
- Query again the table to verify that "David" is now visible
- Prohibit the session from viewing the invisible data using the ALTER SESSION SET ROW ARCHIVAL VISIBILITY = ACTIVE command
- Query again the table to verify that "David" is now invisible again
- Disable the In-Database Archiving feature for the table using the ALTER TABLE ... NO ARCHIVAL command
- Query the table to verify that the ORA_ARCHIVE_STATE column has been dropped
Useful Links:
Wednesday, November 4, 2015
Oracle Automatic Maintenance Tasks
Introduction
The Oracle automatic maintenance tasks were introduced in version 11g in order to automate tasks that Oracle DBAs used to do manually in the past (i.e. in earlier versions such as 9i, 10g).This includes the following predefined automated maintenance tasks:
- Automatic Optimizer Statistics Collection - Collecting optimizer statistics for objects with stale or missing statistics
- Automatics Segment Advisor - Collecting storage-related information for segments in order to provide Segment Recommendations on those segments
- Automatic SQL Tuning Advisor - Collecting performance-related information for SQL Statements in order to provide SQL Tuning recommendations
In Oracle 12c the following maintenance task has been added:
- SQL Plan Management (SPM) Evolve Advisor - Collecting information about SQL execution plans in order to automatically evolve execution plans as part of the SQL Plan Management feature
Demonstration
You can query DBA_AUTOTASK_OERATION in order to see all the automatic maintenance tasks along with their status (whether it's enabled or disabled):
You may ask yourself when these jobs are actually running?
The answer is during the Maintenance Windows
You can check the maintenance windows that are defined for each automatic task using DBA_AUTOTASK_WINDOW_CLIENTS
The above are 7 predefined maintenance windows that are enabled by default when you install Oracle. If you'd like to see more information for each window you can query DBA_SCHEDULER_WINDOWS and it will display the exact time and duration for each window as well as the associated resource plan. You can modify the maintanence window settings using the SET_ATTRIBUTE procedure of the DBMS_SCHEDULER package. Read more here.
Please note that during the time window Oracle will create a scheduler job for the automatic task and once the job is completed Oracle will drop it, so don't be surprised that you can find the jobs in DBA_SCHEDULER_JOBS. You can find historical automated tasks information using DBA_AUTOTASK_JOB_HISTORY below is an example:
You can manually disable (or enable) all the maintenance tasks using the DBMS_AUTO_TASK_ADMIN package, for example:
EXECUTE DBMS_AUTO_TASK_ADMIN.DISABLE;
You can also disable or enable a particular maintenance task. Following is an example of how to disable the sql tuning advisor maintenance task
BEGIN
dbms_auto_task_admin.disable(
client_name => 'sql tuning advisor',
operation => NULL,
window_name => NULL);
END;
/
If you want to disable to enable a particular maintenance task only for a particular maintenance window, you can use the "window_name" parameter. Following is an example of how to disable the sql tuning advisor maintenance task only for the SATURDAY_WINDOW:
BEGIN
dbms_auto_task_admin.disable(
client_name => 'sql tuning advisor',
operation => NULL,
window_name => 'SATURDAY_WINDOW');
END;
/
Please note that during the time window Oracle will create a scheduler job for the automatic task and once the job is completed Oracle will drop it, so don't be surprised that you can find the jobs in DBA_SCHEDULER_JOBS. You can find historical automated tasks information using DBA_AUTOTASK_JOB_HISTORY below is an example:
You can manually disable (or enable) all the maintenance tasks using the DBMS_AUTO_TASK_ADMIN package, for example:
EXECUTE DBMS_AUTO_TASK_ADMIN.DISABLE;
You can also disable or enable a particular maintenance task. Following is an example of how to disable the sql tuning advisor maintenance task
BEGIN
dbms_auto_task_admin.disable(
client_name => 'sql tuning advisor',
operation => NULL,
window_name => NULL);
END;
/
If you want to disable to enable a particular maintenance task only for a particular maintenance window, you can use the "window_name" parameter. Following is an example of how to disable the sql tuning advisor maintenance task only for the SATURDAY_WINDOW:
BEGIN
dbms_auto_task_admin.disable(
client_name => 'sql tuning advisor',
operation => NULL,
window_name => 'SATURDAY_WINDOW');
END;
/
Summary
The goal of this post was to shed light on the automatic maintenance tasks feature which is very useful but you need to aware of its behavior. In this post, I've covered the following items:
- Pre-defined automatic maintenance tasks in 11g & 12c
- Maintanence windows and how to determine their start time and duration
- Viewing historical automated tasks information (time, status, etc.)
- Disabling/enabling automated tasks
Thursday, September 3, 2015
Simple Performance Tuning Methodology
In this post I'd like to show a simple methodology for performance tuning using Wait-Event Analysis.
Logically, the process is very simple:
So how can you measure the top non-idle wait events in the database?
There are severl moethods:
Oracle Dynamic Views:
Logically, the process is very simple:
- Determine the most significant bottleneck
- Improve/Fix it
- Repeat it until the performance is good enough
The question is, how can we find the most significant bottleneck for a specific session or for a specific SQL, or even for the entire instance?
Basically, as process in Oracle can be in one of the following states:
- Consuming CPU - which is usually fine and useful
- Non-Idle Wait event - Waiting for something (lock, latch, I/O)
- For example: whenever a process is reading multi blocks in a single I/O operation (usually in cases of a Full Table Scan or Index Fast Full Scan), Oracle will report on a "db file scattered read" wait event
- In order to get a list of all the Non-Idle wait events, execute the following query:
FROM v$event_name
WHERE wait_class <> 'Idle'
- Idle Wait Event - Doesn't do anything, indication that the user session is inactive.
- For example: whenever a server process is waiting for the user client to do something, Oracle will report on a "SQL*Net message from client"
- In order to get a list of all the Idle wait events, execute the following query:
SELECT name
FROM v$event_name
WHERE wait_class = 'Idle'
Note: when a process is waiting for something it can also consume CPU, for example, in some cases of latch contentions, there will also be a high CPU consumption (due to the latch spinning).
So how can you measure the top non-idle wait events in the database?
There are severl moethods:
Oracle Dynamic Views:
- V$SYSTEM_EVENT - Provides information on all the wait-events which occured in the instance since-startup. You can get all the non-idle wait events, ordered by the time (in seconds) using the following query:
SELECT event, time_waited / 100 "Seconds Waited"
FROM v$system_event
WHERE wait_class <> 'Idle'
ORDER BY 2 DESC
- V$SESSION_EVENT - Provides information on all the wait-events which occudes in a specific session (relevant only for connected sessions, not historical sessions). You can get all the non-idle wait events for a specific session, ordered by the time (in seconds) using the following query:
SELECT event, time_waited / 100 "Seconds Waited"
FROM v$session_event
WHERE wait_class <> 'Idle' AND SID = <SID>
ORDER BY
2 DESC
The AWR report also holds lots wait-events related information. However, usually the "Top 5 Timed Foreground Events" section in the beginning of the report will provide most of the important information. Following is a screenshot of this section in one of our Oracle instances:
So how can you measure the overall performance?
The answer is, "DB Time" - a statistic which represents the total amount of time that Oracle spent during CPU processing and waiting for non-idle wait events.
DB Time = CPU Time + Non Idle wait-events
Notes:
Oracle Dynamic Views:
AWR:
Obviously, the AWR report also hold information about the DB Time.
In the beginning of the report there's a summary of the DB Time for the AWR report duarion:
As you can see, this AWR report is based on a 2 snapshots which their distance is 1 hour - the first snapshot is taken at 13:00, and the second snapshot is taken at 16:00, therefore the value of "Elapsed" is 1 hour. You may now ask yourself, how is it possible that the value of DB time (3 hours) was higher than the enitre duration of the report (which is 1 hour). Is it possible that during a 1-hour period, Oracle spent 3 hours on cpu and non-idle wait events?!
The answer is: absolutely!
Since the DB Time equals to the total amount of CPU time + non-idle wait events, so in machines where you have more than 1 CPU core (in this particular example there are 4 CPU cores), the DB Tme can definitely be higher than the Elapsed Time.
For example:
If during a 10 second-period, all the 4 CPU cores were fully utilized, then the DB Time value will be 40 for those 10 second-period.
After we determined the most significant Wait-Events, i.e. those which impact the database mostly, how can we reduce the wait time or even totally avoid them?
The answer is that it mainly depends on your experience with performance tuning.
There are over 1000 wait-events in Oracle but the good news are the eventually there's a limited number of common wait events, and this number is much smaller than 1000, so eventually, you will be familiar with most of the common wait-events, and you'll know which actions you should take in order to solved them.
If you're encountering performance issues that are related to a specific wait-event which you are not familiar with, you can always ask our best friend, google :)
Why use Performance Dianostics tools?
Some tools can make our life easier by visualizing the workload of the instance.
Some tools can even display the workload filtered by a specific dimension or a combination of dimensions (e.g. SQL Statment, User, Program, Machine, PDB, Session, etc.).
Having the ability to filter the workload for a set of combinations allows performing advanced performance diagnostics research.
For example: viewing all the wait-events and statistics for all the SQL Statements that were executed by user HR using TOAD under PDB (Pluggable Database) PROD.
OEM ASH Analytics was introduced in OEM 12c and it allows you to perform OLAP operations on the database dimensions which makes the performance tuning process much simpler and faster.
Please note that in order to benefit this feature you must have the Enterprise Edition and also the tuning and diagnostics packs.
Foglight for Oracle also provides the ability to view a list of all the dimensions and drill-down to any combination of dimensions, as you can see in the below screenshot:

Foglight for Oracle comes with a full dimension stack:

Here is an example of how easily you can drill-down to all the SQL Statements that were executed from TOAD by the user SALES:
Conclusions:
So how can you measure the overall performance?
The answer is, "DB Time" - a statistic which represents the total amount of time that Oracle spent during CPU processing and waiting for non-idle wait events.
DB Time = CPU Time + Non Idle wait-events
Notes:
- DB Time doesn't take into account background sessions. It takes into account foreground sessions only.
- It doesn't take into account idle wait-events.
The DB Time could also be measured in a several ways:
Oracle Dynamic Views:
- V$SYSSTAT - Displays instance-level statistics. You can view the value of the DB Time (since instance startup), using the following query:
FROM v$sysstat
WHERE name = 'DB time'
- V$SESSTAT - Displays session-level statistics. You can view the value of the DB Time for a specific session (connected session only), using the following query:
SELECT value
FROM v$sesstat JOIN v$statname USING (statistic#)
WHERE name = 'DB time' AND sid= <SID>
AWR:
Obviously, the AWR report also hold information about the DB Time.
In the beginning of the report there's a summary of the DB Time for the AWR report duarion:
As you can see, this AWR report is based on a 2 snapshots which their distance is 1 hour - the first snapshot is taken at 13:00, and the second snapshot is taken at 16:00, therefore the value of "Elapsed" is 1 hour. You may now ask yourself, how is it possible that the value of DB time (3 hours) was higher than the enitre duration of the report (which is 1 hour). Is it possible that during a 1-hour period, Oracle spent 3 hours on cpu and non-idle wait events?!
The answer is: absolutely!
Since the DB Time equals to the total amount of CPU time + non-idle wait events, so in machines where you have more than 1 CPU core (in this particular example there are 4 CPU cores), the DB Tme can definitely be higher than the Elapsed Time.
For example:
If during a 10 second-period, all the 4 CPU cores were fully utilized, then the DB Time value will be 40 for those 10 second-period.
After we determined the most significant Wait-Events, i.e. those which impact the database mostly, how can we reduce the wait time or even totally avoid them?
The answer is that it mainly depends on your experience with performance tuning.
There are over 1000 wait-events in Oracle but the good news are the eventually there's a limited number of common wait events, and this number is much smaller than 1000, so eventually, you will be familiar with most of the common wait-events, and you'll know which actions you should take in order to solved them.
If you're encountering performance issues that are related to a specific wait-event which you are not familiar with, you can always ask our best friend, google :)
Why use Performance Dianostics tools?
Some tools can make our life easier by visualizing the workload of the instance.
Some tools can even display the workload filtered by a specific dimension or a combination of dimensions (e.g. SQL Statment, User, Program, Machine, PDB, Session, etc.).
Having the ability to filter the workload for a set of combinations allows performing advanced performance diagnostics research.
For example: viewing all the wait-events and statistics for all the SQL Statements that were executed by user HR using TOAD under PDB (Pluggable Database) PROD.
OEM ASH Analytics was introduced in OEM 12c and it allows you to perform OLAP operations on the database dimensions which makes the performance tuning process much simpler and faster.
Please note that in order to benefit this feature you must have the Enterprise Edition and also the tuning and diagnostics packs.
Foglight for Oracle also provides the ability to view a list of all the dimensions and drill-down to any combination of dimensions, as you can see in the below screenshot:

Foglight for Oracle comes with a full dimension stack:

Here is an example of how easily you can drill-down to all the SQL Statements that were executed from TOAD by the user SALES:
Conclusions:
- DB Time is an important measurement which represents the total CPU + Non-Idle wait events of foreground sessions.
- When a DBA wants to improve the performance, the best approach is to focus on the major/top wait-events and reduce/fix them in order to reduce the total DB time until the performance will be good enough.
- Some tools (Oracle Enterprise Manager, Dell Foglight) allow visualizing the workload of the entire instance or the activity of a specific dimension/set of dimensions. This can reduce dramatically(!) the time it takes for the DBA identifying and solving these issues.
Subscribe to:
Posts (Atom)














