• Save
Sydney Oracle Meetup - execution plans
Upcoming SlideShare
Loading in...5
×
 

Sydney Oracle Meetup - execution plans

on

  • 1,067 views

 

Statistics

Views

Total Views
1,067
Views on SlideShare
1,065
Embed Views
2

Actions

Likes
0
Downloads
0
Comments
0

1 Embed 2

http://www.linkedin.com 2

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Installation, configuration, upgrading of Oracle server software and related products eg upgrade of PSSPRODs to 10g, install and configure 11g ETPP, ETOP, STTM databases Design / Validate DB backup and recovery procedures including HA, DR eg NETS, GETS, PSSPROD, NETSREPP, MTMs, ETOP with Data guard Performance monitoring eg NETS Contract queue, load profile Application / business processes monitoring eg OEM monitor: NEMMCO feeds, charge run Implement database security eg accounts creation, user access privileges, security auditing total over 1000 accounts, monitor unsuccessful login to database, review user privileges Capacity Planning monitor/trend table size, identify tables for archiving, data purge, periodic table rebuilds to reduce database size Troubleshoot application problems interface to Oracle databases work with developers to identify performance bottleneck in QLDNOMS application, Gas charge run Database upgrades and patching PSSPROD 10g upgrade, 11g upgrade
  • Installation, configuration, upgrading of Oracle server software and related products eg upgrade of PSSPRODs to 10g, install and configure 11g ETPP, ETOP, STTM databases Design / Validate DB backup and recovery procedures including HA, DR eg NETS, GETS, PSSPROD, NETSREPP, MTMs, ETOP with Data guard Performance monitoring eg NETS Contract queue, load profile Application / business processes monitoring eg OEM monitor: NEMMCO feeds, charge run Implement database security eg accounts creation, user access privileges, security auditing total over 1000 accounts, monitor unsuccessful login to database, review user privileges Capacity Planning monitor/trend table size, identify tables for archiving, data purge, periodic table rebuilds to reduce database size Troubleshoot application problems interface to Oracle databases work with developers to identify performance bottleneck in QLDNOMS application, Gas charge run Database upgrades and patching PSSPROD 10g upgrade, 11g upgrade
  • Installation, configuration, upgrading of Oracle server software and related products eg upgrade of PSSPRODs to 10g, install and configure 11g ETPP, ETOP, STTM databases Design / Validate DB backup and recovery procedures including HA, DR eg NETS, GETS, PSSPROD, NETSREPP, MTMs, ETOP with Data guard Performance monitoring eg NETS Contract queue, load profile Application / business processes monitoring eg OEM monitor: NEMMCO feeds, charge run Implement database security eg accounts creation, user access privileges, security auditing total over 1000 accounts, monitor unsuccessful login to database, review user privileges Capacity Planning monitor/trend table size, identify tables for archiving, data purge, periodic table rebuilds to reduce database size Troubleshoot application problems interface to Oracle databases work with developers to identify performance bottleneck in QLDNOMS application, Gas charge run Database upgrades and patching PSSPROD 10g upgrade, 11g upgrade
  • Installation, configuration, upgrading of Oracle server software and related products eg upgrade of PSSPRODs to 10g, install and configure 11g ETPP, ETOP, STTM databases Design / Validate DB backup and recovery procedures including HA, DR eg NETS, GETS, PSSPROD, NETSREPP, MTMs, ETOP with Data guard Performance monitoring eg NETS Contract queue, load profile Application / business processes monitoring eg OEM monitor: NEMMCO feeds, charge run Implement database security eg accounts creation, user access privileges, security auditing total over 1000 accounts, monitor unsuccessful login to database, review user privileges Capacity Planning monitor/trend table size, identify tables for archiving, data purge, periodic table rebuilds to reduce database size Troubleshoot application problems interface to Oracle databases work with developers to identify performance bottleneck in QLDNOMS application, Gas charge run Database upgrades and patching PSSPROD 10g upgrade, 11g upgrade
  • Installation, configuration, upgrading of Oracle server software and related products eg upgrade of PSSPRODs to 10g, install and configure 11g ETPP, ETOP, STTM databases Design / Validate DB backup and recovery procedures including HA, DR eg NETS, GETS, PSSPROD, NETSREPP, MTMs, ETOP with Data guard Performance monitoring eg NETS Contract queue, load profile Application / business processes monitoring eg OEM monitor: NEMMCO feeds, charge run Implement database security eg accounts creation, user access privileges, security auditing total over 1000 accounts, monitor unsuccessful login to database, review user privileges Capacity Planning monitor/trend table size, identify tables for archiving, data purge, periodic table rebuilds to reduce database size Troubleshoot application problems interface to Oracle databases work with developers to identify performance bottleneck in QLDNOMS application, Gas charge run Database upgrades and patching PSSPROD 10g upgrade, 11g upgrade
  • Installation, configuration, upgrading of Oracle server software and related products eg upgrade of PSSPRODs to 10g, install and configure 11g ETPP, ETOP, STTM databases Design / Validate DB backup and recovery procedures including HA, DR eg NETS, GETS, PSSPROD, NETSREPP, MTMs, ETOP with Data guard Performance monitoring eg NETS Contract queue, load profile Application / business processes monitoring eg OEM monitor: NEMMCO feeds, charge run Implement database security eg accounts creation, user access privileges, security auditing total over 1000 accounts, monitor unsuccessful login to database, review user privileges Capacity Planning monitor/trend table size, identify tables for archiving, data purge, periodic table rebuilds to reduce database size Troubleshoot application problems interface to Oracle databases work with developers to identify performance bottleneck in QLDNOMS application, Gas charge run Database upgrades and patching PSSPROD 10g upgrade, 11g upgrade
  • Installation, configuration, upgrading of Oracle server software and related products eg upgrade of PSSPRODs to 10g, install and configure 11g ETPP, ETOP, STTM databases Design / Validate DB backup and recovery procedures including HA, DR eg NETS, GETS, PSSPROD, NETSREPP, MTMs, ETOP with Data guard Performance monitoring eg NETS Contract queue, load profile Application / business processes monitoring eg OEM monitor: NEMMCO feeds, charge run Implement database security eg accounts creation, user access privileges, security auditing total over 1000 accounts, monitor unsuccessful login to database, review user privileges Capacity Planning monitor/trend table size, identify tables for archiving, data purge, periodic table rebuilds to reduce database size Troubleshoot application problems interface to Oracle databases work with developers to identify performance bottleneck in QLDNOMS application, Gas charge run Database upgrades and patching PSSPROD 10g upgrade, 11g upgrade
  • Installation, configuration, upgrading of Oracle server software and related products eg upgrade of PSSPRODs to 10g, install and configure 11g ETPP, ETOP, STTM databases Design / Validate DB backup and recovery procedures including HA, DR eg NETS, GETS, PSSPROD, NETSREPP, MTMs, ETOP with Data guard Performance monitoring eg NETS Contract queue, load profile Application / business processes monitoring eg OEM monitor: NEMMCO feeds, charge run Implement database security eg accounts creation, user access privileges, security auditing total over 1000 accounts, monitor unsuccessful login to database, review user privileges Capacity Planning monitor/trend table size, identify tables for archiving, data purge, periodic table rebuilds to reduce database size Troubleshoot application problems interface to Oracle databases work with developers to identify performance bottleneck in QLDNOMS application, Gas charge run Database upgrades and patching PSSPROD 10g upgrade, 11g upgrade
  • Installation, configuration, upgrading of Oracle server software and related products eg upgrade of PSSPRODs to 10g, install and configure 11g ETPP, ETOP, STTM databases Design / Validate DB backup and recovery procedures including HA, DR eg NETS, GETS, PSSPROD, NETSREPP, MTMs, ETOP with Data guard Performance monitoring eg NETS Contract queue, load profile Application / business processes monitoring eg OEM monitor: NEMMCO feeds, charge run Implement database security eg accounts creation, user access privileges, security auditing total over 1000 accounts, monitor unsuccessful login to database, review user privileges Capacity Planning monitor/trend table size, identify tables for archiving, data purge, periodic table rebuilds to reduce database size Troubleshoot application problems interface to Oracle databases work with developers to identify performance bottleneck in QLDNOMS application, Gas charge run Database upgrades and patching PSSPROD 10g upgrade, 11g upgrade
  • Installation, configuration, upgrading of Oracle server software and related products eg upgrade of PSSPRODs to 10g, install and configure 11g ETPP, ETOP, STTM databases Design / Validate DB backup and recovery procedures including HA, DR eg NETS, GETS, PSSPROD, NETSREPP, MTMs, ETOP with Data guard Performance monitoring eg NETS Contract queue, load profile Application / business processes monitoring eg OEM monitor: NEMMCO feeds, charge run Implement database security eg accounts creation, user access privileges, security auditing total over 1000 accounts, monitor unsuccessful login to database, review user privileges Capacity Planning monitor/trend table size, identify tables for archiving, data purge, periodic table rebuilds to reduce database size Troubleshoot application problems interface to Oracle databases work with developers to identify performance bottleneck in QLDNOMS application, Gas charge run Database upgrades and patching PSSPROD 10g upgrade, 11g upgrade

