100 Oracle Performance Tuning Interview Questions and Answers | Frequently Asked Interview Questions - Part1
Oracle Performance Tuning Interview Questions and answers are very useful to the Fresher or Experienced person who is actively looking for a new challenging job from any reputed concern. In this video collectively provided Oracle Performance Tuning Questions and answers are very simple and have more examples for your better understanding. So utilize this Oracle Performance Tuning Interview Questions and answers to grow in your career.
Q1) Define Performance Tuning
Answer: Enabling ideal usage of the system with the prevailing resources is known as Performance Tuning.
Q2) List out the type of tunings
Answer: Different types of tunings are IO Tuning, Database Tuning, CPU Tuning, Application Tuning, and Memory Tuning.
Q3) Explain IO Tuning
Answer: Database files must be sized correctly and located on the right place to afford supreme disk subsystem quantity. Also, look out for missing indexes, regular disk sorts, row chaining, data fragmentation, complete table scans, and so on.
Q4) Explain Memory Tuning
Answer: Properly sizing the database buffers such as buffer cache, log buffer, shared pool, buffer cache by analyzing the ratios of buffer hit. Large objects are pinned into memory to avoid recurrent refills.
Q5) Explain Application Tuning
Answer: As per various experiences, it is well displaying that about 80 percent of Oracle system performance issues are fixed using optimal SQL code. Batch tasks must be properly scheduled on time.
Q6) Explain proactive tuning
Application engineers will be able to determine which grouping of oracle features and system resources will best fulfill the requirements at the time of development and planning. This process is called proactive tuning.
Q7) Explain reactive tuning
Bottom-up method is employed to discover and resolve the blockages. This process is called reactive tuning. The goal of reactive tuning is to run Oracle quicker.
Q8) Define optimizer
Optimizer, a mechanism that makes the SQL statement execution plan
Q9) What are the types of Optimizer?
Cost Based Optimizer (CBO) and Rule-Based Optimizer (RBO)
Q10) What is Rule-Based Optimizer (RBO)?
When a server does not have internal statistics with respect to the objects influenced by the statement, here RBO plays its role.
Q11) What is Cost Based Optimizer (CBO)?
If internal statistics are available, CBO method is employed over there. CBO performs various checks on all the possible execution plans and picks one that has the bottommost charge depending on the system resources.
Q12) To use Optimizer, what are the pre-requisites?
Initially set the optimizer mode and collect the object statistics
Q13) How to collect table statistics?
Examine the table emp estimate statistics (or) the table emp compute statistics
Q14) What is the abbreviation of FTS?
Abbreviation of FTS is “Full Table Scan”
Q15) Provide the difference between the estimate and compute?
FTS happens if using compute. Only 10% of the table gets read if using the estimate.
Q16) Name the best optimizer
Best optimizer is Cost Based Optimizer (CBO)
Q17) Name the optimizer which is followed by Data Dictionary
Rule-Based Optimizer (RBO) is the optimizer followed by Data Dictionary
Q18) Define Chain Rows
Chain rows are the rows that span in various blocks
Q19) Define Execution Plan
Execution plan is a road map giving details on how oracle DB executes SQL
Q20) Mention the count of Hits
There are two (2) hits
Q21) Provide the hits of Oracle Performance Tuning
Two hits of Oracle Performance Tuning are Library hit and Buffer hit
Q22) Provide the Wait Events types
Direct path read, and CPU time is the Wait Event types
Q23) Provide the quickest query method for a table?
The quickest query method for a table is to fetch by rowid
Q24) How will you fix if there is a contention for Library Caches?
If there is a contention for library caches, just increase the shared pool size
Q25) Is it a problem to have various extents in the temporary tablespace?
If all the extents are of the same size, there is no problem at all. It can even expand performance as Oracle does not require to generate a fresh extent when there is a need.
Q26) How to gather schema/user statistics?
Use ‘exec dbms_stats.gather_schema_stats(Scott)’ to gather schema/user statistics
Q27) What is the process to set up tablespaces at the time of Oracle installation?
Try to use Oracle Flexible Architecture standard or any other segregating scheme to confirm on the appropriate separation of Data, System, Temporary, Redo Log, Rollback, and Index segments.
Q28) How to find whether a tablespace has extreme or unnecessary fragmentation?
When a select against the table ‘dba_free_space’ displays that the tablespaces extents count is larger than the data files count, you can surely mention that as fragmented.
Q29) Mention the cause of a high value for recursive calls?
Extreme dynamic space administration activities, unnecessary statement re-parses, and inappropriate cursor practice can lead to a high value for recursive calls.
Q30) How to fix when seeing a high value for recursive calls?
Initially it is important to determine the causes and correct it with any of the following activities:
Make use of appropriate space management procedures
Relinking applications to grip the cursors
Confirm the repeated questions are in packages for proper reuse.
Q31) If a tablespace contains a table with 30 extents, do you think it is bad?
Multiple extents within the table is not bad. Though, if there are chained rows, it can easily wound Performance Tuning.
Q32) If there is a statistics dealing with “undo”, what do you mean by that?
It means they are talking about rollback segments and connected structures.
Q33) What will happen when a tablespace has a standard pct increase of zero with respect to the smon process?
The SMON process will not mechanically combine the available free space fragments.
Q34) Define Oracle correlated sub-queries
Oracle correlated sub-queries are the ones that make use of the values from the external query. These subqueries are executed only once and use the results of the entire assessment in the external query.
Q35) Give an example for Oracle correlated sub-queries
select student_id, fees_id, fees_amount From student
where fees_amount < (select max(fees_amount)
from student y
where student_id = y. student_id);
Q36) What is Intersect?
‘Intersect’ permits to combine the outcomes of two or more select queries. If you can see a record available in a query and not visible on the other, those records get removed from Intersect results.
Q37) What is Union?
‘Union’ operator is for combining the outcomes which are a set of two or more Select statements. Both the select statement of that table should have a similar count of columns along with the same data types as the duplicates are eliminated.
Q38) Give an example for Union concept
SELECT school_address FROM school_chennai
UNION
SELECT school_address FROM school_bangalore
Q39) List out the tools provided by Oracle to help in performance tuning
Below is the tools provided by Oracle to help in performance tuning:
Statspack
TKProf
Oracle Enterprise Manager (OEM)
SQL and UTLESTAT.SQL
Q40) What is decoding in Oracle?
The Decode function in Oracle performs a comparison with one expression to one or more other expressions. If the search expression is equal to base expression, the function returns the equivalent result. If there is no match found, the default expression is returned. If the default expression is not specified, then it returns a value as ‘NA’.
Q41) In the SYSTEM tablespace if you find multiple fragments, what should be checked first?
Make sure that users are not having the System tablespace as their default or temporary tablespace assignment by inspecting the view of DBA_USERS.
Q42) Provide the difference between latches and locks?
Maintaining read steadiness on instance memory structures is called latches. Maintaining read steadiness on tables is called locks.
Q43) When will you say a database object is invalid?
A database object is said to be invalid when the fundamental base objects are modified.
Q44) Mention a query to make use of the entire full table scan though the table has an index
Use the query “hint” to use the entire full table scan
Q45) Provide the regularity of performing database re-organization?
Database re-organization is not required if ASSM is used. If ASSM is not used, good to perform the re-organization once in every 6 months.
Q46) Why indexes are becoming unusable while moving a table?
When a table is moved, the row ids are changed, and the index is dependent on that row id. Hence, indexes become unusable.
Q47) What is the purpose of partitioning?
Partitioning helps in hunting data simply as the data are stockpiled in numerous partitions.
Q48) What is the reason to opt composite partitioning?
If there is a large table and faster access is required, composite portioning helps much.
Q49) Is it possible to move a table to the same tablespace?
Yes, it is possible to move a table to the same tablespace if we have adequate free space
Q50) Define ADDM in 10g
ADMM (Automatic Database Diagnostic Monitor) is a utility helpful in affording few endorsements depending on the statistics gathered for every 1 hour.
Q51. What is Performance Tuning?
Making optimal use of the system using existing resources is called performance tuning.
Q52. What are the different types of Tunings?
CPU Tuning
Memory Tuning
IO Tuning
Application Tuning
Database Tuning
Q53. What Mainly Database Tuning contains?
Hit Ratios
Wait for Events
Q54. What is an optimizer?
Optimizer is a mechanism that will make the execution plan of an SQL statement
Q55. Types of Optimizers?
RBO(Rule-Based Optimizer)
CBO(Cost Based Optimizer)
Q56. Which init parameter is used to make use of Optimizer?
optimizer_mode= rule—-RBO cost—CBO choose——–First CBO otherwise RBO
Q57. Which optimizer is the best one?
CBO
Q58. What are the pre-requested to make use of Optimizer?
Set the optimizer mode
Collect the statistics of an object
Q59. How do you collect statistics on a table?
analyze table emp compute statistics or analyze table emp estimate statistics
Q60. What is the diff between computing and estimate?
If you use compute, The FTS will happen, if you use estimate just 10% of the table will be read
Q61. Data Dictionary follows which optimizer mode?
RBO
Q62. How do you delete statistics of an object?
table emp delete statistics
Q63. How do you collect statistics of a user/schema?
exec dbms_stats.gather_schema_stats(Scott)
Q64. How do you see the statistics of a table?
select num_rows,blocks,empty_blocks from dba_tables where tab_name=’emp’
Q65. What are chained rows?
These are rows, it spans in multiple blocks
Q66. How do you collect statistics of a user in Oracle Apps?
fnd_stats package
Q67. How do you know what SQL is currently being used by the session?
by going v$sql and v$sql_area
Q68. What is an execution plan?
It's a road map of how SQL is being executed by oracle DBA?
Q69. How do you get the index of a table and on which column the index is?
dba_indexes and dba_ind_columns
Q70. Which init parameter you have to set to bypass parsing?
cursor_sharing=force
Q71. How do you know which session is running long jobs?
by going v$session_longops
Q72. How do you flush the shared pool?
alter system flush shared_pool
Q73. How do you get the info about FTS?
using v$sysstat
Q74. Where do you get the info on the library cache?
v$librarycache
Q75. How do you get the information about a specific session?
v$mystat
Q76. How do you see the trace files?
using tkprof — usage: tkprof allllle.trc llkld.txt
Q77. Types of hits?
Buffer hit and library hit
Q78. Types of wait events?
CPU time and direct path read
Q79. 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 Tuning.
Q80. 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.
Q81. 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.
Q82. 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.
Q83. 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.
Q84. What is the fastest query method for a table?
Fetch by rowid
Q85. Explain the use of TKPROF? What initialization parameter should be turned on to get full TKPROF output?
A 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.
Q86. When looking at v$sysstat you see that sorts (disk) are high. Is this bad or good? If bad, how do you correct it?
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 is parameter is the SORT_AREA_SIZe parameter.
Q87. 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.
Q88. 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.
Q89. Describe the hit ratio as it pertains to the database buffers. What is the difference between instantaneous and cumulative hit ratio; which should be used for tuning?
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 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.
Q90. 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 the export and import of the affected table.
Q91. 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 may 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 database buffers.
Q92. If you see contention for library caches how can you fix it?
Increase the size of the shared pool.
Q93. If you see statistics that deal with “undo” what are they really talking about?
Rollback segments and associated structures.
Q94. If a tablespace has a default pct increase of zero what will this cause (in relationship to the smon process)?
The SMON process won’t automatically coalesce its free space fragments.
Q95. 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 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.
Q96. 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.
Q97. You see the following on a status report:
redo log space requests 23
redo log space wait time 0
Is this something to worry about? What if the redo log space wait time is high? How can you fix this?
Since the wait time is zero, no. If wait time was high it might indicate a need for more or larger redo logs.
Q98. What can cause a high value for recursive calls? How can this be fixed?
A high value for recursive calls is caused 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.
Q99. 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 indicates that the shared pool may be too small. Increase the shared pool size.
Q100. If you see the value for reloads is high in the estat library cache report is this a matter of concern?
Yes, you should strive for zero reloads if possible. If you see excessive reloads then increase the size of the shared pool.
Q101. 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.
Q102. 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 is 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.
Q103. In a system with an average of 40 concurrent users you get the following from a query on rollback extents:
ROLLBACK CUR EXTENTS
——————— ————————–
R01 11
R02 8
R03 12
R04 9
SYSTEM 4
Q104. You have room for each to grow by 20 more extents each. Is there a problem? Should you take any action?
No there is not a problem. You have 40 extents showing and an average of 40 concurrent users. Since there is plenty of room to grow no action is needed.
Q105. 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.
Hope this helps!
Cheers!
Ramesh.
Post a Comment: