this is a blank slide for equipment testing · 2019. 12. 9. · tmmdv undo for autoextend undo...

64
This is a blank slide for equipment testing

Upload: others

Post on 06-Feb-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

  • This is a blank slide for equipment testing

  • Timur Akhmadeev

    December 2019

    Defaults

    Bloody Defaults

  • tmmdv

    About Me (Short)

    Apps DBA now

    Developer long time ago

  • tmmdv

    About Me (Long) Dev => Perf => DBA => Apps DBA Apps Database Consultant at Pythian

    14+ years with Database and Java

    Started with Oracle DB 9.2.0.1

    Oracle DB 7.3.4 experience

    Systems Performance and Architecture

    OakTable member

    timurakhmadeev.wordpress.com

    pythian.com/blog/author/akhmadeev

    twitter.com/tmmdv

    [email protected]

    http://www.timurakhmadeev.wordpress.com/http://pythian.com/blog/author/akhmadeevhttp://pythian.com/blog/author/akhmadeevhttp://www.twitter.com/tmmdvhttp://www.twitter.com/tmmdvmailto:[email protected]

  • ABOUT PYTHIAN

    Pythian’s 400+ IT professionals

    help companies adopt and

    manage disruptive technologies

    to better compete

  • tmmdv

    Planning a trip to Moscow and have a

    presentation to share?

    Let me know!

    We’ll organize a meetup!

  • tmmdv

    Database Default

    Parameters

    Setup

    Behavior

    which are questionable

  • tmmdv

    CONTROL_MANAGEMENT_PACK_ACCESS

    DIAGNOSTIC+TUNING

  • tmmdv

    DIAGNOSTIC+TUNING

    NONE

    CONTROL_MANAGEMENT_PACK_ACCESS

  • tmmdv

    8192

    _CURSOR_OBSOLETE_THRESHOLD

  • tmmdv

    8192 1024

    _CURSOR_OBSOLETE_THRESHOLD

  • tmmdv

    NONE

    FILESYSTEMIO_OPTIONS

  • tmmdv

    NONE SETALL

    FILESYSTEMIO_OPTIONS

  • tmmdv

    4000

    JOB_QUEUE_PROCESSES

  • tmmdv

    4000 CPU_COUNT/2

    JOB_QUEUE_PROCESSES

  • tmmdv

    Out of the Box Jobs

    auto space advisor

  • tmmdv

    Out of the Box Jobs

    auto sql tuning advisor

  • tmmdv

    Out of the Box Jobs

    statistics advisor

  • tmmdv

    FALSE

    OPTIMIZER_ADAPTIVE_STATISTICS

  • tmmdv

    FALSE FALSE

    OPTIMIZER_ADAPTIVE_STATISTICS

  • tmmdv

    a very big number

    PARALLEL_MAX_SERVERS

  • tmmdv

    a very big number CPU_COUNT

    PARALLEL_MAX_SERVERS

  • tmmdv

    PARALLEL_FORCE_LOCAL

    FALSE

  • tmmdv

    PARALLEL_FORCE_LOCAL

    FALSE TRUE

  • tmmdv

    PARALLEL_THREADS_PER_CPU

    2

  • tmmdv

    PARALLEL_THREADS_PER_CPU

    2 (1 in 19c) 1

  • tmmdv

    index dop after create/rebuild

    ALTER INDEX T1_I1 REBUILD PARALLEL 8; -- really want to avoid doing this

    ALTER INDEX T1_I1 NOPARALLEL;

  • tmmdv

    PGA_AGGREGATE_LIMIT

    2*PGA_AGGREGATE_TARGET

  • tmmdv

    PGA_AGGREGATE_LIMIT

    2*PGA_AGGREGATE_TARGET 2*PGA_AGGREGATE_TARGET

  • tmmdv

    RESUMABLE_TIMEOUT

    0

  • tmmdv

    RESUMABLE_TIMEOUT

    SQL> update t set x='asdf'; ORA-XXXXX: USERS tbs is out of space, waiting for N seconds before failing

  • tmmdv

    RESUMABLE_TIMEOUT

    Too expensive to turn on by default:

    https://jonathanlewis.wordpress.com/2019/10/07/resumable/

    https://jonathanlewis.wordpress.com/2019/10/07/resumable/https://jonathanlewis.wordpress.com/2019/10/07/resumable/

  • tmmdv

    Redo Logs

    3*200 MB

  • tmmdv

    Redo Logs

    3*200 MB 3*1024 MB

  • tmmdv

    Redo Logs

    https://tiny.cc/redo-sizing

    https://tiny.cc/redo-sizinghttps://tiny.cc/redo-sizinghttps://tiny.cc/redo-sizing

  • tmmdv

    Redo Writing

    multiple log writers

  • tmmdv

    Redo Writing

    multiple log writers (1 in 19c)

    single log writer _use_single_log_writer=true

  • tmmdv

    Undo

    autoextensible undo datafiles

    undo_retention=900

  • tmmdv

    any undo datafile

    autoextensible?

    try to obey undo_retention

    ignore undo_retention

    use all undo space;

    auto tuned retention

    Yes No

  • tmmdv

    Undo For AUTOEXTEND undo tablespaces, the system retains

    undo for at least the time specified in this parameter, and

    automatically tunes the undo retention period to satisfy the undo

    requirements of the queries. For fixed-size undo tablespaces,

    the system automatically tunes for the maximum possible undo

    retention period, based on undo tablespace size and usage

    history, and ignores UNDO_RETENTION unless retention

    guarantee is enabled. https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/UNDO_RETENTION.html#GUID-D238E854-A2C5-463E-A146-31F61300124E

    https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/UNDO_RETENTION.html#GUID-D238E854-A2C5-463E-A146-31F61300124Ehttps://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/UNDO_RETENTION.html#GUID-D238E854-A2C5-463E-A146-31F61300124Ehttps://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/UNDO_RETENTION.html#GUID-D238E854-A2C5-463E-A146-31F61300124Ehttps://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/UNDO_RETENTION.html#GUID-D238E854-A2C5-463E-A146-31F61300124Ehttps://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/UNDO_RETENTION.html#GUID-D238E854-A2C5-463E-A146-31F61300124Ehttps://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/UNDO_RETENTION.html#GUID-D238E854-A2C5-463E-A146-31F61300124Ehttps://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/UNDO_RETENTION.html#GUID-D238E854-A2C5-463E-A146-31F61300124Ehttps://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/UNDO_RETENTION.html#GUID-D238E854-A2C5-463E-A146-31F61300124Ehttps://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/UNDO_RETENTION.html#GUID-D238E854-A2C5-463E-A146-31F61300124Ehttps://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/UNDO_RETENTION.html#GUID-D238E854-A2C5-463E-A146-31F61300124Ehttps://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/UNDO_RETENTION.html#GUID-D238E854-A2C5-463E-A146-31F61300124Ehttps://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/UNDO_RETENTION.html#GUID-D238E854-A2C5-463E-A146-31F61300124Ehttps://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/UNDO_RETENTION.html#GUID-D238E854-A2C5-463E-A146-31F61300124E

  • tmmdv

    Undo Automatic tuning of undo retention typically achieves better

    results with a fixed-size undo tablespace.

    https://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8B

    https://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8Bhttps://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-undo.html#GUID-F7D30328-A0CC-4F81-BA54-0FCFC2095F8B

  • tmmdv

    Undo

    autoextensible undo datafiles

    undo_retention=900

    fixed size undo datafiles

  • tmmdv

    Undo

    Should be 100% utilized

  • tmmdv

    Undo

    https://tiny.cc/undo-sizing

    http://tiny.cc/undo-sizinghttp://tiny.cc/undo-sizinghttp://tiny.cc/undo-sizing

  • tmmdv

    Statistics – ESTIMATE_PERCENT

    auto_sample_size auto_sample_size

  • tmmdv

    Statistics – ESTIMATE_PERCENT

    But: https://twitter.com/JLOracle/status/979044773154652161 Jonathan Lewis @JLOracle

    Common problem.

    The sample size on auto_sample_size for

    indexes tends to be ridiculously small, and it's

    block sampled (to get the clustering factor)

    which magnifies the risk of error.

    8:17 PM - Mar 28, 2018

    https://twitter.com/JLOracle/status/979044773154652161https://twitter.com/JLOracle/status/979044773154652161https://twitter.com/JLOraclehttps://twitter.com/JLOraclehttps://twitter.com/JLOraclehttps://twitter.com/JLOraclehttps://twitter.com/JLOracle/status/979044773154652161https://twitter.com/JLOracle/status/979044773154652161https://twitter.com/JLOracle/status/979044773154652161https://twitter.com/JLOracle/status/979044773154652161https://twitter.com/intent/like?tweet_id=979044773154652161

  • tmmdv

    Statistics – ESTIMATE_PERCENT

    27268249 ENHANCE INDEX NDK STATISTICS GATHERING

    https://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11g

    https://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11ghttps://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11ghttps://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11ghttps://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11ghttps://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11ghttps://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11ghttps://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11ghttps://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11ghttps://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11ghttps://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11ghttps://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11ghttps://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11ghttps://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11ghttps://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11ghttps://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11ghttps://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11ghttps://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11ghttps://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11ghttps://blogs.oracle.com/optimizer/how-does-autosamplesize-work-in-oracle-database-11g

  • tmmdv

    Statistics – METHOD_OPT

    for all columns size auto

  • tmmdv

    All Columns Columns with automatically

    created histograms

    Histogram

    required

  • tmmdv

    Automatic Indexes vs. Automatic Histograms

    Automatic Indexes Automatic Histograms

    Appeared in? 19.3 10.1

    Enabled by default?

    Available in all versions?

    Just a bunch of PL/SQL?

    Could be created by Oracle?

    Could be dropped by Oracle?

    SQL regressions handled?

    Configurable?

    Could be turned off?

    Freaks me out?

  • tmmdv

    Statistics – METHOD_OPT

    for all columns size auto

    less histograms

  • tmmdv

    Statistics – METHOD_OPT

    for all columns size auto

    less histograms

  • tmmdv

    Statistics – METHOD_OPT

    for all columns size auto

    for all columns size 1

  • tmmdv

    Statistics – METHOD_OPT

    dbms_stats.set_table_prefs(

    'OWNER', 'TABLE', 'METHOD_OPT', 'FOR ALL COLUMNS SIZE 1 FOR COLUMNS SIZE 254 C1 C2 C3');

  • tmmdv

    Statistics – Linear Decay

    scales down estimates for out

    of range values

  • tmmdv

    Statistics – Linear Decay

    scales down estimates for out

    of range values

    use in range estimates for most

    columns

  • tmmdv

    Statistics – STALE_PERCENT

    10

  • tmmdv

    Statistics – STALE_PERCENT

    10

    change in behavior

  • tmmdv

    Statistics – TABLE_CACHED_BLOCKS

    1

  • tmmdv

    Statistics – Clustering Factor

    1, 2,

    3, 4

    5, 6,

    7, 8

    9, 10,

    11, 12

    13, 14,

    15, 16

    17, 18,

    19, 20

  • tmmdv

    Statistics – Clustering Factor

    1, 2,

    3, 4

    5, 6,

    7, 8

    9, 10,

    11, 12

    13, 14,

    15, 16

    17, 18,

    19, 20

    1, 6,

    11, 16

    2, 7

    12, 17

    3, 8

    13, 18

    4, 9,

    14, 19

    5, 10

    15, 20

  • tmmdv

    Statistics – TABLE_CACHED_BLOCKS

    1 16..16*instance_count

  • tmmdv

    Summary

    Some defaults need a change

  • Thank You!

    Questions?

    Comments?

    [email protected]