39
A Robust Blueprint to Performance Optimization in Multiblock Databases Anthony D. Noriega [email protected]

A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

Embed Size (px)

Citation preview

Page 1: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

A Robust Blueprint to PerformanceOptimization in Multiblock Databases

Anthony D. Noriega

[email protected]

Page 2: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 20042

Objective

Discuss, and present a research overview onmultiblock databases.Emphasize an optimal performance tuning strategyfor multiblock concepts and database cacheutilization.Find the best approach to deal with any relatedbusiness or technical constraints, when creating,migrating to, or transporting an Oracle multiblockdatabase.Optimize utilization in data warehousingenvironments.

Page 3: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 20043

Creation Method and Strategy

Set up the appropriate initialization parameters.Take advantage from using DBCA instead ofmanual creation, seeking custom design.Establish good practices when using RAID, OCFSpartitioning or other special block formatting andsizing.If using RAC architecture, envision the effect ofmapping your database files to each instancedatabase cache.

Page 4: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 20044

Shared vs. Dedicated ArchitectureNote that the selection of the shared or dedicatedarchitecture database options has an enormous impactin many of the configuration parameters andconnections taking place.When creating the database, simplify the initialnetworking settings.For instance, if utilizing the MULTIPLEXING option inthe shared architecture, note that it requiresConnection Manager.MULTIPLEXING is a qualifying argument for theDISPATCHERS parameter, and it requires integratedtuning with others qualifiers such as POOL and TICKS.

Page 5: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 20045

Watching for Conflicting Parameters

Make sure that your UNDO_MANAGEMENToptions are properly established.Do not attempt to expand on shared serveroptions connectivity at creation time.Specifying certain parameters could makeyour database creation a conflicting one.

Page 6: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 20046

Block Size SelectionA multiblock database can have a databasedefault block; andThe following db_nk_cache_size parametermatching blocks, namely:

• A 2k block, matching the db_2k_block_cache_size• A 4k block, matching the db_4k_block_cache_size• An 8k block, matching the db_8k_block_cache_size• A 16k block, matching the db_16k_block_cache_size• A 32k block size, matching the db_32k_block_cache_size,

not available in operating systems like Windows or Linux,and reserved to high-end operating systems Solaris,HP-UX, and AiX, among others.

• Take all considerations if your OS block is very large.

Page 7: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 20047

Choose your database database block size carefullyDecide on a shared or dedicated serverarchitectureSelect the appropriate initialization parameters andOFA architecture using Oracle DBCA

Summary of Database Creation Criteria

Database Creation using DBCA

Init.ora parameters and OFA Architecture

Database defaultBlock size selection Shared or Dedicated

Architecture

Page 8: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 20048

The Database Creation ScriptCREATE DATABASE adnp1 CONTROLFILE REUSE LOGFILE GROUP 1 ('/export/home/oracle/oralogs/adnp1/logs/adnp1_redo01a.log', '/export/home/oracle/oradata/adnp1/logs/adnp1_redo01b.log') SIZE 500M, GROUP 2 ('/export/home/oracle/oralogs/adnp1/logs/adnp1_redo01a.log',

'/export/home/oracle/oradata/adnp1/logs/adnp1_redo02b.log' ) SIZE 500M MAXLOGFILES 255 MAXLOGHISTORY 12144 MAXDATAFILES 1244 MAXINSTANCES 12 ARCHIVELOG CHARACTER SET AL32UTF8 NATIONAL CHARACTER SET AL16UTF16 DATAFILE '/export/home/oracle/orasys/adnp1/datasys/adnp1_system_01.dbf' size 500m

AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED DEFAULT TEMPORARY TABLESPACE temp tempfile

'/export/home/oracle/oratemp/adnp1/temp/adnp1_temp_01.dbf' size 4000m UNDO TABLESPACE undotbs1 datafile

'/export/home/oracle/oraundo/adnp1/undo/adnp1_undotbs1_01.dbf' size 16000m SET TIME_ZONE = '-05:00';

Page 9: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 20049

Setting the db_nk_cache_sizeFor the set of new db_nk_cache_sizeparameters, you need to bounce the databaseeach time.Then you are able to adjust this cacheaccordingly, if need be, using theALTER SYSTEM set db_nk_cache_size = <cache_size_value>;If your default database block size is 8k, thereis no need to specify a db_8k_cache_sizeparameter .

