:: Home

  login:        
  passwords:  

Oracle Tuning Interview Questions & FAQs

Questions and answers for Development.


4. Tuning Questions

    4.1 A tablespace has a table with 30 extents in it. Is this bad? Why or why not.
    4.2 How do you set up tablespaces during an Oracle installation?
    4.3 You see multiple fragments in the SYSTEM tablespace, what should you check first?
    4.4 What are some indications that you need to increase the SHARED_POOL_SIZE parameter?
    4.5 What is the general guideline for sizing db_block_size and db_multi_block_read for an application that does many full table scans?
    4.6 What is the fastest query method for a table?
    4.7 Explain the use of TKPROF? What initialization parameter should be turned on to get full TKPROF output?
    4.8 When looking at v$sysstat you see that sorts (disk) is high. Is this bad or good? If bad -How do you correct it?
    4.9 When should you increase copy latches? What parameters control copy latches?
    4.10 Where can you get a list of all initialization parameters for your instance? How about an indication if they are default settings or have been changed?
    4.11 Describe hit ratio as it pertains to the database buffers. What is the difference between instantaneous and cumulative hit ratio and which should be used for tuning?
    4.12 . Discuss row chaining, how does it happen? How can you reduce it? How do you correct it?
    4.13 When looking at the estat events report you see that you are getting busy buffer waits. Is this bad? How can you find what is causing it?
    4.14 If you see contention for library caches how can you fix it?
    4.15 If you see statistics that deal with "undo" what are they really talking about?
    4.16 If a tablespace has a default pctincrease of zero what will this cause (in relationship to the smon process)?
    4.17 If a tablespace shows excessive fragmentation what are some methods to defragment the tablespace? (7.1,7.2 and 7.3 only)
    4.18 How can you tell if a tablespace has excessive fragmentation?
    4.19What can cause a high value for recursive calls? How can this be fixed?
    4.20 If you see a pin hit ratio of less than 0.8 in the estat library cache report is this a problem? If so, how do you fix it?
    4.21 If you see the value for reloads is high in the estat library cache report is this a matter for concern?/a>
    4.22 You look at the dba_rollback_segs view and see that there is a large number of shrinks and they are of relatively small size, is this a problem? How can it be fixed if it is a problem?
    4.23 You look at the dba_rollback_segs view and see that you have a large number of wraps is this a problem?
    4.24 You see multiple extents in the temporary tablespace. Is this a problem?

4.1 A tablespace has a table with 30 extents in it. Is this bad? Why or why not.

Multiple extents in and of themselves aren?t bad. However if you also have chained rows this can hurt performance.


4.2 How do you set up tablespaces during an Oracle installation?

You should always attempt to use the Oracle Flexible Architecture standard or another partitioning scheme to ensure proper separation of SYSTEM, ROLLBACK, REDO LOG, DATA, TEMPORARY and INDEX segments.


4.3 You see multiple fragments in the SYSTEM tablespace, what should you check first?

Ensure that users don?t have the SYSTEM tablespace as their TEMPORARY or DEFAULT tablespace assignment by checking the DBA_USERS view.


4.4 What are some indications that you need to increase the SHARED_POOL_SIZE parameter?

Poor data dictionary or library cache hit ratios, getting error ORA-04031. Another indication is steadily decreasing performance with all other tuning parameters the same.


4.5 What is the general guideline for sizing db_block_size and db_multi_block_read for an application that does many full table scans?

Oracle almost always reads in 64k chunks. The two should have a product equal to 64 or a multiple of 64.


4.6 What is the fastest query method for a table?

Fetch by rowid


4.7 Explain the use of TKPROF? What initialization parameter should be turned on to get full TKPROF output?

The tkprof tool is a tuning tool used to determine cpu and execution times for SQL statements. You use it by first setting timed_statistics to true in the initialization file and then turning on tracing for either the entire database via the sql_trace parameter or for the session using the ALTER SESSION command. Once the trace file is generated you run the tkprof tool against the trace file and then look at the output from the tkprof tool. This can also be used to generate explain plan output.


4.8 When looking at v$sysstat you see that sorts (disk) is high. Is this bad or good? If bad -How do you correct it?

Expected answer: If you get excessive disk sorts this is bad. This indicates you need to tune the sort area parameters in the initialization files. The major sort are parameter is the SORT_AREA_SIZe parameter.


4.9 When should you increase copy latches? What parameters control copy latches?

