What are we going to learn today?• What resources are utilized by an Oracle Database
• Measure the CPU, memory, disk, IOPS and MBPS
• Provision enough resources for your Oracle Database in the Cloud• Optimize resource consumption
SESSION OBJECTIVES
Copyright © 2018 Accenture. All rights reserved. 2
JORGE BARBA• Consultant at Accenture Enkitec Group (Now part of Accenture Technology)
• 25 years experience in Information Technology around the Oracle Database
• Recent major projects are sizings for migrations of 800+ Oracle Databases
• Certifications include Oracle DBA, Java, Oracle Spatial, and Oracle Cloud
• Blog: https://jorgebarbablog.wordpress.com
ABOUT THE PRESENTER
Copyright © 2018 Accenture. All rights reserved. 3
DO WE HAVE IN THE AUDIENCE…• DBAs?
• Consultants?
• Managers?
• Developers?
• Sales?
• Jacks of all trades?
• Other?
ABOUT YOU
Copyright © 2018 Accenture. All rights reserved. 4
THE PURPOSE
Copyright © 2018 Accenture. All rights reserved. 5
144 CPUs, 512GB, 66TB
Cloudification
48 CPUs, 480GB, 42TB
WILL IT WORK…?
COMPUTER COMPONENTS
RESOURCES
Copyright © 2018 Accenture. All rights reserved. 6
MBPSIOPSCPU Memory Disk Space
CPU
Copyright © 2018 Accenture. All rights reserved. 8
NOMENCLATURE• CPU = CPU Thread
• Core = CPU Core
• Intel– 1 CPU Core = 2 CPU Threads
• VMWare– vCPU = CPU Thread
• Oracle– OCPU = CPU Core
Therefore
1 OCPU = 2 vCPUs
CPU
Copyright © 2018 Accenture. All rights reserved. 9
Question• How many OCPUs do I need in an Oracle Cloud VM to allocate the workload of database PRD?
Answer• Using 97th percentile:– On the Oracle Cloud Infrastructure with machine using the Intel Xeon 8160 (VM.Standard2.8)– We require 4 OCPUs– The utilization will be 50%
SOURCE OF DATA
CPU
Copyright © 2018 Accenture. All rights reserved. 11
V$ACTIVE_SESSION_HISTORY DBA_HIST_ACTIVE_SESS_HISTORY
CPU
Copyright © 2018 Accenture. All rights reserved. 12
CPU DATA FROM AWRThere is a process to convert the AWR data into a table with data points 10 seconds equidistant with the number of active sessions (sessions on CPU) for each interval.
CPU
Copyright © 2018 Accenture. All rights reserved. 13
PERCENTILE BY THE HOURBecause we need to know how the utilization is distributed we calculate the 97th percentile for every hour during the day.
CPU
Copyright © 2018 Accenture. All rights reserved. 15
97TH PERCENTILE BUSIEST HOURIf we grab the highest value we know the requirement for our database at the 97th percentile.
SPEC.ORG
CPU
Copyright © 2018 Accenture. All rights reserved. 17
Intel Xeon E5-2699 v4 @2.2Ghz– Oracle Exadata X6-2– Cisco UCS B200 M4– Dell PowerEdge R730– HP ProLiant BL460c Gen9
Intel Xeon 8160 @2.1Ghz– Oracle Exadata X7-2– Cisco UCS C220 M5– Dell PowerEdge R740– HP ProLiant BL460c Gen10
Specifications– 22 cores– Max memory 1.5TB
– SPEC RPC = 40.9
Specifications– 24 cores– Max memory 768GB
– SPEC RPC = 48.3
CPU
Copyright © 2018 Accenture. All rights reserved. 18
SPEC CONVERSION AND HEADROOM
Question• If we need 15 CPUs in a system with 44 CPUs processor E5-2699 v4 (because we used
percentiles and calculated that we needed 15 CPUs). How many CPUs are needed in a system with Intel Xeon 8160?
Answer• The answer is 16– Ratio between systems (40.9/48.3) ~ 0.85 – Multiplying the number of CPUs times the ratio 15 * 0.85 = 12.7– Adding 25% Headroom 12.7 * 1.25 = 15.875 ~ 16 that would be VM.Standard2.8
MEMORY
Copyright © 2018 Accenture. All rights reserved. 21
SGA NOTESSGA_TARGET• Specifies the total size of all SGA components
SGA_MAX_SIZE• Specifies the maximum size of the SGA for the lifetime of the instance
DBA_HIST_SGA• Same as in v$sga captured every hour
MEMORY
Copyright © 2018 Accenture. All rights reserved. 26
SGA + PGAWe have close to 25GB requirement for memory• SGA of 24GB
• PGA adds up to 636MB
DISK
Copyright © 2018 Accenture. All rights reserved. 28
PERMANENT + TEMP + UNDO + REDO LOG
• Permanent– Your data objects are stored in the permanent tablespaces.
• Temporary– Temporary tablespaces are used for sort operations and joins.
• Undo– Special tablespaces used solely for storing undo information.
• Redo Log– Consists of two or more preallocated files that store all changes made to the database as
they occur.
DISK
Copyright © 2018 Accenture. All rights reserved. 29
NOTESdba_hist_tbspc_space_usage• This view holds the tablespace size for each tablespace in the database and
collects data every hour. Must be joined to dba_hist_snapshot to get the snapshot time.
v$tablespace and dba_tablespaces• Need both of these because we need the tablespace id from v$tablespace
and the block_size from dba_tablespaces.
DISK
Copyright © 2018 Accenture. All rights reserved. 30
CALCULATIONSNAP_ID TABLESPACE_NAME CONTENTS TABLESPACE_SIZE
---------- ------------------------------ --------- ---------------13982 SYSTEM PERMANENT 11520013982 SYSAUX PERMANENT 99532013982 DEMO PERMANENT 393216013982 USERS PERMANENT 1280013982 TEMP TEMPORARY 838860813982 TEMP_RECO TEMPORARY 1353036813982 UNDOTBS1 UNDO 3123200
IOPS AND MBPS
Copyright © 2018 Accenture. All rights reserved. 35
MEANING OF IOPS AND MBPSApplication performance often depends on how well your storage can serve data to end clients. For this reason you must correctly design or choose your storage tier speed in terms of both IOPS and throughput, which rate the speed and bandwidth of the storage respectively.
IOPS AND MBPS
Copyright © 2018 Accenture. All rights reserved. 37
NOTESdba_hist_sysstat• displays historical system statistics information. This view contains snapshots
of V$SYSSTAT.
dba_hist_sysmetric_summary• displays a history of statistical summary of all metric values.
Copyright © 2018 Accenture. All rights reserved. 44
“the action or process of combining a number of things into a single more effective or coherent whole”- GOOGLE DICTIONARY
CONSOLIDATION
ONE DATABASE UTILIZATION
Copyright © 2018 Accenture. All rights reserved. 45
ORACLE VM
This example is for one database.What happens when we consolidate several databases…
RESOURCE CONSUMPTION REDUCTION
Copyright © 2018 Accenture. All rights reserved. 48
MEMORYSGA and PGA• Example:– For database DB5, reduce the sga_target from 16GB to 6GB and monitor database. After a
month review the results of the SGA Target advice report to see if sga_target can be further reduced.
– For database DB5, reduce the pga_aggregate_target from 4GB to 1GB and monitor database. After a month review the results of the PGA Target advice report to see if pga_aggregate_target can be further reduced.
RESOURCE CONSUMPTION REDUCTION
Copyright © 2018 Accenture. All rights reserved. 49
MBPSSQL Tuning• Example:
– Evaluate if it is needed to run SQL ID 94urf5fx21567 as often as it is being executed. If
possible, reduce the frequency of execution of SQL ID 94urf5fx21567.
– The SQL ID SQL_ID 2qrdww9ynmagf executes every 30 seconds, evaluate the need to run
this SQL that often, probably running it every 8 hours would be good enough instead of
every 30 seconds.
– To avoid a full table scan on ORDERS create index on column ID on table ORDERS.
RESOURCE CONSUMPTION REDUCTION
Copyright © 2018 Accenture. All rights reserved. 50
MBPSJobs and parallelism• Avoid the Gather Schema Stats job with high degree of parallelism.
Activity coming from non-application modules• Review the need for the activity coming from SQL*Plus daily from 2:00am to
3:00am.
RESOURCE CONSUMPTION REDUCTION
Copyright © 2018 Accenture. All rights reserved. 51
MBPSKnown Bugs/Fixed object X$KTFBUE• To improve performance of SQL ID SQL_ID 2qrdww9ynmagf gather stats on
fixed object X$KTFBUE.
RESOURCE CONSUMPTION REDUCTION
Copyright © 2018 Accenture. All rights reserved. 52
MBPSFrequency and type of Backups• Run the Full Backup only on weekends and Incremental backups during the week.
• Enable the Block Change Tracking mechanism to speed up Incremental Backups.
• Set the RATE channel parameter to leave some disk bandwidth available during the backup time.
• For DB1 and DB2, use only one RMAN channel instead of 4.
• For DB1 and DB2, maintain a high level of compression to reduce the amount of data written.
CONCLUSION
Copyright © 2018 Accenture. All rights reserved. 54
NOW YOU CAN MOVE TO THE CLOUD
• Evaluate resource utilization• Tune the databases prior to move• Tune for the scarce resource• Optimize the resources to avoid excessive
expenditure• Make sure the resources needed are provisioned