Page 10: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200410

Possible Block Sizes in an Oracle Database

The Database defaultblock size range variesdepending on theoperating system andthe format utilized.

32k blocks are notcurrently supported byLinux or WindowsOperating Systems.

Database Default Block Size

Db_2k_cache_size

Db_4k_cache_size

Db_8k_cache_size

Db_16k_cache_size

Db_32k_cache_size

Page 11: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200411

Bouncing your Database to setup specificdb_nk_cache_size parameters

When the DBA first bounces the database forcache reconfiguration, they have their best timeto first add the different cache sizes that willmatch the different tablespace block sizes, notequal to the database default block size. Theprocess limits to the following steps:Before restarting the database instance, type inthe db_nk_cache_size parameters in the init.oraparameter file. Values need to be consistent withthe number and size of cached tables (andassociated structures) matching this block size.Restart your database instance specifying themodified parameter file.

Page 12: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200412

Bouncing your Database to setupspecific db_nk_cache_size parameters(continued)

Use the CREATE TABLESPACE command to createnew tablespaces with the appropriate block sizematching those specific block sizes set in theinit.ora parameter. The BLOCKSIZE clause isrequired.Create new objects in each tablespace with adifferent block size. Create a server parameter file (spfile) from yourinitialization parameter file.

Page 13: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200413

SGA and Cache PerspectiveServer Process

1

RedoBuffer

Shared Pool Streams Pool

LargePool

Java Pool

Oracle Process

PGA Server Process2

Background Processes

PGA

Server Process3

PGA

PGAPGA

Def

ault

2k 4k 16k

recy

cle

keep

Page 14: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200414

CREATING A TABLESPACE WITH NON-DEFAULT BLOCKSIZE. EXAMPLE 1.

CREATE TABLESPACE INDX DATAFILE 'E:\ORACLE\ORADATA\PORTAL\INDX01.DBF' SIZE 25M

AUTOEXTEND ON NEXT 1280K MAXSIZE 33554416KLOGGINGONLINEPERMANENTEXTENT MANAGEMENT LOCAL AUTOALLOCATEBLOCKSIZE 16KSEGMENT SPACE MANAGEMENT AUTO;

Page 15: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200415

CREATING A TABLESPACE WITH NON-DEFAULT BLOCKSIZE. EXAMPLE 2.

CREATE TABLESPACE DIAGRAM_TABLES DATAFILE '/oradata/portaldb/portal_diagtab_01.dbf' SIZE 1320K

AUTOEXTEND OFFLOGGINGONLINEPERMANENTEXTENT MANAGEMENT LOCAL UNIFORM SIZE 128KBLOCKSIZE 32KSEGMENT SPACE MANAGEMENT MANUAL;

Page 16: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200416

SPECIAL REMARKSThe EXTENT MANAGEMENT LOCAL withSEGMENT SPACE MANAGEMENT AUTO canprovide the best performance options inmost cases.In Some cases, it is better to utilize a LOCALUNIFORM extent management approachwith a required explicit value, sinceautoallocation of blocks can lead to theseissues, such as when creating tables withCREATE TABLE AS SELECT quite often.

Page 17: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200417

TUNING THE DATABASE BUFFER CACHE

Because performance tuning has greatly evolved, utilizingUTLBSAT/UTLESTAT and subsequently the stats$waitstattable.STATSPACK utilizes the PERFSTAT schema and involvesboth SQL and PL/SQL scripts than can achieve bettertuning results. Other recommended tuning strategies suchas utilizing Oracle Enterprise Manager (OEM) Tools, likeOracle Expert, Index Analyzer, and Capacity Planner.OEM directly provides a set of instance performancevisualization from the Instance Manager, as a result it ispossible to utilize the Oracle Cache Advisories.Automatic Database Diagnostic Monitor (ADDM) andAutomatic Workload Repository (AWR) for total autocontrolof the database server tuning.

Page 18: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200418

MULTIBLOCK CACHE IN A STATSPACK REPORT

Page 19: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200419

CACHE ADVISORIES AND MEMORYSTRUCTURES OPTIMIZATION

