Sie sind auf Seite 1von 4

Database Performance Tuning & Analysis

Pradeep Koli Computer Science Deptt. Govt. College, Faridabad pradeep.koli@gmail.com


Abstract In our daily experience we see that millions of dollars worth of RAM being wasted by oracle shops. Because the Oracle DBA does not know how to accurately compute the RAM demands of the database, they under-allocate the RAM. On larger servers, RAM is still very expensive and depreciates regardless of use. The Oracle professionals or DBAs should know how to accurately predict the high water mark of RAM demands for their database, and fully allocates the RAM, reserving only enough to accommodate spikes in user connections. For an Oracle server, the goal is to keep all of the RAM memory demands of the database and database connections beneath the amount of physical RAM memory. In an Oracle environment, we can accurately control the amount of RAM memory that is used by the database instance System Global Area(SGA).This is because the Oracle database administrator can issue alter system command to change the RAM memory areas, and can grow and shrink the RAM memory areas on as needed basis to increase the performance of database. Keywords Random Access Memory, System Global Area, Program Global Area, Oracle9i,Performance.

Vijaya Shridhar Computer Science Deptt. Govt. College, Faridabad shridharvijaya@hotmail.com


Database management systems[2] can be categorized according to the database model that they support, such as relational or XML, the type(s) of computer they support, such as a server cluster or a mobile phone, the query language(s) that access the database, such as SQL, performance trade-offs, such as maximum scale or maximum speed or others. II. PERFORMANCE TUNING

A system's ability to accept higher load is called scalability[2], and modifying a system to handle a higher load is synonymous to performance tuning. Systematic tuning follows these steps:

I. INTRODUCTION A database consists of an organized collection of data for one or more uses[1], typically in digital form. One way of classifying databases involves the type of their contents, for example: bibliographic, document-text, statistical. Digital databases are managed using database management systems, which store database contents, allowing data creation and maintenance, and search and other access. Database architecture consists of three levels, external, conceptual and internal. Clearly separating the three levels was a major feature of the relational database model that dominates 21st century databases. The external level defines how users understand the organization of the data. A single database can have any number of views at the external level. The internal level defines how the data is physically stored and processed by the computing system. Internal architecture is concerned with cost, performance, scalability and other operational matters. The conceptual is a level of indirection between internal and external. It provides a common view of the database that is uncomplicated by details of how the data is stored or managed, and that can unify the various external views into a coherent whole. A database management system (DBMS) consists of software that operates databases, providing storage, access, security, backup and other facilities.

Assess the problem and establish numeric values that categorize acceptable behavior. Measure the performance of the system before modification. Identify the part of the system that is critical for improving the performance. This is called the bottleneck. Modify that part of the system to remove the bottleneck.

A performance problem may be identified by slow or unresponsive systems. This usually occurs because high system loading, causing some part of the system to reach a limit in its ability to respond. This limit within the system is referred to as a bottleneck. A handful of techniques are used to improve performance.Selecting indexes, materialized views, horizontal and vertical partitions that can enhance performance is a challenging optimization problem especially if storage resources are limited. Given a workload W and a space budget B, find the set of physical structures or configuration, that fits in the B and results in the lowest execution cost for the queries in W.
III. LEVEL OF AUTOMATION There are two levels for automation[4] of performance tuning: Physical Database Design System Internal Parameters

The physical design of the database specifies the physical configuration of the database on the storage media. This includes detailed specification of data elements, data types, indexing options and other parameters residing in the DBMS data dictionary. It is the detailed design of a system that includes modules & the database's hardware & software specifications of the system.The physical database design is divided into 5 levels: Indexes Views Horizontal Partitioning Vertical partitioning Parallel database design

