Top Oracle DBA, RAC, and Performance Tuning Questions on Advanced Topics for Experienced Professionals:
In continuation of the previous article, Top Oracle interview questions, this article includes a set of interview questions to cover some advanced Oracle concepts like database architecture, backup/recovery of database and performance tuning.
Topics Covered in Oracle Advanced Interview Questions:
- Oracle DBA interview questions
- Oracle RAC interview questions
- Oracle Performance Tuning interview questions
Here, we have gathered a set of questions that will help candidates who are at the intermediate level as well as any job seeker to clear the interview successfully.
Top Oracle DBA, RAC, And Performance Tuning Questions
Enlisted is the most important Oracle Interview Questions on Advanced Topics along with the answers.
Q #1) Why do we use the materialized view instead of a table or views?
Answer: Materialized view is a database object that holds query results. If materialized views are used instead of tables or views in complex query executions, performance gets enhanced as re-execution is not required for repeated queries.
Q #2) How is the Clustered Index different from the Non-Clustered Index?
Answer: An index is a schema object, which can search the data efficiently within the table.
Indexes can be clustered or non-clustered. Differences include:
- In a clustered index, table records are sorted physically and stored in a particular order. Hence, a table can have a single clustered index only. While in a non-clustered index, logical sorting happens which does not match the physical order of the records.
- Leaf node of a clustered index holds the data pages while the non-clustered index holds the index rows.
Q #3) What are the different responsibilities of a DBA?
Answer: DBA is the database administrator who performs all administrative tasks.
Administrative tasks include:
- User-level administration i.e. creates users, remove existing users or modifies user permissions.
- Maintains database security.
- Manages database storage & objects.
- Tunes performance of a database.
- Performs backups & recovery tasks.
Q #4) What do you mean by Database Normalization and why is it important?
Answer: Normalization technique is a set of rules that are used to organize the relational database to prevent data redundancy and dependency. Once initial database objects are identified, normalization helps in identifying the relationships between schema objects.
Different normalization forms are as follows:
- First Normal Form (1NF)
- Second Normal Form (2NF)
- Third Normal Form (3NF)
- Boyce-Codd Normal Form (BCNF)
- Fourth Normal Form (4NF)
- Fifth Normal Form (5NF)
Q #5) Can you list down the different components of physical and logical database structure?
Answer: Given below is the list of different components.
The physical structure includes:
- Data files, which hold all the DB objects like tables, views, indexes, etc.
- Redo Log files, which maintains the records of database changes as a result of user transactions.
- Control files, which maintain the database status and physical structure.
The logical structure includes:
- Tablespace, which is a logical storage unit where the database object resides.
- Segments are logical storage units only but within a tablespace.
- Extent is the logical unit where various contiguous data blocks and extents together form a segment.
- A data block is the smallest logical storage unit in the database.
Q #6) What is a SYSTEM tablespace and why do we need it?
Answer: System tablespace is created at the time of database creation. This tablespace holds all the data dictionary tables and hence it is used for the creation of various database objects. System tablespace must stay online for the database to function smoothly.
Q #7) What do you mean by SGA and how is it different from PGA?
Answer: SGA means System Global Area is the memory area that is defined by Oracle during instance startup. This area can be shared by the system-level processes and hence it is known as the Shared Global Area as well.
PGA is Program Global Area is memory specific to a process or session. It is created when the Oracle process gets started and each process will have a dedicated PGA.
Q #8) What is a password file in a database and why is it required when a user can be authenticated using data dictionary tables?
Answer: Database users can be authenticated using data dictionary tables as they store the username & password. If the password provided by a user matches with the one stored in the database, then the user would be able to log in. However, this can happen only if the database is open.
If the database is in shutdown mode, then these tables cannot be accessed and hence password file will be used by the database administrators to log in and open the database.
Q #9) What are the different types of backups that are available in Oracle?
Answer: On a higher level, there are 2 types of backup that are available in Oracle which are physical & logical.
During physical backup, copies of physical database files (like data files, control files, redo logs & other executables) are created and saved for the future. This can be achieved using either operating system utilities or RMAN.
In contrast, logical backup allows taking a backup of the database objects like tables, views, indexes, stored procedures, etc. individually through Export/Import utility provided by Oracle.
Q #10) What do we mean by hot backup & cold backup and how are they different?
Answer: Hot backup is the process of taking database backup while the database is in running mode. Hence, it is also known as Online Backup. While cold backup can be taken only when the database is in shut down mode and hence it is known as Offline Backup as well.
There are few websites like banking & trading ones, which are 24 hours operational and hence, cannot support bringing the database down. Hence, DBAs need to take the backup in online mode only.
Q #11) What is the difference between restoring a database and recovering a database?
Answer: During the restoration process, backup files are copied from the hard disk, media or tapes to the restoration location and later make the database operational. Recovery has an additional step of updating these data files by applying redo logs so as to recover the changes which are not backed up.
Let us understand this with the help of a scenario.
- Database full backup is taken on Friday 11 PM
- Database crash happened on Saturday 7 AM
We can restore the lost files using the 11 PM full backup which is Restoration. However, the data will be restored up till Friday at 11 PM and not till Saturday at 7 AM. In order to do the same, redo logs can be applied which will bring the database to the point of failure.
Q #12) What do you understand by Redo Log file mirroring?
Answer: Redo log is the most crucial component of database architecture that records all transactions within the database even before it goes to the data file.
Hence, the mirroring of these files is done to protect them. Redo Log file mirroring allows redo logs to be copied to different disks simultaneously. And this can be achieved using Data Guard and other utilities.
Q #13) How is incremental backup different from differential backup?
Answer: Incremental backup is known for keeping back up of only the changed data files since the last backup, which might be full or incremental. For Example, An incremental/full backup is done at 10 AM on Friday and the next backup is done at 10 AM Saturday. The second incremental backup will only have the transactions occurred after Friday at 10 AM.
While Differential backup backs up the files that changed during the last full backup.
If you take a full back up on Friday at 10 AM and then differential backup on Saturday at 10 AM, it will take the backup of the files changed since Friday, 10 AM. Further, if the differential backup is taken on Sunday at 10 AM, it will take the backup of the files changed since Friday, 10 AM.
Q #14) What is a Flashback Query and when should it be used?
Answer: Oracle has introduced a flashback technology to recover the past states of database objects. It can recover the accidental changes, which got committed as well. Recovery depends on the specified value of the UNDO_RETENTION parameter.
For Example, the UNDO_RETENTION parameter is set to 2 hours and if a user accidentally deletes the data at 11 AM with commit performed. Then, using FLASHBACK QUERY, he can retrieve these rows until 1 PM only.
Q #15) How is RMAN better than the user-managed backup recovery process?
Answer: Recovery Manager (RMAN) is an Oracle built-in utility that can automate database backup & recovery processes and administrate backup strategies as well. In user-managed backups, the user needs to perform backup manually.
RMAN backup time will be less when compared to user-managed backups as RMAN maintains all the metadata in the Central Repository and can quickly retrieve the same.
RMAN does incremental backup rather than taking full file backups which are done by user-managed backups, which again saves time.
RMAN creates backup and recovery scripts that can be re-used and scheduled and does not need manual intervention.
RMAN can detect corrupted data blocks automatically during the backup process and recover them, whereas it doesn’t happen in user-managed backups.
Q #16) What is a Recovery Catalog?
Answer: Recovery catalog is a database schema that holds the metadata used by RMAN for restoration and recovery processes.
It basically stores information on
- Datafiles & their backup files.
- Archived Redo Logs & their backup sets.
- Stored scripts
- Backup history
The catalog gets updated once RMAN takes the backup or switches redo log or changes data file.
Q #17) How do you recover a lost control file?
Answer: If one of the control files is lost or gets corrupted, we can use another copy of the control file maintained at the OS level. If all the copies of control files are lost or if a user is maintaining only one copy of the control file which gets lost, then a user can
- Manually create a control file.
- Restore it from the backup control file using the below command.
ALTER DATABASE BACKUP CONTROL FILE TO TRACE;
- Restore using RMAN backup by using the below commands.
setdbid XX; restorecontrolfile;
Q #18) What is the difference between media recovery & crash recovery?
Answer: Media recovery is the process of recovering the database from the backup whenever a disk failure is there. Physical files like data files, control files or server parameter files get recovered during media recovery. However, crash recovery will be performed whenever a database instance failure occurs.
Media recovery needs to be performed by DBA while crash recovery is an automated process that is taken care of SMON background process.
Q #19) What is RAC and what are the various benefits of using RAC architecture?
Answer: RAC or Real Application Cluster allows the database to be installed across multiple servers forming a cluster and sharing the storage structure at the same time. This prevents the database from a single point of failure as one or the other instance will always stay up even if the other fails.
Using RAC helps in
- Maintaining high availability of the system.
- Managing workload with the least expenses.
- Scalability & agility.
Q #20) How would you differentiate between cluster and grid?
Answer: Clustering is an integral part of grid infrastructure and focuses on a specific objective.
While grid, which may or may not consist of multiple clusters, possesses a wider framework that enables sharing of storage systems, data resources and remaining others across different geographical locations.
A cluster will have single ownership but the grid can have multiple ownership based on the number of the cluster it holds.
Q #21) What do you understand from Cache Fusion?
Answer: Cache fusion is the process of transferring data from one instance buffer cache to another at a very high speed within a cluster. Instead of fetching data from physical disk which is a slow process, the data block can be accessed from the cache.
For Example, Instance A wants to access a data block, owned by instance B. It will send an access request to instance B and hence can access the same using the other instance B’s buffer cache.
Q #22) How can a single instance environment be converted into the RAC environment and how will they be different?
Answer: Single instance can be converted into RAC using one of the below methods:
- Enterprise Manager
- DBCA i.e. Database Configuration Assistant
- RCONFIG Utility
Single Instance environment Vs RAC Environment
|Parameters||Single Instance Environment||RAC Environment|
|Memory||Instance will have dedicated SGA||Every instance will have separate SGA|
|Access to |
|Only one instance will access data files|
and control files.
|Data files and Control Files are shared across|
|Flash Recovery Log||Accessed by single instance.||Shared by multiple instances.|
|Redo Logs||Dedicated to single instance.|| |
Only one instance can write at a time but others can read data during recovery or
Q #23) How can we monitor the space allocations in a database?
Answer: We can use the below data dictionary tables to monitor the space allocations:;
Q #24) What do you understand by “Performance Tuning of DB” & what are the different areas where we can perform tuning?
Answer: It is the process of enhancing database performance by making optimal use of the available resources.
Performance can be enhanced by tuning any of the below areas:
- Database design.
- Memory allocation.
- Disk I/Os.
- Database contention.
- OS level (CPU).
Q #25) What are the different tools that are provided by Oracle to assist performance monitoring?
Answer: Various tools include:
- AWR(Automatic Workload Repository)
- ADDM(Automated Database Diagnostics Monitor)
- OEM(Oracle Enterprise Manager)
Q #26) What are the different optimizers that are used to optimize the database?
Answer: There are two types of optimizers:
- Rule-Based Optimizer (RBO): If the referenced objects don’t maintain any internal statistics, RBO is used.
- Cost-Based Optimizer (CBO): If the referenced objects maintain internal statistics, CBO will check all the possible execution plans and select the one with the lowest cost.
Q #27) What is an explain plan and how does it help in optimizing the SQL query?
Answer: An explain plan is a statement that displays the execution plan selected by the Oracle optimizer for SELECT, INSERT, UPDATE & DELETE statements. By looking at this plan, one can figure out Oracle selection of the right indexes, proper joins & sorts operations, etc.
Q #28) How can we collect the statistics of different database objects?
Answer: ANALYZE statement can be used to collect the statistics of various database objects like tables, indexes, partitions, cluster or object references. Using this statement we can also identify migrated as well as chained rows within a table or cluster.
Q #29) Why do we need to rebuild indexes?
Answer: Rebuilding indexes is required in order to improve the performance of an application. Due to various INSERT & DELETE operations, the index gets fragmented & unstructured, thereby making the application slow. To reorganize data within these indexes, rebuilding is performed.
Q #30) What is TKPROF and how can we use it?
Answer: TKPROF is a tuning utility provided by Oracle which can convert SQL trace files into a readable format.
Once trace file is generated using SQL Trace Utility, the TKPROF tool can be run against trace file and output can be read. It can also generate the execution plan for SQL statements. The executable for TKPROF is located in the ORACLE HOME/bin directory.
Q #31) How can we tune a SQL query to optimize the performance of a database?
Answer: Enlisted are a few of the best practices for writing SQL queries.
- Column names should be provided instead of * in SELECT statements.
- Joins should be used in the place of sub-queries.
- EXISTS should be used instead of IN to verify the existence of data.
- UNION ALL should be used in the place of UNION.
- HAVING should be used only for filtering the resulted rows from the SQL query.
Q #32) How would you identify the SHARED_POOL_SIZE parameter that needs to be adjusted?
Answer: Below is the indications for the same:
- Getting an ORA-04031 error.
- Degrading the performance even when all the other parameters are already optimized.
- Poor library cache/data dictionary hits.
Q #33) What do you understand by Row Chaining?
Answer: When a row is too large that it cannot fit in a block, then it will end up using consequent blocks which lead to the concept of Row Chaining. It can be avoided by updating the storage parameters to an appropriate value.
Q #34) What is table partitioning and why is it required?
Answer: It is a process of dividing a table into smaller chunks so as to make the data retrieval easy and quick. Each piece will be known as a partition and can be accessed separately. Apart from tables, indexes can also be partitioned.
Q #35) How can we identify the resources for which the sessions are waiting?
Answer: We can find it out using v$session_waits and v$ system _waits.
I hope the above set of questions would have given you a good understanding of some of the advanced concepts of Oracle.
Just go through these questions before attending the interview and success will be yours.
Read NEXT Part 3: Top Oracle Forms and Reports Interview Questions
Wish you all the best!!!