F and DB_block_checksumtrue increase the performance burden. (To ensure data consistency, add a checksum to the block when writing data in oracle,
F, DB_block_checksum = true, which increases the performance burden. (To ensure data consistency, add a checksum to the block when writing data in oracle,
I. SGA
1. Shared pool tunning
The Optimization of the Shared pool should be given priority, because a cache miss occurs in the shared pool, which is more costly than the data buffer, because the dictionary data is generally longer than the data stored in the library cache in the memory, the key is the library cache Optimization.
Gets :( parse) the number of times the object is searched in namespace;
Pins: (execution) the number of times the object is read or executed in the namespace;
Reloads: (reparse) the number of times library cache misses occur during execution, resulting in the re-parsing of SQL statements.
1) check whether the gethitratio of the SQL area in v $ librarycache exceeds 90%. If not, check the application code to improve the efficiency of the application code.
Select gethitratio from v $ librarycache where namespace = 'SQL region ';
2) The ratio of reloads/pins in v $ librarycache should be less than 1%. If it is greater than 1%, the value of shared_pool_size should be increased.
Select sum (pins) "executions", sum (reloads) "cache misses", sum (reloads)/sum (pins) from v $ librarycache;
Reloads/pins> 1% has two possibilities: insufficient library cache space and invalid objects referenced in SQL.
3) The shared pool reserved size is generally 10% of the shared pool size and cannot exceed 50%. The request misses in V $ shared_pool_reserved is 0 or does not continue to grow, or the free_memory is greater than 50% of the shared pool reserved size, which indicates that the shared pool reserved size is too large and can be compressed.
4) convert large anonymous pl/SQL code blocks into small anonymous pl/SQL code blocks to call stored procedures.
5) from 9i, you can save the execution plan and SQL statement in the library cache for performance diagnosis. We can see execution plans from v $ SQL _plan.
6) keep large objects in the shared pool. Large objects are the main cause of memory fragmentation. in order to free up space, many small objects need to be removed from the memory, thus affecting user performance. Therefore, you need to keep some common large objects in the shared pool, and the following objects must be kept in the shared pool:
A. Frequently Used stored procedures;
B. Compiled triggers for frequently operated tables
C. Sequence, because the number may be lost after the Sequence is removed from the shared pool.
Search for large objects not saved in the library cache:
Select * from v $ db_object_cache where sharable_mem> 10000, and
Type in ('package', 'processed', 'function', 'package body') and kept = 'no ';
Save these objects in the library cache:
Execute dbms_shared_pool.keep ('package _ name ');
Corresponding Script: dbmspool. SQL
7) check whether a large anonymous pl/SQL code block exists. Two solutions:
A. convert to A small anonymous block to call the Stored Procedure
B. Keep it in the shared pool.
Check whether there are too many anonymous pl/SQL blocks:
Select SQL _text from v $ sqlarea where command_type = 47 and length (SQL _text)> 500;
8) Optimization of Dictionary cache
To avoid the occurrence of Dictionary cache misses or the number of misses remains stable, you can adjust the size of the dictionary cache indirectly by adjusting the shared_pool_size.
Percent misses should be low: Most should be less than 2%, and the total should be less than 15%
Select sum (getmisses)/sum (gets) from v $ rowcache;
If the value exceeds 15%, the value of shared_pool_size is increased.
2. Buffer Cache
1) set the granule size. db_cache_size defines the default buffer pool size in bytes.
If SGA <128 M, granule = 4 M, otherwise granule = 16 M, that is, when you need to adjust sga, increase the size in granule, and the size of sga should be an integer multiple of granule.
2) Adjust the buffer cache size according to v $ db_cache_advice.
SELECT size_for_estimate, buffers_for_estimate, estd_physical_read_factor, estd_physical_reads
FROM v $ db_cache_advice where and advice_status = 'on'
AND block_size = (SELECT Value FROM v $ parameter WHERE );
Estd_physical_read_factor <= 1
3) Calculate cache hit ratio> 90% of buffer cache. If it is lower than 90%, use the following solutions:
◆ Increase the buffer cache value;
◆ Multiple buffer pools are used;
◆ Cache table;
◆ Create an independent buffer cache for sorting and parallel reads;
Select name, value FROM v $ sysstat where name in ('session logical reads ',
'Physical reads', 'Physical reads direct ', 'Physical reads direct (lob )');
Cache hit ratio = 1-(physical reads-physical reads direct (lob)/session logical reads; Select 1-(phy. value-dir.value-lob.value)/log. value from v $ sysstat log, v $ sysstat phy, v $ sysstat dir, v $ sysstat LOB where log. name = 'session logical reads' and phy. name = 'physical reads' and dir. name = 'physical reads direct 'and lob. name = 'physical reads direct (lob )';
Factors Affecting cache hit ratio: full table scan, application design, random access to large tables, and unbalanced distribution of cache hits
4) Table space uses automatic space management to eliminate the need for free space lists and reduce database competition.
3. Other SGA objects
1) redo log buffer
The corresponding parameter is log_buffer. The default value is related to OS, which is generally 500 kb. Check whether log buffer wait exists in v $ session_wait and redo buffer allocation retries exists in v $ sysstat.
A. check whether there is log buffer wait:
Select * from v $ session_wait where event = 'Log buffer wait ';
If a wait occurs, you can increase the log buffer size or move the log file to a disk with faster access speed.
B,
Select name, value from v $ sysstat where name in
('Redo buffer allocation retries', 'redo entries ')
Redo buffer allocation retries is close to 0, less than 1% of redo entries. If it continues to grow, it indicates that the process has to wait for the redo buffer space. If the Redo buffer allocation retries is too large, increase the value of log_buffer.
C. Check whether disk IO competition exists in log files
Select event, total_waits, time_waited, average_wait from v $ system_event
Where event like 'Log file switch completion % ';
If there is competition, you can consider transferring the log file to an independent, faster storage device or increasing the log file.
D. Check whether the checkpoint settings are reasonable
Check whether 'checkpoint not complete' exists in the alert. log file ';
Select event, total_waits, time_waited, average_wait from v $ system_event
Where event like 'Log file switch (check % ';
If there is a wait, adjust the log_checkpoint_interval and log_checkpoint_timeout settings.
E. Check the work of log archiver.
Select event, total_waits, time_waited, average_wait from v $ system_event
Where event like 'Log file switch (arch % ';
If there is a wait, check whether the storage device that saves the archived logs is full. Add a log file group and adjust log_archiver_max_processes.
F, DB_block_checksum = true, which increases the performance burden. (To ensure data consistency, add a checksum to the block when writing data in Oracle, and verify the checksum when reading data)
2) java pool
For large applications, java_pool_size should be greater than or equal to 50 M. For general java stored procedures, the default 20 M is enough.
3) Check whether DBWn needs to be adjusted
Select total_waits from v $ system_event where event = 'free buffer waits ';