Figure 1: Oracle Memory Architecture Whenever a Process issues an SQL Statement, the text of the Statement goes into the Library Cache where the statement is parsed an validated. The data dictionary is a read-only set of tables that provides information about the database. Database Buffer Cache Stores copies of data blocks that have been retrieved from the data files and managed through an LRU algorithm. Redo Log Buffer records all changes made to the database. Log Archive Buffer is an optional area of memory in the SGA used for session memory for the shared server and I/O server processes. V. ORACLE SGA PARAMETERS Self-tuning Oracles memory regions involves altering the values of a number of Oracle parameters. While there are over 250 Oracle9i parameters that govern the configuration of every aspect of the database, there are only a handful of Oracle9i parameters that are important for Oracle SGA tuning: db_cache_size This parameter determines the number of database block buffers in the Oracle and is the single most parameter in Oracle memory. db_keep_cache_size This parameter is used to store small tables that perform full table scans. db_recycle_cache_size This is reserved for table blocks from very large tables that perform full table scans. large_pool_size This is a special area of the shared pool that is reserved for SGA usage when using the multithreaded server. The large pool is used for parallel query and RMAN processing, as well as setting the size of the java pool. log_buffer This parameter determines the amount of memory to allocate for Oracles redo log buffers. If there is a high amount of update activity, the log_buffer should be allocated more space. shared_pool_size This parameter defines the pool that is shared by all the users in the system, including SQL areas and data dictionary caching. A large shared_pool_size is not always better than a smaller shared pool. If your application contains nonreusable SQL,you may get better performance with a smaller shared pool. sort_area_size This parameter determines the memory region that is allocated for in-memory sorting. When the stats$sysstat value sorts(disk) becomes excessive,you may want to allocate additional memory. hash_area_size This parameter determines the memory region reserved for hash joins. pga_aggregate_target This parameter defines the RAM area reserved for system-wide sorting and hash join. sga_max_size This parameter defines the maximum size of the Oracle SGA and cannot be modified while the instance is running. VI. ORACLE9I VIEWS FOR MEMORY MANAGEMENT Oracle9i has introduced several new views and new columns in existing views to aid in assessing the internal allocation of RAM memory in Oracle9i. The following new

System Internal Parameters level is divided into two categories: SGA Management PGA Management The System Global Area (SGA) is a group of shared memory areas that are dedicated to an Oracle instance (an instance is your database programs and RAM). Each Oracle instance uses a System Global Area or SGAa sharedmemory areato store its data and control-information. Each Oracle instance allocates itself an SGA when it starts and deallocates it at shut-down time. The PGA(Program Global Area) is a memory region containing data and control information for a single process (server or background). One PGA is allocated for each server process, the PGA is exclusive to that server process and is read and written only by Oracle code acting on behalf of that process. A PGA is allocated by Oracle when a user connects to an Oracle database and a session is created. IV. ORACLE MEMORY ARCHITECUTRE Shared Pool is used to store most recently executed SQL

statements and most recently used data definitions. Figure 1 is use here to represent the architecture for oracle memory.

v$ views can be used to monitor RAM memory usage of dedicated Oracle9i connections. v$process Three new columns are added in Oracle9i for monitoring memory usage. The new columns are pga_used_mem , pga_alloc_mem and pga_max_mem. v$sysstat There are many new statistics rows, including work area statistics for optimal, one pass, and multi-pass. v$pga_stat This new view shows internals of PGA memory usage for all background processes and dedicated connections. v$sql_plan This exciting new view contains execution plan information for all currently executing SQL. This is a tremendous tool for the performance tuning professional who must locate suboptimal SQL statements. v$workarea This new view provides detailed cumulative statistics on RAM memory usage for Oracle9i connections. v$workarea_active This new view shows internal RAM memory usage information for all currently executing SQL statements. v$parameter This view displays information about the initialization parameters that are currently in effect for the session. VII. IMPLEMENTING SQL SCRIPTS FOR ORACLE9I The goal for an oracle server is to keep the RAM memory demands of the database and database connections below the amount of physical RAM memory. We can control the amount of the RAM used by the database SGA in an oracle environment by issuing alter system commands. Script for adjusting the RAM caches set heading off set feedback off set verify off accept decrease_pool char prompt 'Enter cache to decrease: ' accept increase_pool char prompt 'Enter cache to increase: ' accept change_amount number prompt 'Enter amount to change: ' spool run_sga.sql select 'alter system set &decrease_pool = '||to_char(to_number(value)-&change_amount)||';' from v$parameter where name = lower('&decrease_pool'); select 'alter system set &increase_pool = '||to_char(to_number(value)+&change_amount)||';' from v$parameter where name = lower('&increase_pool'); spool off

set feedback on Result SQL> @run_sga Enter cache to decrease: shared_pool_size Enter cache to increase: db_cache_size Enter amount to change: 1048576 alter system set shared_pool_size = 49283072; System altered. alter system set db_cache_size = 17825792; System altered. This script prompts the DBA for the name of the cache and the sizes and issues the proper appropriate alter system commands to adjust the regions. Script Report For Object Access set echo off; set feedback on set pages 999; column nbr_FTS format 999,999 column num_rows format 999,999,999 column blocks format 999,999 column owner format a14; column name format a24; column ch format a1; column object_owner heading "Owner" format a12; column ct heading "# of SQL selects" format 999,999; select object_owner, count(*) ct from v$sql_plan where object_owner is not null group by object_owner order by ct desc Result owner # of SQL selects ------------ -----------------------------SYS 473 AURORA$JIS$U 8 TILITY$ SYSTEM 5 MDSYS 1 SCOTT 1 VIII. CONCLUSION Tuning the database can become quite complex, but Oracle9i offers the administrator an unparalleled ability to