Oracle Cache Advisories allow DBAs to make decisions onhow to dynamically adjust certain memory structures suchas the database buffer cache, the shared pool andconsequently the System Global Area (SGA) actual target(SGA_TARGET).By utilizing the Cache Advisory available in the InstanceManager, thresholds for each buffer cache can bevisualized from a chart view. Similarly, the DBA can querythe V$DB_CACHE_ADVICE[1] view, which displaysestimated physical read factors and buffers used forestimate as the main source to establish the best cachesize value[1] The DB_CACHE_ADVICE initialization parameterneeds to be set to either ON or READY.

Page 20: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200420

ORACLE9i DATABASE CACHE ADVISORY PERSPECTIVE

Page 21: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200421

ORACLE10g SGA GRAPHICAL VIEW

Page 22: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200422

ORACLE10g DATABASE CACHE ADVISORY VIEW

Page 23: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200423

ORACLE10g PGA VIEW

Page 24: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200424

ORACLE10g PGA AGGREGATE TARGET ADVICE

Page 25: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200425

SOME CRITICAL CONCEPTSThe SGA dynamic allocation unit is the granule. Thesize of the granule depends on the estimated size ofthe SGA. If the SGA is less than 128MB, then agranule is 4MB. If the SGA is larger than 128MB,then the granule is 16MB.The minimum number of granules allocated atstartup is one for the buffer cache, one for theshared pool and one for the fixed SGA, whichincludes redo buffers. So according to theserequirements the minimum configurable SGA is 3granules or at least 12MB.

Page 26: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200426

SOME CRITICAL CONCEPTS (continued)

When the value of the recommended cache size isrecognized from the Cache Advisory, the DBA canchange it dynamically by using theALTER SYSTEM SET DB_CACHE_SIZE <value>;command line.At that moment, it is really not recommended to set thatvalue in the init.ora parameter and bounce the databaseinstance, since the restarted instance could actuallylead to a change in the total SGA size with a largerunexpected value, and subsequently to inconsistenttuning.This is particularly true in multiblock databases, whenthe db_recycle_cache_size and thedb_keep_cache_size initialization parameters are set inthe init.ora parameter file together with otherdb_nk_cache_size parameters.

Page 27: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200427

QUERYING THE CACHE ADVISORY VIEWSV$db_cache Advice

Page 28: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200428

RECYCLE BUFFER POOL ISSUESIt is possible to configure a RECYCLEbuffer pool for blocks pertaining tosegments that you do not want toremain in memory.The RECYCLE pool is good for segmentsthat are scanned rarely or are notreferenced frequently

Page 29: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200429

MINING THE DATA DICTIONARY TO ATTAINTHE BEST PERFORMANCE TUNING

Similarly, diagnosing freelist contention can takeplace by inspecting the following views:V$WAITSTAT: Query COUNT and TIME for thesegment header CLASS.V$SYSTEM_EVENT: Query TOTAL_WAITS for theEVENT buffer busy.V$SESSION_WAIT: Fir server process wait events,need to join with DBA_SEGMENTS accordinglyDBA_SEGMENTS: Used to determine the name ofthe segment waited on in V$SESSION_WAIT.

Page 30: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200430

ORACLE9i DATABASE SHARED POOL CACHE ADVISORY

Page 31: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200431

ORACLE10g DATABASE SHARED POOL CACHE ADVISORY

Page 32: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200432

CERTAIN CONSTRAINTSBesides, the SGA_TARGET parameter could be increasedup to the value specified for the SGA_MAX_SIZE, orotherwise reduced. If the DBA reduces the value ofSGA_TARGET, the system identifies one or moreautomatically tuned components to release memory. TheDBA can reduce SGA_TARGET until one or moreautomatically tuned components reach their minimum size.Oracle Database determines the minimum allowable valuefor SGA_TARGET taking into account several factors,including values set for the automatically sized components,manually sized components that use SGA_TARGET space,and number of CPUs. The change in the amount ofphysical memory consumed when SGA_TARGET ismodified depends on the operating system.

Page 33: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200433

JAVA POOL: MONITORING AND SIZINGOracle’s Java Virtual Machine (JVM) known rather by Oracle EJEuses memory from both the shared pool and the java pool. Ituses about 8k for each loaded class, for which a minimum of50MB is recommended for enhanced production performance. Indedicated servers the java pool memory utilizes the shared part ofeach Java class used per session, which can average 4K to 8k foreach class.The per-session Java state of each session is stored in the UGAwithin the Program Global Area (PGA) rather than in the Java poolwithin the SGA. Similarly, the shared server uses Java poolmemory for the shared part of each Java class used for the per-session state of each session. So, it is easy to estimate andmonitor the Java pool by querying V$SGASTAT.Object locking and deadlocking situations can be established byquerying the dba_blockers and dba_waiters views or byvisualizing and zooming into Oracle Lock Manager from OEM’sOracle Instance Manager.

