Top Oracle DBA, RAC, and Performance Tuning Interview Questions

Top Oracle DBA, RAC, and Performance Tuning Questions on Advanced Topics for Experienced Professionals:

In continuation of the previous article, where I covered the top Oracle interview questions, in this article I have included a set of interview questions on the advanced topics of Oracle.

These questions will 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

I hope it would be helpful to the candidates who are at the intermediate level. Good knowledge on these questions will help any job seeker to clear the interview successfully.

Top Oracle DBA, RAC, and Performance Tuning Questions

Given below are the most important Oracle Interview Questions on Advanced Topics along with the answers.

Let's start!!!

Q #1) Why do we use materialized view instead of table or views?

Ans: 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 Clustered Index different from Non-Clustered Index?

Ans: An index is a schema object, which can search the data efficiently within the table.

Indexes can be clustered or non-clustered.

=> 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 non-clustered index holds the index rows.

Q #3) What are the different responsibilities of a DBA?

Ans: DBA is the database administrator who performs all administrative tasks.

Administrative Tasks include:

  • User level administration i.e. creates users, remove existing users or modify 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?

Ans: Normalization technique is a set of rules that are used to organize relational database to prevent data redundancy and dependency. Once initial database objects are identified, normalization helps in identifying the relationships between schema objects.

Different forms of normalization 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?

Ans: Given below is the list of different components.

The physical structure includes:

  • Data Files, which holds 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 maintains 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 that is made of various contiguous data blocks and various extents together forms 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?

Ans: 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?

Ans: SGA means System Global Area, which 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, which is the 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?

Ans: 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?

Ans: 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?

Ans: 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? 

Ans: 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 me explain 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 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?

Ans: Redo log is the most crucial component of database architecture which records all of the transactions within the database even before it goes to the data file.

Hence, the mirroring of these files will be 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?

Ans: Incremental Backup backs up only the changed data files since the last backup, which might be full or incremental. E.g. An incremental/full backup is taken at 10 AM on Friday and next taken 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 10 AM and then differential backup on Saturday 10 AM, it will take the backup of the files changed since Friday, 10 AM. Further, if the differential backup is taken on Sunday 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?

Ans: 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?

Ans: 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?

Ans: 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
  • Incarnation
  • Backup History

The catalog gets updated once RMAN takes a backup or switches redo log or changes data file.

Q #17) How do you recover a lost control file?

Ans: If one of the control files is lost or gets corrupted, we can use another copy of the control file maintained at 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?

Ans: 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 will be 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?

Ans: 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?

Ans: 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 enabling sharing of storage systems, data resources and remaining others across different geographical locations.

A cluster will have single ownership but grid can have multiple based on the number of the cluster it holds.

Q #21) What do you understand from Cache Fusion?

Ans: Cache fusion is the process of transferring data from one instance buffer cache to another at 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 E.g. Instance A wants to access a data block which is being 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?

Ans: 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

Instance

Instance

Multiple

MemoryInstance will have dedicated SGA

Every instance will have separate SGA

Access to
physical files
Only one instance will access data files
 and control files.
Data files and Control Files are shared across
 all instances.
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
archiving process.

Q #23) How can we monitor the space allocations in a database?

Ans: We can use the below data dictionary tables to monitor the space allocations.

DBA_FREE_SPACE
DBA_SEGMENTS
DBA_DATA_FILES

Q #24) What do you understand by “Performance Tuning of DB” & what are the different areas where we can perform tuning?

Ans: 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?

Ans: Various tools include:

  • AWR(Automatic Workload Repository)
  • ADDM(Automated Database Diagnostics Monitor)
  • TKPROF
  • STATSPACK
  • OEM(Oracle Enterprise Manager)

Q #26) What are the different optimizers that are used to optimize the database?

Ans: 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?

Ans: 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 if Oracle is selecting right indexes, proper joins & sorts operations, etc.

Q #28) How can we collect the statistics of different database objects?

Ans: 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?

Ans: 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?

Ans: 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?

Ans: Below mentioned 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?

Ans: Below is the indications for the same:

  • Getting 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?

Ans: 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?

Ans: 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?

Ans: We can find it out using v$session_waits and v$ system _waits.

Conclusion

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.

=> Click Here For Series Covering Oracle Interview questions

Read NEXT Part 3Top Oracle Forms and Reports Interview Questions

Wish you all the best!!!