Oracle Database Interview Questions

0
435
Oracle Interview
Mostly asked interview questions



1) What is Public Database Link?
Answer: Public database link is created for the special user group PUBLIC. A public database link can be used when any user in the associated database specifies a global object name in a SQL statement or object definition.

2) What is a Network Database link?
Answer: Network database link is created and managed by a network domain service. A network database link can be used when any user of any database in the network specifies a global object name in a SQL statement or object definition.

3) What is Data Block?
Answer: ORACLE database’s data is stored in data blocks. One data block corresponds to a specific number of bytes of physical database space on a disk.

4) How to define Data Block size?
Answer: A data block size is specified for each ORACLE database when the database is created. Database users and allocated free database space in ORACLE data blocks. Block size is specified in INIT.ORA file and can’t be changed later.

5) What is Row Chaining?
Answer: In Circumstances, all of the data for a row in a table may not be able to fit in the same data block. When this occurs, the data for the row is stored in a chain of the data blocks (one or more) reserved for that segment.

6) What is an Extent?
Answer: An Extent is a specific number of contiguous data blocks, obtained in a single allocation, used to store a specific type of information.

7) What is a Segment?
Answer: A segment is a set of extents allocated for a certain logical structure.

8) What are the different types of Segments?
Answer: Data Segment, Index Segment, Rollback Segment, and Temporary Segment.

9) What is a Data Segment?
Answer: Each Non-clustered table has a data segment. All of the table’s data is stored in the extent of its data segment. Each cluster has a data segment. The data of every table in the cluster is stored in the cluster’s data segment.

10) What is an Index Segment?
Answer: Each Index has an Index segment that stores all of its data.

11) What is Rollback Segment?
Answer: A Database contains one or more Rollback Segments to temporarily store “undo” information.

12) What are the uses of the Rollback Segment?
Answer: Rollback Segments are used :
To generate read-consistent database information during database recovery to rollback uncommitted transactions for users.

13) What is a Temporary Segment?
Answer: Temporary segments are created by ORACLE when a SQL statement needs a temporary work area to complete execution. When the statement finishes execution, the temporary segment extents are released to the system for future use.

14) What is a Data File?
Answer: Every ORACLE database has one or more physical data files. A database’s data files contain all the database data. The data of logical database structures such as tables and indexes is physically stored in the data files allocated for a database.

15) What are the Characteristics of Data Files?
Answer: A data file can be associated with only one database. Once created a data file can’t change size.
One or more data files form a logical unit of database storage called a tablespace



16) What is the effect of setting the value ‘FIRST_ROWS’ for the OPTIMIZER_GOAL parameter of the ALTER SESSION command?
Answer: This value causes the optimizer to use the cost-based approach for all SQL statements in the session regardless of the presence of statistics and to optimize with the goal of best response time.

17) What is the effect of setting the ‘RULE’ for the OPTIMIER_GOAL parameter of the ALTER SESSION Command?
Answer: This value causes the optimizer to choose the rule-based approach for all SQL statements in a session regardless of the presence of statistics.

18) What is the RULE-based approach to optimization?
Answer: Choosing an executing plan based on the access paths available and the ranks of these access paths.

19) What is the COST-based approach to optimization?
Considering available access paths and determining the most efficient execution plan based on statistics in the data dictionary for the tables accessed by the statement and their associated clusters and indexes.
PROGRAMMATIC CONSTRUCTS

20) What are the different types of PL/SQL program units that can be defined and stored in the ORACLE database?
Answer: Procedures and Functions, Packages, and Database Triggers.

21) What is a Procedure?
Answer: A Procedure consists of a set of SQL and PL/SQL statements that are grouped together as a unit to solve a specific problem or perform a set of related tasks.

22) What is the difference between Procedures and Functions?
Answer: A Function returns a value to the caller where as a Procedure does not.

23) What is a Package?
Answer: A Package is a collection of related procedures, functions, variables, and other package constructs together as a unit in the database.

24) What are the advantages of having a Package?
Answer: Increased functionality (for example, global package variables can be declared and used by any procedure in the package) and performance (for example all objects of the package are parsed compiled, and loaded into memory once)

25) What is Database Trigger?
Answer: A Database Trigger is a procedure (set of SQL and PL/SQL statements) that is automatically executed as a result of an insert in, update to, or delete from a table.

26: What are the uses of Database Trigger?
Answer: Database triggers can be used for automatic data generation, audit data modifications, enforce complex Integrity constraints, and customize complex security authorizations.

27) What are the differences between Database Trigger and Integrity constraints?
Answer: A declarative integrity constraint is a statement about the database that is always true. A constraint applies to existing data in the table and any statement that manipulates the table.
A trigger does not apply to data loaded before the definition of the trigger, therefore, it does not guarantee all data in a table conforms to the rules established by an associated trigger.
A trigger can be used to enforce transitional constraints whereas a declarative integrity constraint cannot be used.

Gyani Labs