Page 34: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200434

UNDO AND TEMPORARY TABLESPACE ISSUESUse at least two undo tablespaces, particularly, at peakproduction time or in the event of a major application upgrade,large load or import task.This cooperates with the current undo_retention policy and theassociated retention guarantee (10g), if any.The key idea is to be able to switch from the undo tablespacewhen 80% full.This is particularly true if a parameter such as_DISABLE_LOGGING is set to speed up an Import utilityprocess and minimize redo logging activity, if an approachsuch as ORAPEPI, or alike, is eventually used.Use ALTER SYSTEM SET UNDO_TABLESPACE <undo_tablespace_name>;Two temporary tablespaces are also recommended in mostscenarios, and a related strategy to control and leverage thema peak aggregation, sorting or indexing time.

Page 35: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200435

PHYSICAL DATABASE ISSUES: TUNING THE DESIGNMap Tables to different block size tablespaces. Thus, fordata warehouse environments perform better intablespaces with larger block size, OLTP driven databasesin smaller block size, independently from the pureness orwholeness of the architecture and approach themselves,such as when using Heterogeneous Systems and/or diverseconsumer groups perspectives.Likewise, the author recommends utilizing larger blocksizetablespace to accommodate tables involving CLOB, BLOB,BFILE, XMLTYPE, and the majority of large user- definedobject domains.Do not ignore table compression and partitioning options.Derive Business Rules to associate objects to block sizes.

Page 36: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200436

ADVANCED REPLICATION AND STREAM ISSUES

Underlying object components, such replicating a partitiontable using a local index, since invalidation of this objectsmay lead to a time consuming rebuilding process.Envision, design, and implement a strategy that cancontemplate not only tuning a the first replication stage,but also the systematic periodic replicating job processeswhose intensiveness needs to be carefully measured andplanned for.Storage Area Network/Network Attached Storage(SAN/NAS) channelDatabase image vs. Business Continuity Volume (BCV)ApproachesDatabase Version Issues

Page 37: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200437

PARTITIONING ON A DIFFERENT BLOCK SIZE

CREATE INDEX DBAMBA.IDX$CUSTOMER$STATEON DBAMBA.CUSTOMER (STATE)PARALLEL 4 TABLESPACE INDXINITRANS 2 MAXTRANS 255 ONLINECOMPUTE STATISTICSREVERSE GLOBAL PARTITION BY RANGE (STATE)(PARTITION IDX$CUSTOMER$STATE_P1 VALUES LESS THAN ('DE' )TABLESPACE DATAPAR1, PARTITION IDX$CUSTOMER$STATE_P2 VALUES LESS THAN ('IA' )TABLESPACE DATAPAR2, PARTITION IDX$CUSTOMER$STATE_P3 VALUES LESS THAN ('NY' )TABLESPACE DATAPAR3, PARTITION IDX$CUSTOMER$STATE_P4 VALUES LESS THAN (MAXVALUE)TABLESPACE DATAPAR4);

Page 38: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200438

CONCLUDING REMARKSMultiblock databases represent a very useful database architecturetechnology that can nuance with and encompass other technologies suchas Data Warehousing, shared database architecture, Oracle AdvancedReplication, and Streams, Table Compression, and allow a DBA to bestmake use of Oracle’s LOBs, Object-Orientation and related user-defineddata types technologies altogether.The dimensions and possibilities where multiblock databases can have agreat impact are countless, including highly increased index performanceFinally, the issues discussed in this paper are the outcome of acomprehensive research in this topic, with practical application in ratherVLDB raging the area of 8 to 10TB of data.Therefore, they can certainly account as a blueprint for most industriesand applications utilizing multiblock databases, particularly VLDB, inintegration with other Oracle key leading technologies as presented.

Page 39: A Robust Blueprint to Performance Optimization in ... Robust Blueprint to Performance Optimization in Multiblock Databases ... as utilizing Oracle Enterprise Manager (OEM) Tools,

NYOUG Sept. 200439

CONCLUDING REMARKS

Technical Areas of Application

Data Warehousing/OLAP

Content Management

Multi-Dimensional Applications/VLDB