control the PGA and SGA. Until Oracle9i evolves into a completely self-tuning architecture, the DBA will be responsible for adjusting the dynamic configuration of the system RAM. Automated SGA adjustment scripts can be used to allow the DBA to grow and shrink the SGA regions. These scripts are placed in dbms_job for scheduled processing. Oracle provides enhanced views in v$process, v$pgastat to allow you to monitor the behaviour of the RAM sort area. The v$ views in Oracle9i also provides insights about the RAM usage for individual SQL statements within the library cache. IX. FUTURE WORK As people get more sophisticated in their self tuning endeavors, many more Oracle metrics may become self-tuning. For example, there are dozens of self-tuning parameters that are considered immutable that may be found to be changeable. As an example, lets consider the optimizer_index_cost_adj parameter. Oracle Corporation has invested millions of dollars in making the cost-based SQL optimizer(CBO) one of the most sophisticated tools ever created. The job of the CBO is to always choose the most optimal execution plan for any SQL statements. However, there are some things that the CBO cannot detect. The type of SQL statements, the speed of the disks, and the load on the CPUs all effect the best execution plan for an SQL statement. For example, the best execution plan at 4:00AM,when 16 CPUs are idle, may be quite different from the same query at 3:00PM,when the system is 90% utilized. Despite the name Oracle, the CBO is not psychic, and it can never know in advance the exact load on the system. Hence, the Oracle professional must adjust the CBO behaviour, and most Oracle professionals adjust the CBO with two parameters: optimizer_index_cost_adj optimizer_index_caching The parameter optimizer_index_cost_adj controls the CBOs propensity to favour index scans over full-table scans.
X. [1]

[8] B. Raza, A. Mateen, M.M. Awais and T. Hussain, Autonomicity in Oracle Databases Management System, International Conference On Data Storage and Data Engineering, India. 2010. [9] S. Elnaffar, P. Martin and R. Horman, Automatically Classifying Databases Workloads, Proceedings of ACM Conference on Information and Knowledge Management (CIKMACM02), November 2002. [10] S. Elnaffar, W. Powley, D. Benoit, and P. Martin, "Todays DBMSs: How Autonomic Are They?", Proceedings First International Autonomic Systems Workshop, DEXA, 2003 [11] J. O. Kephart, D. M. Chess, "The Vision of Autonomic Computing", IEEE Computer 36(1), pp 41-50, 2003. [12] R. Sterritt, D. W. Bustard, "Autonomic Computing A Means of Achieving Dependability?", Proc. 10th IEEE International Conference and Workshop on the Engineering of Computer- Based Systems (ECBS), pp 247-251, 2003.

REFERENCES

[2]

[3]

[4]

[5]

[6]

[7]

Benoit Dageville, Dinesh Das, Karl Dias, Khaled Yagoub, Mohammed zait and Mohammed Ziauddin, Automatic SQL Turing In Oracle 10g, Proceedings of the 30t h VLDB Conference , pp 1098-1109, Toranto, Canada 2004. Said Elnaffar, Wendy Powley, Darcy Benoit and Pat Martin, Todays DBMSs: How Autonomic Are They?, School of Computing, Canada 2006. Antoni Wolski and Bla Hofhauser, A Self-Managing High-Vailability Database: Industrial Case Study, International Workshop on SelfManaging Database Systems (SMDB2005), pp 1-8, 2005. Pete Belknap, Benoit Dageville, Karl Dias and Khaled Yagoub, SelfTuning for SQL Performance In Oracle Database 11g, IEEE International Conference on Data Engineering, pp 1694-1700, 2009. Abdul Mateen, Basit Raza, Muhammad Sher, Mian Muhammad Awais and Tauqeer Hussain, Evolution of Autonomic Database Management Systems, IEEE , Vol. 1, pp 33-37, 2010. Natwar Modani, Rajeev Gupta, Guy Lohman, Tanveer Syeda-Mahmood and Laurent Mignet, Automatically Identifying Known Software Problems, IEEE ,pp 433-441, 2007. B. Dageville and K. Dias, Oracles Self-Tuning Architecture and Solutions, IEEE Data Engineer Bulletin, Vol. 29, pp 1-8, March 2006.

Das könnte Ihnen auch gefallen