Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

Free Oracle Tips

HTML Text

 Home
 E-mail Us
 Oracle Articles


 Oracle Training
 Oracle News

 Oracle Forum
 Class Catalog


 Our Staff
 Our Prices
 Help Wanted!

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 UNIX
 Oracle UNIX
 Linux
 Oracle Linux
 Monitoring
 Remote help

 Remote plans
 Remote
services
 Oracle C++
 Oracle Java
 Apache
 JDeveloper
 App Server

 Applications
 Oracle Forms
 Oracle Portal
 11i Upgrades
 SQL Server
 Oracle Concepts
 HTML-DB Tips
 Software Help

 Remote Help  
 Development  

 Implementation


 Financials Training
 Oracle 11i
 Oracle Apps 11i
 Oracle Workflow
 Oracle AR 11i Class
 Oracle AP 11i class
 Oracle GL 11i class
 Oracle HR 11i class
 Oracle FA 11i class
 11i Project Mgt
 11i procurement
 11i collections


 Oracle Posters
 Oracle Books

 Oracle Tuning Book
 Oracle RAC Book
 Oracle Security
 Easy Oracle Books
 Oracle Scripts
 SQL Server DBA
 SQL Design Patterns
 Ion
 Excel-DB   


 BC Oracle News


 Rednecks!
 Dress code
 Arabian Stallion

 Burleson Arabians
 Guide Horses
 Don Burleson Blog
 Golf & Travel


 Privacy Policy
 

 

 
 

How to capture a SQL workload in 11g

Oracle Tips by Burleson Consulting
March 3, 2008

 

Staring with Oracle 10g, Oracle introduced database replay  where you can avoid using artificial test data by grabbing real-world workloads.  This allows the DBA more flexibility than ever before, and increases the validity of pre-production testing.

Workload-based optimization is an important part of global SQL optimization, and Oracle codified the "holistic" approach to Oracle tuning, most directly in the 11g SQL Performance Analyzer, called "SPA".  See these related notes on workload-based testing:

 

Workload management is a major new approach for Oracle, away from contrived test cases, and into testing with empirical, real-world workloads. 

Capturing a workload

First, see 11g SQL Performance Analyzer tips for a detailed discussion of capturing a SQL tuning set.  Ahmed Baraka notes these steps in capturing a SQL workload in 11g:

Preparing for Capturing Workload

Before you capture the workload, perform the following steps:

1. Backup database data that you want to test. Use either RMAN, user-managed online backup, Data Pump utilities or a snapshot standby. Output files of this backup will be used for the replay process.

2. Any transaction that is underway when you start capturing the workload may not be captured. If you want to capture all transactions, you can restart the database in restricted mode, start the capture process, then open the database for users.

3. Create directory object for storing captured workload.

Create directory WORKLOAD_DIR as 'C:\Oracle\admin\ora11g\workload';

4. Decide whether some of the user sessions should not be captured. You may not need to capture DBA sessions, Oracle Enterprise Manager sessions or any sessions created by third party sessions. To achieve this task, use DBMS_WORKLOAD_CAPTURE package as in the following guidelines:

a. Use ADD_FILTER procedure to add any eliminating sessions based on USER, MODULE, ACTION, PROGRAM, SERVICE or INSTANCE_NUMBER:

BEGIN

DBMS_WORKLOAD_CAPTURE.ADD_FILTER(

FNAME => 'FILTER_DBA1',

FATTRIBUTE => 'USER',

FVALUE => 'SYSTEM,DBSNMP' );

END;

b. Use DELETE_FILTER procedure to delete any existing filter:

EXEC DBMS_WORKLOAD_CAPTURE.DELETE_FILTER( FNAME => 'FILTER_DBA1');

Capturing Workload

Use START_CAPTURE procedure in DBMS_WORKLOAD_CAPTURE package to start capturing the workload:

BEGIN

DBMS_WORKLOAD_CAPTURE.START_CAPTURE(

NAME => '1JAN_WORKLOAD',

DIR => 'WORKLOAD_DIR',

DURATION => 40); -- duration in minutes

END;

To stop the capture process before ending of duration period, issue the following command:

BEGIN

DBMS_WORKLOAD_CAPTURE.FINISH_CAPTURE;

END;

After capture process finishes, you can issue query about workload captures using the following command:

SELECT ID, NAME, STATUS, ERROR_MESSAGE FROM DBA_WORKLOAD_CAPTURES;

You can generate a report about the workload capture you have made:

DECLARE

v_capture_id number;

v_capture_rpt clob;

BEGIN

v_capture_id := DBMS_WORKLOAD_CAPTURE.GET_CAPTURE_INFO(DIR => 'WORKLOAD_DIR');

v_capture_rpt := DBMS_WORKLOAD_CAPTURE.REPORT( CAPTURE_ID => v_capture_id , FORMAT => DBMS_WORKLOAD_CAPTURE.TYPE_TEXT); -- format could also be TYPE_HTML

-- display contents of v_capture

END;

Alternatively, you can use the following statements:

SELECT id, name, status FROM DBA_WORKLOAD_CAPTURES؛

SELECT DBMS_WORKLOAD_CAPTURE.REPORT(1, 'HTML') FROM DUAL;

If you want to delete from its data dictionary views, used the procedure DELETE_CAPTURE_INFO. However, this procedure does not delete the workload capture files in its directory. If you want to take a new workload capture with the same name, you should manually get rid of its files otherwise an error will be returned when you execute START_CAPTURE procedure.


See my related notes on Oracle workload techniques:

 

 

If you like Oracle tuning, you might enjoy my book "Oracle Tuning: The Definitive Reference", with 950 pages of tuning tips and scripts. 

You can buy it direct from the publisher for 30%-off and get instant access to the code depot of Oracle tuning scripts.


 

 

  
 

 Oracle cruise
 
 
 
Oracle performance tuning software
 
 

Oracle performance tuning book

 

 
 
 
Oracle performance Tuning 10g reference poster
 
 
 
Oracle training in Linux commands
 
Oracle training Excel
 
Oracle training & performance tuning books
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  and include the URL for the page.
 
 


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

 

Remote DBA Services


 

Copyright © 1996 -  2009 by Burleson Enterprises, Inc. All rights reserved.

Oracle © is the registered trademark of Oracle Corporation.