When you get excessive contention for the copy latches as shown by the "redo copy" latch hit ratio. You can increase copy latches via the initialization parameter LOG_SIMULTANEOUS_COPIES to twice the number of CPUs on your system.


4.10 . Where can you get a list of all initialization parameters for your instance? How about an indication if they are default settings or have been changed?

You can look in the init.ora file for an indication of manually set parameters. For all parameters, their value and whether or not the current value is the default value, look in the v$parameter view.


4.11 Describe hit ratio as it pertains to the database buffers. What is the difference between instantaneous and cumulative hit ratio and which should be used for tuning?

The hit ratio is a measure of how many times the database was able to read a value from the buffers verses how many times it had to re-read a data value from the disks. A value greater than 80-90% is good, less could indicate problems. If you simply take the ratio of existing parameters this will be a cumulative value since the database started. If you do a comparison between pairs of readings based on some arbitrary time span, this is the instantaneous ratio for that time span. Generally speaking an instantaneous reading gives more valuable data since it will tell you what your instance is doing for the time it was generated over.


4.12 Discuss row chaining, how does it happen? How can you reduce it? How do you correct it?

Row chaining occurs when a VARCHAR2 value is updated and the length of the new value is longer than the old value and won?t fit in the remaining block space. This results in the row chaining to another block. It can be reduced by setting the storage parameters on the table to appropriate values. It can be corrected by export and import of the effected table.


4.13 When looking at the estat events report you see that you are getting busy buffer waits. Is this bad? How can you find what is causing it?

Buffer busy waits could indicate contention in redo, rollback or data blocks. You need to check the v$waitstat view to see what areas are causing the problem. The value of the "count" column tells where the problem is, the "class" column tells you with what. UNDO is rollback segments, DATA is data base buffers.


4.14 If you see contention for library caches how can you fix it?

Increase the size of the shared pool.


4.15 If you see statistics that deal with "undo" what are they really talking about?

Rollback segments and associated structures.


4.16 If a tablespace has a default pctincrease of zero what will this cause (in relationship to the smon process)?

The SMON process won?t automatically coalesce its free space fragments.


4.17 If a tablespace shows excessive fragmentation what are some methods to defragment the tablespace? (7.1,7.2 and 7.3 only)

In Oracle 7.0 to 7.2 The use of the 'alter session set events 'immediate trace name coalesce level ts#';? command is the easiest way to defragment contiguous free space fragmentation. The ts# parameter corresponds to the ts# value found in the ts$ SYS table. In version 7.3 the ?alter tablespace coalesce;? is best. If the free space isn?t contiguous then export, drop and import of the tablespace contents may be the only way to reclaim non-contiguous free space.


4.18 How can you tell if a tablespace has excessive fragmentation?

If a select against the dba_free_space table shows that the count of a tablespaces extents is greater than the count of its data files, then it is fragmented.


4.19 What can cause a high value for recursive calls? How can this be fixed?

A high value for recursive calls is cause by improper cursor usage, excessive dynamic space management actions, and or excessive statement re-parses. You need to determine the cause and correct it By either relinking applications to hold cursors, use proper space management techniques (proper storage and sizing) or ensure repeat queries are placed in packages for proper reuse.


4.20 If you see a pin hit ratio of less than 0.8 in the estat library cache report is this a problem? If so, how do you fix it?

This indicate that the shared pool may be too small. Increase the shared pool size.


4.21 If you see the value for reloads is high in the estat library cache report is this a matter for concern?

Yes, you should strive for zero reloads if possible. If you see excessive reloads then increase the size of the shared pool.


4.22 You look at the dba_rollback_segs view and see that there is a large number of shrinks and they are of relatively small size, is this a problem? How can it be fixed if it is a problem?

A large number of small shrinks indicates a need to increase the size of the rollback segment extents. Ideally you should have no shrinks or a small number of large shrinks. To fix this just increase the size of the extents and adjust optimal accordingly.


4.23 You look at the dba_rollback_segs view and see that you have a large number of wraps is this a problem?

A large number of wraps indicates that your extent size for your rollback segments are probably too small. Increase the size of your extents to reduce the number of wraps. You can look at the average transaction size in the same view to get the information on transaction size.


4.24 You see multiple extents in the temporary tablespace. Is this a problem?

As long as they are all the same size this isn?t a problem. In fact, it can even improve performance since Oracle won?t have to create a new extent when a user needs one.

Copyright 2007, Megasolutions Ltd