Best Oracle DBA Interview Questions And Answers for Freshers
What are the roles of DBA?
A DBA has the authority to create new users, remove the existing users, or modify any of the environment variables or privileges assigned to other users.
- Manage database storage
- Administer users and security
- Manage schema objects
- Monitor and manage database performance
- Perform backup and recovery
- Schedule and automate jobs
- Install patches
- Secure the data
Want to become a certified Oracle DBA Course? Enroll now!
What is an instance in Oracle?
It is the medium to connect to the database. As soon as you start a database, the instance sit in RAM, and retrieves the data and update it through SGA. 40 percent of RAM can be used for sizing SGA rest is reserved for OS and others in 64-bit machine and in 32-bit machine, max SGA configured can be 1.5GB only.
What is difference between oracle SID and Oracle service name?
Oracle SID is the unique name that uniquely identifies your instance/database where as the service name is the TNS alias can be same or different as SID.
What is the main purpose of ‘CHECKPOINT’ in oracle database?
A checkpoint is a database event, which synchronize the database blocks in memory with the datafiles on disk. It has two main purposes: To establish a data consistency and enable faster database Recovery.
What happens when we fire SQL statement in Oracle?
First it will check the syntax and semantics in library cache, after that it will create execution plan. If already data is in buffer cache it will directly return to the client. If not it will fetch the data from datafiles and write to the database buffer cache after that it will send server and finally server send to the client.
What does database do during the mounting process?
While mounting the database oracle reads the data from controlfile which is used for verifying physical database files during sanity check. Background processes are started before mounting the database only.
What is log switch?
The point at which oracle ends writing to one online redo log file and begins writing to another is called a log switch. Sometimes you can force the log switch. ALTER SYSTEM SWITCH LOGFILE;
What is the control file? What kind of information is stored in a control file?
Control file is a file that contains all the information about the physical structure of the database, such as number of log files and their location. Oracle database server uses control file to find its physical component. Control file stores information about log switches, checkpoints, and modification in disk resources
Difference between RESETLOGS and NORESETLOGS ?
I) The NORESETLOGS option does not clear the redo log files during startup and the online redo logs to be used for recovery. Only used in scenario where MANUAL RECOVERY is started, CANCEL is used, and then RECOVER DATABASE is started.
II) Once RESETLOGS is used then the redo log files cannot be used and any completed transactions in those redo logs are lost!! 17) What is SCN (System Change Number) ? The system change number (SCN) is an ever-increasing value that uniquely identifies a committed version of the database at a point in time. Every time a user commits a transaction Oracle records a new SCN in redo logs. Oracle uses SCNs in control files datafile headers and redo records. Every redo log file has both a log sequence number and low and high SCN. The low SCN records the lowest SCN recorded in the log file while the high SCN records the highest SCN in the log file.
What is SGA_TARGET and SGA_MAX_SIZE ?
SGA_MAX_SIZE is the largest amount of memory that will be available for the SGA in the instance and it will be allocated from memory. You do not have to use it all, but it will be potentially wasted if you set it too high and don’t use it. It is not a dynamic parameter. Basically it gives you room for the Oracle instance to grow. SGA_TARGET is actual memory in use by the current SGA. This parameter is dynamic and can be increased up to the value of SGA_MAX_SIZE.
What is Instance Recovery?
While Oracle instance fails, Oracle performs an Instance Recovery when the associated database is being re-started. Instance recovery occurs in two steps: Cache recovery: Changes being made to a database are recorded in the database buffer cache. These changes are also recorded in online redo log files simultaneously. When there are enough data in the database buffer cache,they are written to data files. If an Oracle instance fails before the data in the database buffer cache are written to data files, Oracle uses the data recorded in the online redo log files to recover the lost data when the associated database is re-started. This process is called cache recovery. Transaction recovery: When a transaction modifies data in a database, the before image of the modified data is stored in an undo segment. The data stored in the undo segment is used to restore the original values in case a transaction is rolled back. At the time of an instance failure, the database may have uncommitted transactions. It is possible that changes made by these uncommitted transactions have gotten saved in data files. To maintain read consistency, Oracle rolls back all uncommitted transactions when the associated database is re-started. Oracle uses the undo data stored in undo segments to accomplish this. This process is called transaction recovery.
Which Process reads data from Datafiles?
Server Process – There is no background process which reads data from datafile or database buffer. Oracle creates server processes to handle requests from connected user processes. A server process communicates with the user process and interacts with Oracle to carry out requests from the associated user process. For example, if a user queries some data not already in the database buffers of the SGA, then the associated server process reads the proper data blocks from the datafiles into the SGA. Oracle can be configured to vary the number of user processes for each server process. In a dedicated server configuration, a server process handles requests for a single user process. A shared server configuration lets many user processes share a small number of server processes, minimizing the number of server processes and maximizing the use of available system resources.
What is log switch?
A log switch is a point when loG WRiter (LGWR)fills one online redo log group and writing to another.At every log switch a checkpoint,occurs.
What is difference between TRUNCATE & DELETE?
TRUNCATE commits after deleting entire table i.e., cannot be rolled back. Database triggers do not fire on TRUNCATE. DELETE allows the filtered deletion. Deleted records can be rolled back or committed. Database triggers fire on DELETE.
What is a pluggable database?
A pluggable database is a database that is contained within another database, known as the container database. The pluggable database shares certain resources with the container database, but it can also be configured and administered independently. This allows for greater flexibility and scalability when managing multiple databases.
What are the different types of Oracle database shutdown modes?
- Normal: New connections are not permitted in this option, and the database is terminated when all sessions quit.
- Immediate: New connections are not permitted, and all ongoing operations are returned.
- Transactional: New connections are not permitted, and Oracle will hold until all current processes have been finished.
- Abort: This occurs instantly, although the database is not completely shut down. When the database is restarted, it will have to conduct a quick restoration. We can’t utilize this in everyday situations.
What is row chaining?
Row Chaining happens when the row is so large that it cannot fit into one data block when it is first inserted. In row chaining, Oracle stores the data for the row in a chain of one or more data blocks.