Sydney Oracle Meetup - execution plans Sydney Oracle Meetup - execution plans Presentation Transcript

  • Sydney Oracle Meetup – execution plans
    • Paul Guerin
    • Bachelor of Engineering (Computer)
    • Oracle DBA Certified Professional
    • DBA 10+ years
    • Employers: Origin Energy, Bluescope Steel, BHP Billiton
  • Execution plans
    • Typical responses to poor performance:
      • "We need to buy faster hardware!!!"
      • "Someone has been dropping indexes!!!"
      • "We need to gather stats on the whole database every 5 minutes!!!"
      • "Lets create more materialised views!!!“
      • "We develop the application for optimal performance!!!"
    • Inefficient execution plans lead to poor performance and poor scalability....
        • "What is an execution plan?“
  • Execution plans
    • Determine the session and cursor
      • v$session, v$sql: hash_value, address, child_number (9i)
      • sql_id, child_number (11g)
    • Session activity gives clues to what is in the execution plan…
      • v$session_event: db file sequential read, db file scattered read
      • v$session_wait:
      • v$session_longops: Table Scan
  • Execution plans
    • Predicted execution plan
      • Note: Explain plan assumes that bind variables are of type varchar.
      • -- No statement execution, displays predicted plan only
      • EXPLAIN PLAN FOR <statement>;
      • SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
      • -- Executes but hides the result set, displays predicted plan
      • -- Also shows execution stats (eg db block gets, consistent gets)
      • SET AUTOTRACE TRACEONLY
      • <statement>;
      • SET AUTOTRACE OFF
  • Execution plans
    • Actual execution plan (9i)
      • truncate table plan_table;
      • -- Following is equivalent to EXPLAIN PLAN FOR <statement>
      • insert into plan_table (statement_id, timestamp, OPERATION, OPTIONS, OBJECT_NODE, OBJECT_OWNER, OBJECT_NAME, OPTIMIZER, ID, PARENT_ID, POSITION, SEARCH_COLUMNS, COST, CARDINALITY, BYTES, OTHER_TAG, PARTITION_START, PARTITION_STOP, PARTITION_ID, OTHER, DISTRIBUTION, CPU_COST, IO_COST, TEMP_SPACE, ACCESS_PREDICATES, FILTER_PREDICATES)
      • select 0, sysdate, OPERATION, OPTIONS, OBJECT_NODE, OBJECT_OWNER, OBJECT_NAME, OPTIMIZER, ID, PARENT_ID, POSITION, SEARCH_COLUMNS, COST, CARDINALITY, BYTES,
      • OTHER_TAG, PARTITION_START, PARTITION_STOP, PARTITION_ID, OTHER, DISTRIBUTION, CPU_COST, IO_COST, TEMP_SPACE, ACCESS_PREDICATES, FILTER_PREDICATES
      • from v$sql_plan
      • where hash_value=&hsh and address='&add' and child_number=&chld;
      • -- Displays the actual plan instead of the predicted plan
      • select * from table(dbms_xplan.display);
  • Execution plans
    • Actual execution plan (11g)
      • -- execution plan for last cursor of session
      • SELECT * FROM table(DBMS_XPLAN.DISPLAY_CURSOR);
      • -- execution plan for a cached cursor (need sql_id + child_number from v$sql)
      • SELECT * FROM table(DBMS_XPLAN.DISPLAY_CURSOR('<sql_id>',<child#>));
      • -- execution plan for an AWR cursor (need sql_id from DBA_HIST_SQLTEXT)
      • SELECT * FROM table(DBMS_XPLAN.DISPLAY_AWR('<sql_id>'));
      • -- Plan related dynamic views
      • V$SQL_PLAN
      • V$SQL_PLAN_MONITOR Plan level monitoring statistics.
      • V$SQL_BIND_CAPTURE Bind variables used for a cursor.
      • V$SQL_BIND_DATA As above, except for current session.
  • Execution plans
      • Actual execution plan from trace file
      • Trace your own session to obtain the SQL, bind variables, and actual execution plan:
      • SHO PARAMETER user_dump_dest; /* determine where the trace file will be */
      • ALTER SESSION SET statistics_level=all; /* show row counts */
      • -- level 1 trace
      • ALTER SESSION SET SQL_TRACE = TRUE;
      • -- level 12 trace
      • ALTER SESSION SET events '10046 trace name context forever, level 12';
      • ALTER SESSION SET tracefile_identifier='DBAtrace';
      • <statements>;
      • EXIT
  • Execution plans
      • Also trace other sessions:
      • -- 9i level 12 trace
      • -- Use a serial# of 0 for the current transaction
      • EXEC dbms_support.start_trace_in_session(<sessID>, <serial#>, waits=>true, binds=>true);
      • EXEC dbms_support.stop_trace_in_session(<sessID>, <serial#>);
      • -- 10/11g level 12 trace
      • -- Use a serial# of 0 for the current transaction
      • EXEC dbms_monitor.session_trace_enable(session_id=> <sessID>, serial_num=> <serial#>, waits=>true, binds=>true);
      • EXEC dbms_monitor.session_trace_disable(session_id=> <sessID>, serial_num=> <serial#>);
  • Execution plans
    • The trace file can capture bind information:
      • PARSING IN CURSOR #12 …
      • … where obj#= :1 and name=:2 and value=:3
      • BINDS #12:
      • bind 0: …
        • value=0
      • bind 1: …
        • value=&quot;COLTYPE$“
      • bind 2: …
        • value=1
      • Use TKPROF to aggregate and summarise the trace file:
      • $ TKPROF <tracefile> <outputfile> sort=prscpu,execpu,fchcpu
  • Execution plans
    • 11g features:
        • DBMS_SQLTUNE.REPORT_SQL_MONITOR();
          • Create a report that can include explain plan and binds.
        • SQL Plan Baselines
          • Storage of past plans that are considered efficient.