Expert oracle RAC performance diagnostics and tuning

690 408 0
Expert oracle RAC performance diagnostics and tuning

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

www.it-ebooks.info For your convenience Apress has placed some of the front matter material after the index Please use the Bookmarks and Contents at a Glance links to access them www.it-ebooks.info Contents at a Glance About the Author��������������������������������������������������������������������������������������������������������������� xxi About the Technical Reviewer����������������������������������������������������������������������������������������� xxiii Acknowledgments������������������������������������������������������������������������������������������������������������ xxv Introduction�������������������������������������������������������������������������������������������������������������������� xxvii ■■Chapter 1: Methodology����������������������������������������������������������������������������������������������������1 ■■Chapter 2: Capacity Planning and Architecture��������������������������������������������������������������21 ■■Chapter 3: Testing for Availability�����������������������������������������������������������������������������������55 ■■Chapter 4: Testing for Scalability������������������������������������������������������������������������������������87 ■■Chapter 5: Real Application Testing������������������������������������������������������������������������������111 ■■Chapter 6: Tools and Utilities�����������������������������������������������������������������������������������������145 ■■Chapter 7: SQL Tuning���������������������������������������������������������������������������������������������������201 ■■Chapter 8: Parallel Query Tuning�����������������������������������������������������������������������������������235 ■■Chapter 9: Tuning the Database�������������������������������������������������������������������������������������277 ■■Chapter 10: Tuning Recovery�����������������������������������������������������������������������������������������319 ■■Chapter 11: Tuning Oracle Net���������������������������������������������������������������������������������������339 ■■Chapter 12: Tuning the Storage Subsystem������������������������������������������������������������������355 ■■Chapter 13: Tuning Global Cache�����������������������������������������������������������������������������������387 ■■Chapter 14: Tuning the Cluster Interconnect�����������������������������������������������������������������451 ■■Chapter 15: Optimize Distributed Workload������������������������������������������������������������������495 v www.it-ebooks.info ■ Contents at a Glance ■■Chapter 16: Oracle Clusterware Diagnosis��������������������������������������������������������������������545 ■■Chapter 17: Waits, Enqueues, and Latches��������������������������������������������������������������������585 ■■Chapter 18: Problem Diagnosis�������������������������������������������������������������������������������������615 ■■Appendix A: The SQL Scripts Used in This Book������������������������������������������������������������653 ■■Bibliography������������������������������������������������������������������������������������������������������������������661 Index���������������������������������������������������������������������������������������������������������������������������������665 vi www.it-ebooks.info Introduction Working for several years across several industries on various RAC projects, there have been several occasions to troubleshoot performance issues in a production environment Applications and databases that where moved from a single-instance Oracle environment to a two or more node RAC environment to hide a performance problem An example that comes to mind, which I have encountered in the field on several occasions, is when the database was moved to a RAC environment because the single instance was running at 100% CPU and it was hoped that by moving to a RAC configuration, the 100% CPU overload would be distributed between the various instances in the cluster This really does not happen this way; RAC cannot magic to fix poorly written structured query language (SQL) statements or SQL statements that have not been optimized The general best practice or rule of thumb to follow is when an application can scale from one CPU to multiple CPUs on a single node/instance configuration, it could potentially scale well in a RAC environment The outcome of migrating applications that perform poorly to a RAC environment is to roll back to a single-instance configuration (by disabling the RAC/cluster parameters), testing/ tuning the application and identifying problem SQL statements, and when the application is found to successfully scale (after SQL statement tuning), it is moved to a RAC environment Moving to a RAC environment for the right reasons (namely, availability and scalability) should be done only when the application and environments that have been tested and proven to meet the goals Almost always the reason for a RAC environment to crash on the third, fourth or sixth day after it’s rolled into a production environment is lack of proper testing This is either because testing was never considered as part of the project plan or because testing was not completed due to project schedule delays Testing the application through the various phases discussed in this book helps identify the problem areas of the application; and tuning them helps eliminate the bottlenecks Not always we get an opportunity to migrate a single-instance Oracle database into a RAC environment Not always is an existing RAC environment upgraded from one type of hardware configuration to another What I am trying to share here is the luxury to test the application and the RAC environment to get the full potential happens only once before it’s deployed into production After this point, its primary production calls for poor response time, node evictions, high CPU utilization, faulty networks, chasing behind run of processes, and so on and so forth During the testing phase, taking the time to understand the functional areas of the application, how these functional areas could be grouped into database services, or mapping an application service to a database service would help place a single service or a group of services on an instance in the cluster This would help in the distribution of workload by prioritizing system resources such as CPU, I/O, and so forth This mapping could also help in availability partially by disabling a specific database service during a maintenance window when application changes need to be deployed into production, thus avoiding shutting down the entire database About This Book The book is primarily divided into two sections: testing and tuning In the testing section of the book, various phases of testing grouped under a process called “RAP” (Recovery, Availability, & Performance) have been defined The second section discusses troubleshooting and tuning the problems The style followed in the book is to use workshops through performance case studies across various components of a RAC environment xxvii www.it-ebooks.info ■ Introduction Almost always, when a performance engineer is asked a question such as why the query is performing badly, or why the RAC environment is so slow, or why did the RAC instance crash, the expected answer should be “it depends.” This is because there could be several pieces to the problem, and no one straight answer could be the reason If the answers are all straight and if there is one reason to a problem, we would just need a Q&A book and we would not need the mind of a technical DBA to troubleshoot the issue Maybe a parameter “ORACLE_GO_FASTER” (OGF) could be set and all the slow-performing queries and the database would run faster Similar to the “it depends” answer, in this book I have tried to cover most of the common scenarios and problems that I have encountered in the field, there may or may not be a direct reference to the problem in your environment However, it could give you a start in the right direction How to Use This Book The chapters are written to follow one another in a logical fashion by introducing testing topics in the earlier chapters and building on them to performance and troubleshooting various components of the cluster Thus, it is advised that you read the chapters in order Even if you have worked with clustered databases, you will certainly find a nugget or two that could be an eye opener Throughout the book, examples in the form of workshops are provided with outputs, followed by discussions and analysis into problem solving The book contains the following chapters: Chapter 1—Methodology Performance tuning is considered an art and more recently a science However, it is definitely never a gambling game where guesswork and luck are the main methods of tuning Rather, tuning should be backed by reasons, and scientific evidence should be the determining factor In this chapter, we discuss methodologies to approach performance tuning of the Oracle database in a precise, controlled method to help obtain successful results Chapter 2—Capacity Planning and Architecture Before starting the testing phase, it is important to understand how RAC works, how the various components of the architecture communicate with each other How many users and workload can a clustered solution handle? What is the right capacity of a server? The cluster that is currently selected may be outgrown due to increased business or high data volume or other factors In this chapter, we discuss how to measure and ascertain the capacity of the systems to plan for the future Chapter 3—Testing for Availability The primary reason for purchasing a RAC configuration is to provide availability Whereas availability is the immediate requirement of the organization, scalability is to satisfy future needs when the business grows When one or more instances fail, the others should provide access to the data, providing continuous availability within a data center Similarly, when access to the entire data center or the clustered environment is lost, availability should be provided by a standby location When components fail, one needs to ensure that the redundant component is able to function without any hiccups In this chapter, we cover just that: • Testing for failover • Simulating failover • Test criteria to be adopted • User failover • Tuning the failover to achieve maximum availability xxviii www.it-ebooks.info ■ Introduction Chapter 4—Testing for Scalability One of the primary reasons in purchasing a RAC configuration is to provide scalability to the environment However, such scalability is not achievable unless the hardware and the application tiers are scalable Meaning that unless the hardware itself is scalable, the application or database cannot scale In this chapter, we discuss the methods to be used to test the hardware and application for scalability: • Testing for data warehouse • Testing for OLTP • Testing for mixed workload systems • Operating system parameter tuning • Diagnosis and problem solving at the hardware level • Verification of the RAC configuration at the hardware and O/S levels • Using tools such as SwingBench, Hammerora, and other utilities Chapter 5—Real Application Testing Once the hardware has been tested and found to be scalable, the next step is to ensure that the application will scale in this new RAC environment Keeping the current production numbers and the hardware scalability numbers as a baseline, one should test the application using the database replay feature of the RAT tool to ensure that the application will also scale in this new RAC environment Chapter 6—Tools and Utilities There are several tools to help tune an Oracle database, tools that are bundled with the Oracle RDBMS product and others that are provided by third party vendors In this chapter, we discuss some of the key tools and utilities that would help the database administrators and the performance analysts A few of the popular tools are Oracle Enterprise Cloud Control, SQLT (SQL Trace), AWR (Automatic Workload Repository), AWR Warehouse, ASH (Active Session History), and ADDM (Automatic Database Diagnostic Monitor) Chapter 7—SQL Tuning The application communicates with the database using SQL statements This includes both storage and retrieval If the queries are not efficient and tuned to retrieve and or store data efficiently, it directly reflects on the performance of the application In this chapter, we go into detail on the principles of writing and tuning efficient SQL statements, usage of hints to improve performance, and selection and usage of the right indexes Some of the areas that this chapter will cover are the following: • Reducing physical IO • Reducing logical IO • Tuning based on wait events • Capturing trace to analyze query performance • SQL tuning advisory • AWR and ADDM reports for query tuning in a RAC environment xxix www.it-ebooks.info ■ Introduction Chapter 8—Parallel Query Tuning Queries could be executed sequentially in which a query attaches to the database as one process and retrieves all the data in a sequential manner They could also be executed using multiple processes and using a parallel method to retrieve all the required data Parallelism could be on a single instance in which multiple CPUs will be used to retrieve the required data or by taking advantage of more than one instance (in a RAC environment) to retrieve data In this chapter, we cover the following: • Parallel queries on a single node • Parallel queries across multiple nodes • Optimizing parallelism • Tracing parallel operations • Parameters to tune for parallel operations • SQL tuning advisory • AWR and ADDM reports for parallel query tuning in a RAC environment Chapter 9—Tuning the Database The database cache area is used by Oracle to store rows fetched from the database so that subsequent requests for the same information is readily available Data is retained in the cache based on the usage In this chapter, we discuss efficient tuning of the shared cache, the pros and cons of logical I/O operations versus physical I/O operations, and how to tune the cache area to provide the best performance In this chapter, we discuss some of the best practices to be used when designing databases for a clustered environment Chapter 10—Tuning Recovery No database is free from failures; RAC that supports multiple instances is a solution for high availability and scalability Every instance in a RAC environment is also prone for failures When an instance fails in a RAC configuration, another instance that detects the failure performs the recovery operation Similarly, the RAC database also can fail and have to be recovered In this chapter, we discuss the tuning of the recovery operations Chapter 11—Tuning Oracle Net The application communicates with the database via SQL statements; these statements send and receive information from the database using the Oracle Net interface provided by Oracle Depending on the amount of information received and sent via the Oracle Net layer, there could be a potential performance hurdle In this chapter, we discuss tuning the Oracle Net interface This includes tuning the listener, TNS (transparent network substrate), and SQL Net layers Chapter 12—Tuning the Storage Subsystem RAC is an implementation of Oracle in which two or more instances share a single copy of the physical database This means that the database and the storage devices that provide the infrastructure should be available for access from all the instances participating in the configuration Efficiency of the database to support multiple instances depends on a good storage subsystem and an appropriate partitioning strategy In this chapter, we look into the performance measurements that could be applied in tuning the storage subsystem xxx www.it-ebooks.info ■ Introduction Chapter 13—Tuning Global Cache Whereas the interconnect provides the mechanism for the transfer of information between the instances, the sharing of resources is managed by Oracle cache fusion technology All instances participating in the clustered configuration share data resident in the local cache of one instance with other process on other instances Locking, past images, current images, recovery, and so forth normally involved in a single-instance level can also present at a higher level across multiple instances In this chapter, we discuss tuning of the global cache Chapter 14—Tuning the Cluster Interconnect The cluster interconnect provides the communication link between two or more nodes participating in a clustered configuration Oracle utilizes the cluster interconnect for interinstance communication and sharing of data in the respective caches of the instance This means that this tier should perform to its maximum potential, providing efficient communication of data between instances In this chapter, we discuss the tuning of the cluster interconnect Chapter 15—Optimization of Distributed Workload One of the greatest features introduced in Oracle 10g is the distributed workload functionality With this databases can be consolidated; and by using services options, several applications could share an existing database configuration utilizing resources when other services are not using them Efficiency of the environment is obtained by automatically provisioning services when resources are in demand and automatically provisioning instances when an instance in a cluster or server pool is not functioning Chapter 16—Tuning the Oracle Clusterware Oracle’s RAC architecture places considerable dependency on the cluster manager of the operating system In this chapter, we discuss tuning the various Oracle clusterware components: • Analysis activities performed by the clusterware • Performance diagnosis for the various clusterware components, including ONS (Oracle notification services), EVMD (Event Manager Daemon), and LISTENER • Analysis of AWR, ADDM reports and OS-level tools to tune the Oracle clusterware • Debugging and tracing clusterware activity for troubleshooting clusterware issues Chapter 17—Enqueues, Waits, and Latches When tuned and optimized SQL statements are executed, there are other types of issues such as contention, concurrency, locking, and resource availability that could cause applications to run slow and provide slow response times to the users Oracle provides instrumentation into the various categories of resource levels and provides methods of interpreting them In this chapter, we look at some of these critical statistics that would help optimize the database By discussing enqueues, latches, and waits specific to a RAC environment, in this chapter we drill into the contention, concurrency, and scalability tuning of the database xxxi www.it-ebooks.info ■ Introduction Chapter 18—Problem Diagnosis To help the DBA troubleshoot issues with the environment, Oracle provides utilities that help gather statistics across all instances Most of the utilities that focus on database performance-related statistics were discussed in Chapter There are other scripts and utilities that collect statistics and diagnostic information to help troubleshoot and get to the root cause of problems The data gathered through these utilities will help diagnose where the potential problem could be In this chapter, we discuss the following: • Health monitor • Automatic Diagnostic Repository Appendix A—The SQL Scripts Used in This Book The appendix provides a quick reference to all the scripts used and referenced in the book xxxii www.it-ebooks.info ■ Contents RAP Testing Phase VI—Database Scalability������������������������������������������������������������������������������������������������������� 17 RAP Testing Phase VII—Application Scalability��������������������������������������������������������������������������������������������������� 17 RAP Testing Phase VIII—Burnout Testing������������������������������������������������������������������������������������������������������������ 18 Creating an Application Testing Environment������������������������������������������������������������������������������18 How Much to Tune?���������������������������������������������������������������������������������������������������������������������18 Conclusion�����������������������������������������������������������������������������������������������������������������������������������19 ■■Chapter 2: Capacity Planning and Architecture��������������������������������������������������������������21 Analyzing the Stack���������������������������������������������������������������������������������������������������������������������22 Capacity Planning������������������������������������������������������������������������������������������������������������������������23 How to Measure Scaling�������������������������������������������������������������������������������������������������������������������������������������� 26 Estimating Size of Database Objects������������������������������������������������������������������������������������������������������������������� 26 Architecture���������������������������������������������������������������������������������������������������������������������������������28 Oracle Single-Instance vs Clustered Configuration�������������������������������������������������������������������������������������������� 29 RAC Architecture�������������������������������������������������������������������������������������������������������������������������������������������������� 29 Conclusion�����������������������������������������������������������������������������������������������������������������������������������54 ■■Chapter 3: Testing for Availability�����������������������������������������������������������������������������������55 Points of Failure (Gaps)���������������������������������������������������������������������������������������������������������������55 Interconnect Failure��������������������������������������������������������������������������������������������������������������������������������������������� 56 Node Failure�������������������������������������������������������������������������������������������������������������������������������������������������������� 65 Instance Failure��������������������������������������������������������������������������������������������������������������������������������������������������� 67 Oracle Component Failure����������������������������������������������������������������������������������������������������������������������������������� 67 Media Failure������������������������������������������������������������������������������������������������������������������������������68 Protecting the Database�������������������������������������������������������������������������������������������������������������������������������������� 69 Testing Hardware for Availability�������������������������������������������������������������������������������������������������69 RAP Phase I��������������������������������������������������������������������������������������������������������������������������������������������������������� 69 Testing Application for Availability�����������������������������������������������������������������������������������������������75 RAP Phase II—Availability and Load Balancing��������������������������������������������������������������������������������������������������� 76 RAP Phase III—HA����������������������������������������������������������������������������������������������������������������������������������������������� 79 RAP Phase IV—Backup and Recovery����������������������������������������������������������������������������������������������������������������� 82 Conclusion�����������������������������������������������������������������������������������������������������������������������������������85 viii www.it-ebooks.info ■ Contents ■■Chapter 4: Testing for Scalability������������������������������������������������������������������������������������87 Scale-Up or Scale-Out�����������������������������������������������������������������������������������������������������������������87 Scale-Up�������������������������������������������������������������������������������������������������������������������������������������������������������������� 87 Scale-Out������������������������������������������������������������������������������������������������������������������������������������������������������������� 88 Scalable Components������������������������������������������������������������������������������������������������������������������89 Interconnect�������������������������������������������������������������������������������������������������������������������������������������������������������� 89 ASM��������������������������������������������������������������������������������������������������������������������������������������������������������������������� 92 Instance��������������������������������������������������������������������������������������������������������������������������������������������������������������� 92 SQL*Net��������������������������������������������������������������������������������������������������������������������������������������������������������������� 92 Testing Hardware for Scalability�������������������������������������������������������������������������������������������������93 RAP Phase V Hardware Scalability���������������������������������������������������������������������������������������������������������������������� 93 Testing the Database for Scalability������������������������������������������������������������������������������������������102 Testing Application for Scalability���������������������������������������������������������������������������������������������102 RAP Phase VII Application Scalability���������������������������������������������������������������������������������������������������������������� 102 End-to-End Testing��������������������������������������������������������������������������������������������������������������������107 RAP Testing Phase VIII Burnout Tests����������������������������������������������������������������������������������������107 Conclusion���������������������������������������������������������������������������������������������������������������������������������110 ■■Chapter 5: Real Application Testing������������������������������������������������������������������������������111 Testing Methods������������������������������������������������������������������������������������������������������������������������112 Method I—Using Homegrown Utilities�������������������������������������������������������������������������������������������������������������� 112 Method II—Using Real Application Testing�������������������������������������������������������������������������������������������������������� 113 Conclusion���������������������������������������������������������������������������������������������������������������������������������143 ■■Chapter 6: Tools and Utilities�����������������������������������������������������������������������������������������145 Oracle Enterprise Manager�������������������������������������������������������������������������������������������������������145 Performance Manager��������������������������������������������������������������������������������������������������������������������������������������� 147 SQL Advisory������������������������������������������������������������������������������������������������������������������������������������������������������ 148 Automatic Workload Repository������������������������������������������������������������������������������������������������������������������������ 150 Automatic Workload Repository Warehouse������������������������������������������������������������������������������������������������������ 155 Automatic Database Diagnostic Monitor����������������������������������������������������������������������������������������������������������� 156 Active Session History��������������������������������������������������������������������������������������������������������������������������������������� 159 ix www.it-ebooks.info ■ Contents Tools and Utilities from Oracle Support�������������������������������������������������������������������������������������160 OSWATCHER������������������������������������������������������������������������������������������������������������������������������������������������������ 160 Light Onboard Monitor (LTOM)��������������������������������������������������������������������������������������������������������������������������� 165 Cluster Health Monitor (CHM)����������������������������������������������������������������������������������������������������171 Architecture������������������������������������������������������������������������������������������������������������������������������������������������������� 172 CHM Statistics��������������������������������������������������������������������������������������������������������������������������������������������������� 173 EXPLAIN PLAN���������������������������������������������������������������������������������������������������������������������������176 DBMS_SQLTUNE������������������������������������������������������������������������������������������������������������������������177 SQL Trace����������������������������������������������������������������������������������������������������������������������������������180 Event 10046������������������������������������������������������������������������������������������������������������������������������182 Level 1��������������������������������������������������������������������������������������������������������������������������������������������������������������� 182 Level 4��������������������������������������������������������������������������������������������������������������������������������������������������������������� 183 Level 8��������������������������������������������������������������������������������������������������������������������������������������������������������������� 184 Level 12������������������������������������������������������������������������������������������������������������������������������������������������������������� 184 Event 10053������������������������������������������������������������������������������������������������������������������������������185 Service-Module-Action�������������������������������������������������������������������������������������������������������������191 The trcsess Utility����������������������������������������������������������������������������������������������������������������������195 Oracle’s Wait Interface��������������������������������������������������������������������������������������������������������������196 Conclusion���������������������������������������������������������������������������������������������������������������������������������199 ■■Chapter 7: SQL Tuning���������������������������������������������������������������������������������������������������201 SQL Execution Life Cycle�����������������������������������������������������������������������������������������������������������201 Step 1: Create a Cursor�������������������������������������������������������������������������������������������������������������������������������������� 203 Step 2: Parse the Statement������������������������������������������������������������������������������������������������������������������������������ 203 Step 3: Describe the Results����������������������������������������������������������������������������������������������������������������������������� 207 Step 4: Define Query Output������������������������������������������������������������������������������������������������������������������������������ 207 Step 5: Bind Any Variables��������������������������������������������������������������������������������������������������������������������������������� 207 Step 6: Parallelize the Statement���������������������������������������������������������������������������������������������������������������������� 207 x www.it-ebooks.info ■ Contents Step 7: Execute the Statement�������������������������������������������������������������������������������������������������������������������������� 208 Step 8: Fetch Rows�������������������������������������������������������������������������������������������������������������������������������������������� 208 Step 9: Close the Cursor������������������������������������������������������������������������������������������������������������������������������������ 208 Capturing Execution Times��������������������������������������������������������������������������������������������������������208 TIMED_STATISTICS�������������������������������������������������������������������������������������������������������������������������������������������� 208 STATISTICS_LEVEL��������������������������������������������������������������������������������������������������������������������������������������������� 209 V$STATISTICS_LEVEL����������������������������������������������������������������������������������������������������������������������������������������� 209 TIMED_OS_STATISTICS�������������������������������������������������������������������������������������������������������������������������������������� 210 What Are Consistent Gets?��������������������������������������������������������������������������������������������������������211 Logical Reads���������������������������������������������������������������������������������������������������������������������������������������������������� 212 Physical Reads�������������������������������������������������������������������������������������������������������������������������������������������������� 215 Why Tune?���������������������������������������������������������������������������������������������������������������������������������216 Optimizer����������������������������������������������������������������������������������������������������������������������������������������������������������� 216 Optimizer Statistics������������������������������������������������������������������������������������������������������������������������������������������� 231 Conclusion���������������������������������������������������������������������������������������������������������������������������������234 ■■Chapter 8: Parallel Query Tuning�����������������������������������������������������������������������������������235 Why Parallel Processing?����������������������������������������������������������������������������������������������������������236 Oracle and Parallel Processing��������������������������������������������������������������������������������������������������237 Parallel Query Architecture�������������������������������������������������������������������������������������������������������������������������������� 238 Methods of Applying Parallelism����������������������������������������������������������������������������������������������������������������������� 240 Parallel Processing in RAC�������������������������������������������������������������������������������������������������������������������������������� 250 Parallel Recovery����������������������������������������������������������������������������������������������������������������������������������������������� 262 Optimizing Parallel Operations��������������������������������������������������������������������������������������������������263 Data Dictionary Views to Monitor Parallel Operations��������������������������������������������������������������������������������������� 265 Wait Events Related to Parallel Operations������������������������������������������������������������������������������������������������������� 272 Troubleshooting Using Oracle Event Interface��������������������������������������������������������������������������������������������������� 274 Conclusion���������������������������������������������������������������������������������������������������������������������������������275 xi www.it-ebooks.info ■ Contents ■■Chapter 9: Tuning the Database�������������������������������������������������������������������������������������277 Data Partitioning������������������������������������������������������������������������������������������������������������������������278 Partitioned Indexes��������������������������������������������������������������������������������������������������������������������279 Local Indexes����������������������������������������������������������������������������������������������������������������������������������������������������� 280 Global Indexes��������������������������������������������������������������������������������������������������������������������������������������������������� 280 Benefits of Partitioning��������������������������������������������������������������������������������������������������������������280 Partition Pruning������������������������������������������������������������������������������������������������������������������������������������������������ 280 Partition-wise Joins������������������������������������������������������������������������������������������������������������������������������������������� 281 Sequence Numbers�������������������������������������������������������������������������������������������������������������������281 Sequences and Index Contention���������������������������������������������������������������������������������������������������������������������� 281 Undo Block Considerations�������������������������������������������������������������������������������������������������������293 Hard Parses�������������������������������������������������������������������������������������������������������������������������������293 Result Cache�����������������������������������������������������������������������������������������������������������������������������295 Query Result Cache������������������������������������������������������������������������������������������������������������������������������������������� 295 Function Result Cache��������������������������������������������������������������������������������������������������������������������������������������� 306 Limitations of the Result Cache������������������������������������������������������������������������������������������������������������������������� 311 In-Memory Cache����������������������������������������������������������������������������������������������������������������������311 How Does This Work?���������������������������������������������������������������������������������������������������������������������������������������� 312 Workshop����������������������������������������������������������������������������������������������������������������������������������������������������������� 313 Conclusion���������������������������������������������������������������������������������������������������������������������������������318 ■■Chapter 10: Tuning Recovery�����������������������������������������������������������������������������������������319 Instance Recovery���������������������������������������������������������������������������������������������������������������������320 How Does Oracle Know That Recovery Is Required for a Given Data File?������������������������������������������������������� 320 The Instance Recovery Process������������������������������������������������������������������������������������������������������������������������� 321 Tuning Instance Recovery���������������������������������������������������������������������������������������������������������������������������������� 326 Redo Log Sizing Advisory���������������������������������������������������������������������������������������������������������������������������������� 330 Crash Recovery�������������������������������������������������������������������������������������������������������������������������������������������������� 333 Thread Recovery������������������������������������������������������������������������������������������������������������������������������������������������ 333 Online Block Level Recovery����������������������������������������������������������������������������������������������������������������������������� 333 xii www.it-ebooks.info ■ Contents Media Recovery�������������������������������������������������������������������������������������������������������������������������333 Fast Recovery Area�������������������������������������������������������������������������������������������������������������������335 Conclusion���������������������������������������������������������������������������������������������������������������������������������337 ■■Chapter 11: Tuning Oracle Net���������������������������������������������������������������������������������������339 Making the Connection�������������������������������������������������������������������������������������������������������������339 Connectivity Drivers������������������������������������������������������������������������������������������������������������������������������������������� 340 Oracle Net Foundation Layer (ONFL)������������������������������������������������������������������������������������������������������������������ 340 Oracle Protocol Support Layer��������������������������������������������������������������������������������������������������������������������������� 341 Listeners������������������������������������������������������������������������������������������������������������������������������������������������������������ 341 Load Balancing�������������������������������������������������������������������������������������������������������������������������������������������������� 342 Tracing the Load Metric Capture����������������������������������������������������������������������������������������������������������������������� 344 Connection Throughput�������������������������������������������������������������������������������������������������������������345 Workshop����������������������������������������������������������������������������������������������������������������������������������������������������������� 346 Wait Events related to SQL*Net������������������������������������������������������������������������������������������������������������������������� 351 Conclusion���������������������������������������������������������������������������������������������������������������������������������353 ■■Chapter 12: Tuning the Storage Subsystem������������������������������������������������������������������355 Choosing Storage����������������������������������������������������������������������������������������������������������������������355 Transaction-Based Workload����������������������������������������������������������������������������������������������������������������������������� 356 Throughput-Based Workload����������������������������������������������������������������������������������������������������������������������������� 356 Mixed Workload������������������������������������������������������������������������������������������������������������������������������������������������� 356 Choosing the Storage Array�������������������������������������������������������������������������������������������������������357 Storage-Wide Considerations for Performance�������������������������������������������������������������������������357 Disk Drive Performance������������������������������������������������������������������������������������������������������������������������������������� 358 Storage Contention�������������������������������������������������������������������������������������������������������������������������������������������� 360 Oracle Files and RAID����������������������������������������������������������������������������������������������������������������365 Datafiles������������������������������������������������������������������������������������������������������������������������������������������������������������ 365 Redolog Files����������������������������������������������������������������������������������������������������������������������������������������������������� 368 Testing to Determine Performance��������������������������������������������������������������������������������������������368 Types of I/O Operations�������������������������������������������������������������������������������������������������������������������������������������� 369 Oracle and I/O Characteristics��������������������������������������������������������������������������������������������������������������������������� 371 xiii www.it-ebooks.info ■ Contents Oracle-Supported Access Types������������������������������������������������������������������������������������������������374 Clustered File System���������������������������������������������������������������������������������������������������������������������������������������� 374 Automatic Storage Management����������������������������������������������������������������������������������������������������������������������� 374 ASM Clustered File System������������������������������������������������������������������������������������������������������������������������������� 375 ASM Architecture�����������������������������������������������������������������������������������������������������������������������376 Allocation Units�������������������������������������������������������������������������������������������������������������������������377 How Many Diskgroups?������������������������������������������������������������������������������������������������������������379 Monitoring ASM�������������������������������������������������������������������������������������������������������������������������379 Data Dictionary Views to Monitor Storage��������������������������������������������������������������������������������������������������������� 380 Enterprise Manager to Monitor Storage������������������������������������������������������������������������������������������������������������ 382 Conclusion���������������������������������������������������������������������������������������������������������������������������������385 ■■Chapter 13: Tuning Global Cache�����������������������������������������������������������������������������������387 Global Cache�����������������������������������������������������������������������������������������������������������������������������387 RAC Specific Background Processes����������������������������������������������������������������������������������������388 LMSn����������������������������������������������������������������������������������������������������������������������������������������������������������������� 389 LMON����������������������������������������������������������������������������������������������������������������������������������������������������������������� 389 LMDn����������������������������������������������������������������������������������������������������������������������������������������������������������������� 390 LCK0������������������������������������������������������������������������������������������������������������������������������������������������������������������ 390 LMHB����������������������������������������������������������������������������������������������������������������������������������������������������������������� 390 ACMS����������������������������������������������������������������������������������������������������������������������������������������������������������������� 390 RMSn����������������������������������������������������������������������������������������������������������������������������������������������������������������� 391 RSMN����������������������������������������������������������������������������������������������������������������������������������������������������������������� 391 PING������������������������������������������������������������������������������������������������������������������������������������������������������������������� 391 IPC0������������������������������������������������������������������������������������������������������������������������������������������������������������������� 391 LDDn������������������������������������������������������������������������������������������������������������������������������������������������������������������ 391 Resource Availability����������������������������������������������������������������������������������������������������������������������������������������� 391 Think Outside the Interconnect�������������������������������������������������������������������������������������������������398 Scenario 1: Block Request Involving Two Instances������������������������������������������������������������������������������������������ 399 Scenario 2: Block Request Involving Three Instances��������������������������������������������������������������������������������������� 402 Prepare Phase��������������������������������������������������������������������������������������������������������������������������������������������������� 405 xiv www.it-ebooks.info ■ Contents Transfer Phase��������������������������������������������������������������������������������������������������������������������������������������������������� 406 Workshop����������������������������������������������������������������������������������������������������������������������������������������������������������� 407 Mastering and Remastering������������������������������������������������������������������������������������������������������414 Monitoring Remastering������������������������������������������������������������������������������������������������������������������������������������ 416 Manual Remastering����������������������������������������������������������������������������������������������������������������������������������������� 422 Global Cache Optimization��������������������������������������������������������������������������������������������������������424 Queries with High Cluster Overhead������������������������������������������������������������������������������������������������������������������ 427 Blockers and Deadlocks������������������������������������������������������������������������������������������������������������������������������������ 429 Identifying Hot Blocks���������������������������������������������������������������������������������������������������������������������������������������� 429 Data Dictionary Views to Monitor Global Cache������������������������������������������������������������������������������������������������ 434 Enterprise Manager to Monitor Global Cache���������������������������������������������������������������������������������������������������� 445 Troubleshooting Using Oracle Event Interface��������������������������������������������������������������������������������������������������� 447 Conclusion���������������������������������������������������������������������������������������������������������������������������������449 ■■Chapter 14: Tuning the Cluster Interconnect�����������������������������������������������������������������451 Cluster Interconnect������������������������������������������������������������������������������������������������������������������451 Block Transfer���������������������������������������������������������������������������������������������������������������������������������������������������� 453 Types of Interconnects��������������������������������������������������������������������������������������������������������������������������������������� 454 Network Throughput and Bandwidth����������������������������������������������������������������������������������������������������������������� 455 Verifying the Interconnect���������������������������������������������������������������������������������������������������������458 Check 1�������������������������������������������������������������������������������������������������������������������������������������������������������������� 458 Check 2�������������������������������������������������������������������������������������������������������������������������������������������������������������� 462 Check 3�������������������������������������������������������������������������������������������������������������������������������������������������������������� 463 Check 4�������������������������������������������������������������������������������������������������������������������������������������������������������������� 463 Check 5�������������������������������������������������������������������������������������������������������������������������������������������������������������� 465 Think Inside the Interconnect����������������������������������������������������������������������������������������������������465 Prepare Phase��������������������������������������������������������������������������������������������������������������������������������������������������� 466 Transfer Phase��������������������������������������������������������������������������������������������������������������������������������������������������� 466 Workshop����������������������������������������������������������������������������������������������������������������������������������������������������������� 467 Linear Scalability of Private Interconnect���������������������������������������������������������������������������������������������������������� 478 xv www.it-ebooks.info ■ Contents Interconnect Monitoring������������������������������������������������������������������������������������������������������������482 Workshop����������������������������������������������������������������������������������������������������������������������������������������������������������� 482 Data Dictionary Views to Monitor Cluster Interconnect������������������������������������������������������������������������������������� 487 Enterprise Manager to Monitor Cluster Interconnect���������������������������������������������������������������������������������������� 490 Conclusion���������������������������������������������������������������������������������������������������������������������������������493 ■■Chapter 15: Optimize Distributed Workload������������������������������������������������������������������495 Service Framework�������������������������������������������������������������������������������������������������������������������495 Manageability���������������������������������������������������������������������������������������������������������������������������������������������������� 495 Availability��������������������������������������������������������������������������������������������������������������������������������������������������������� 496 Performance������������������������������������������������������������������������������������������������������������������������������������������������������ 496 Server Pools������������������������������������������������������������������������������������������������������������������������������497 Distributed Workload Management (DWM)�������������������������������������������������������������������������������498 Resource Manager�������������������������������������������������������������������������������������������������������������������������������������������� 498 Fast Application Notification (FAN)�������������������������������������������������������������������������������������������������������������������� 498 Fast Connect Failover (FCF)������������������������������������������������������������������������������������������������������������������������������� 507 Load Balancing��������������������������������������������������������������������������������������������������������������������������510 Client Load Balancing���������������������������������������������������������������������������������������������������������������������������������������� 510 Connection Load Balancing������������������������������������������������������������������������������������������������������������������������������� 511 Applications Using Connection Pooling������������������������������������������������������������������������������������������������������������� 513 Locating the Problem����������������������������������������������������������������������������������������������������������������527 Workshop����������������������������������������������������������������������������������������������������������������������������������������������������������� 531 Troubleshooting Using Oracle Event Interface��������������������������������������������������������������������������������������������������� 542 Conclusion���������������������������������������������������������������������������������������������������������������������������������543 ■■Chapter 16: Oracle Clusterware Diagnosis��������������������������������������������������������������������545 Oracle Clusterware��������������������������������������������������������������������������������������������������������������������545 The Oracle Cluster Registry (OCR)��������������������������������������������������������������������������������������������������������������������� 546 The Oracle Local Registry (OLR)������������������������������������������������������������������������������������������������������������������������ 547 High Availability Service (HAS)�������������������������������������������������������������������������������������������������������������������������� 553 The Cluster Synchronization Service (CSS)������������������������������������������������������������������������������������������������������� 556 Cluster/Node Failures/Evictions������������������������������������������������������������������������������������������������������������������������ 559 xvi www.it-ebooks.info ■ Contents OCR Administration Utilities������������������������������������������������������������������������������������������������������570 OCR Verification (ocrcheck) Utility��������������������������������������������������������������������������������������������������������������������� 570 OCR Configuration (ocrconfig) Utility����������������������������������������������������������������������������������������������������������������� 571 OCR Dump (ocrdump) Utility������������������������������������������������������������������������������������������������������������������������������ 574 Workshop����������������������������������������������������������������������������������������������������������������������������������������������������������� 574 EVMD Verification����������������������������������������������������������������������������������������������������������������������578 Grid Plug and Play���������������������������������������������������������������������������������������������������������������������579 Monitoring Resource Utilization in the Cluster��������������������������������������������������������������������������582 Step 1���������������������������������������������������������������������������������������������������������������������������������������������������������������� 583 Step 2���������������������������������������������������������������������������������������������������������������������������������������������������������������� 583 Step 3���������������������������������������������������������������������������������������������������������������������������������������������������������������� 583 Conclusion���������������������������������������������������������������������������������������������������������������������������������583 ■■Chapter 17: Waits, Enqueues, and Latches��������������������������������������������������������������������585 Latches��������������������������������������������������������������������������������������������������������������������������������������585 Willing-to-Wait Mode����������������������������������������������������������������������������������������������������������������������������������������� 585 No-Wait Mode���������������������������������������������������������������������������������������������������������������������������������������������������� 586 Cache Buffers Chains���������������������������������������������������������������������������������������������������������������������������������������� 587 gc element��������������������������������������������������������������������������������������������������������������������������������������������������������� 591 Redo Allocation�������������������������������������������������������������������������������������������������������������������������������������������������� 592 Classes�������������������������������������������������������������������������������������������������������������������������������������������������������������� 593 Enqueues�����������������������������������������������������������������������������������������������������������������������������������596 TX—Transaction������������������������������������������������������������������������������������������������������������������������������������������������ 599 TM—DML (Table)����������������������������������������������������������������������������������������������������������������������������������������������� 601 ST—Space Management Transaction��������������������������������������������������������������������������������������������������������������� 601 HW—Segment High Water Mark����������������������������������������������������������������������������������������������������������������������� 601 SQ—Sequence Number������������������������������������������������������������������������������������������������������������������������������������ 602 CF—Control File Transaction����������������������������������������������������������������������������������������������������������������������������� 603 xvii www.it-ebooks.info ■ Contents Waits�����������������������������������������������������������������������������������������������������������������������������������������603 Consistent Read vs Current������������������������������������������������������������������������������������������������������������������������������ 606 Cluster Waits������������������������������������������������������������������������������������������������������������������������������������������������������ 607 Mutex Waits������������������������������������������������������������������������������������������������������������������������������������������������������� 613 Conclusion���������������������������������������������������������������������������������������������������������������������������������614 ■■Chapter 18: Problem Diagnosis�������������������������������������������������������������������������������������615 Health Monitor���������������������������������������������������������������������������������������������������������������������������615 V$HM_CHECK���������������������������������������������������������������������������������������������������������������������������������������������������� 616 Running Checks������������������������������������������������������������������������������������������������������������������������������������������������� 617 HM Using EM����������������������������������������������������������������������������������������������������������������������������������������������������� 621 Automatic Diagnostic Repository����������������������������������������������������������������������������������������������622 ADR Actions������������������������������������������������������������������������������������������������������������������������������������������������������� 623 ADR Configuration��������������������������������������������������������������������������������������������������������������������������������������������� 625 Retention Policy������������������������������������������������������������������������������������������������������������������������������������������������� 626 Workshop—Monitoring Incidents and Problems����������������������������������������������������������������������������������������������� 630 SQL Test Case Builder���������������������������������������������������������������������������������������������������������������������������������������� 634 ORADEBUG Utility����������������������������������������������������������������������������������������������������������������������638 Critical ORA Errors���������������������������������������������������������������������������������������������������������������������643 ORA-600: Internal error code, arguments: [ ], [ ]�������������������������������������������������������������������������������������������� 643 ORA-7445: exception encountered core dump [ ][ ]�������������������������������������������������������������������������������������� 645 DBA Support Utilities�����������������������������������������������������������������������������������������������������������������645 Remote Diagnostic Agent (RDA)������������������������������������������������������������������������������������������������������������������������ 645 RAC DIAG����������������������������������������������������������������������������������������������������������������������������������������������������������� 646 ORACHK������������������������������������������������������������������������������������������������������������������������������������������������������������� 646 OLS�������������������������������������������������������������������������������������������������������������������������������������������������������������������� 649 Conclusion���������������������������������������������������������������������������������������������������������������������������������652 ■■Appendix A: The SQL Scripts Used in This Book������������������������������������������������������������653 Chapter 3—Testing for Availability��������������������������������������������������������������������������������������������653 Chapter 4—Testing for Scalability��������������������������������������������������������������������������������������������653 Chapter 6—Tools and Utilities��������������������������������������������������������������������������������������������������654 xviii www.it-ebooks.info ■ Contents Chapter 9—Tuning the Database����������������������������������������������������������������������������������������������654 Chapter 11—Tuning Oracle Net������������������������������������������������������������������������������������������������655 Chapter 12—Tuning the Storage Subsystem����������������������������������������������������������������������������655 Chapter 13—Tuning Global Cache��������������������������������������������������������������������������������������������655 Chapter 14—Tuning the Cluster Interconnect���������������������������������������������������������������������������657 Chapter 15—Optimizing Distributed Workload�������������������������������������������������������������������������657 Chapter 17—Waits, Enqueues, and Latches�����������������������������������������������������������������������������658 Chapter 18—Problem Diagnostics��������������������������������������������������������������������������������������������658 ■■Bibliography������������������������������������������������������������������������������������������������������������������661 Index���������������������������������������������������������������������������������������������������������������������������������665 xix www.it-ebooks.info About the Author Murali Vallath has more than 25 years of IT experience, including over 20 years using Oracle products Murali Vallath has in-depth experience in the IT segment His work spans industries such as broadcasting, manufacturing, telephony and transportation logistics, finance, trading, and tools development Vallath is no stranger to the software development life cycle; his solid understanding of IT covers requirement analysis, architecture, database design, application development, performance tuning, and implementation Vallath has been an Oracle ACE Director and is an Oracle Certified Database Administrator He has worked on a variety of database platforms from small to very large implementations, designing databases for high volume, machine critical, real time online transaction processing (OLTP) systems His expertise is with Oracle Real Application Clusters (RAC), and Vallath released his second book titled Oracle 10g RAC, Grid, Services & Clustering in March 2006 and has coauthored his third book, Oracle Automatic Storage Management: Under-the-Hood & Practical Deployment Guide (Automatic Storage Management [ASM]) November 2007, from Oracle Press Vallath has held several voluntary positions: (a) Founder, President of the All India Oracle Users Group (www.aioug.org), 2007–2014; (b) International Chair of the Oracle RAC SIG (special interest group), 2008–2010 (www.oracleracsig.org); (c) Founder and President of the Oracle RAC SIG, 2003–2008; (d) President of Charlotte Oracle Users Group (www.cltoug.org), 1998–2004; and (e) Contributing editor to the IOUG (Independent Oracle Users Group) SELECT Journal, 2006–2008 Vallath is known for his dedication and leadership He has been an active participant in the Oracle Beta programs, including participating in the invitation-only IOUC Beta testing at the Oracle Head Quarters in Redwood Shores, CA Vallath is a regular speaker at industry conferences, including the Oracle Open World; Oracle Technology Network (OTN) Tours’ UKOUG, AUSOUG, IOUG, and AIOUG on Oracle RAC; and Oracle RDBMS (Relational Database Management System) Performance and Tuning related topics He has conducted several seminars across the four continents for Oracle University under the “Oracle Celebrity” series Vallath has successfully completed over 200 small-, medium-, and terabyte-sized RAC implementations (Oracle 9i, 10g, 11gR2, and 12cR1) for reputed corporate firms When Vallath is not working on complex databases or writing books, his hobbies include photography and playing on the tabla, an Indian instrument Vallath maintains a technical blog of his Oracle RAC and ASM discoveries at www.muralivallath.com xxi www.it-ebooks.info About the Technical Reviewer Arup Nanda has been an Oracle database administrator (DBA) since 1993, dealing with everything from modeling to security, and has a lot of gray hairs to prove it He has coauthored five books, written 500+ published articles, presented 300+ sessions, delivered training sessions in 22 countries, and actively blogs at arup.blogspot.com He is an Oracle ACE Director, a member of Oak Table Network, an editor for SELECT Journal (the IOUG publication), and a member of the Board for Exadata SIG Oracle awarded him the DBA of the Year in 2003 and Architect of the Year in 2012 He lives in Danbury, CT, with his wife Anu and son, Anish xxiii www.it-ebooks.info Acknowledgments In James Patterson’s book, Suzanne’s Dairy for Nicholas, he writes on the importance of life and compares it to a game in which you are juggling five balls “Imagine life is a game in which you are juggling five balls The balls are called work, family, health, friends, and integrity And you’re keeping all of them in the air But one day you finally come to understand that work is a rubber ball If you drop it, it will bounce back The other four balls are made of glass If you drop one of these, it will be irrevocably scuffed, nicked, perhaps even shattered.” What a simple but valuable example for the importance of life and family values In spite of my assignments spread across different regions of the world or being actively involved in organizing events for the Oracle user group and having to be away for several weeks, my family has been very supportive during the periods of ups and downs of life With all of these activities, the book project took a great hit in keeping up with the schedule, which meant spending even more time at home trying to complete it I am beyond words in expressing my thanks to my wife Jaya and my two children, Grishma and Nabhas, for their patience and sacrifices during the unbelievable number of days we have missed each other either because I was away on some assignment, spending time for user groups, speaking at a conference, or working on my book at home I love you all so much My parents have always been the inspiration to find new venues and opportunities to improve My passion for being actively involved with user groups comes from my father, who has always shown my sister and me the right directions in life They have taught us that giving back to society in ways possible within your circle of interest is important to make life complete Thank you, achha and amma; you have provided the true light and directions: You just don’t know how much you have helped me Many of the practical examples and outputs contained in this book are based on my troubleshooting and optimization projects During this process, I have met with several intelligent minds whose knowledge and enthusiasm have always told me that education never stops and opportunities are endless Life is short and is an everyday challenge because so much has to be learned in a short span The book would be incomplete if I did not thank friends like Erik Petterson, Sar Maoz, Tom Kyte, Jonathan Lewis, Krishnadev Telikicherla, Srikanth Kalluri, K Gopalakrishnan, Gopal Subramanian, P.S Janakiram, Ganesh Jayaraman, Syed Ahmed, and Baldev Marepally, who have in several ways provided content to this book either in the form of knowledge sharing or by helping to conduct some of the tests required, or even more importantly by providing encouragement with their words: “this is a great thing you are doing for the Oracle community by sharing your knowledge.” On many occasions, I have felt this book would not have been possible without Baldev’s help Every time I wanted a configuration to retest an issue for the workshops, he would have the server and environment available No matter how many years of experience you have in the field and how many problem-solving situations you have encountered, when dumping your thoughts into paper you need those extra eyes to make sure your thoughts are written down with accuracy In a technical book, a small error could change the complete context give it a negative spin Thanks to Michael Zoll from the RAC performance tuning team at Oracle, USA, for the informal reviews of the material during the very early phases of writing this book; and to Arup Nanda, who carries a wealth of knowledge in this Oracle technology space, for reviewing and providing criticism and suggestions to improve on the material All through this process, it has been the efforts and pursuance of Jonathan Hassell, Jonathan Gennick, Rita Fernando, Chris Nelson, and the entire team at Apress who have worked through different stages to make publishing the book even possible I am proud to have been involved in such an incredible project, and I hope my readers benefit from the efforts of so many to bring this book to life Enjoy —Murali Vallath xxv www.it-ebooks.info ... gnsd GRID HOME oracssdmonitor_root oracssdagent_root agent diag oragent _oracle oragent _oracle scriptagent _oracle diskmon srvm crs admin ctssd mdnsd racgmain racg racgevtf cvu racgeut crflogd... resources are in demand and automatically provisioning instances when an instance in a cluster or server pool is not functioning Chapter 16 Tuning the Oracle Clusterware Oracle s RAC architecture... statements send and receive information from the database using the Oracle Net interface provided by Oracle Depending on the amount of information received and sent via the Oracle Net layer,

Ngày đăng: 27/03/2019, 13:24

Từ khóa liên quan

Mục lục

  • Contents at a Glance

  • Contents

  • About the Author

  • About the Technical Reviewer

  • Acknowledgments

  • Introduction

  • Chapter 1: Methodology

    • Performance Requirements

    • Tuning the System

      • Step 1: Optimizing Workload

      • Step 2: Finding and Eliminating Contention

      • Step 3: Reduce Physical I/O

      • Step 4: Optimize Logical I/O

      • Methodology

        • Performance Tuning Methodology

          • Problem Statement

          • Information Gathering

          • Area Identification

          • Area Drilldown

          • Problem Resolution

          • Testing Against Baseline

          • Repeating the Process

          • Getting to the Obvious

          • Divide Into Quadrants

Tài liệu cùng người dùng

Tài liệu liên quan