Oracle – Frequently Asked Questions

1. What is ORACLE?

Oracle is a Relational Database Management System (RDBMS) which is used widely for business applications.

2. What is SGA?

The System Global Area (SGA) is a shared memory region allocated by ORACLE that contains data and control information for one ORACLE instance.

3. What is the function of Checkpoint (CKPT)?

The Checkpoint (CKPT) process is responsible for signaling DBWR at checkpoints and updating all the data files and control files of the database.

The CKPT is also useful to get the point in time from where to begin the recovery in case of failure.

Which background process is responsible for writing the dirty buffers from the write list to the data files during a checkpoint?

The DBWn is usually responsible for this.

What are the components of SGA?

The components of the SGA are Database buffers, Redo Log Buffer and the Shared Pool.

4. What constitute an ORACLE Instance?

SGA and ORACLE background processes together constitute an ORACLE instance.

What do Database Buffers contain?

Database Buffers store the most recently used blocks of database data. They can also contain modified data that has not yet been permanently written to disk.

5. What do Redo Log Buffers contain?

Redo Log Buffers store redo entries or a log of changes made to the database.

6. What is Shared Pool?

Shared pool is composed of two parts; Library Cache and Data Dictionary Cache.

The Library Cache contains the shared SQL areas, private SQL areas, PL/SQL procedures and packages, and control structures such as locks and Library Cache handles. The shared SQL area contains the parse tree and execution plan; whereas the private SQL area contains values for bind variables and runtime buffers. The data dictionary cache holds most recently used database dictionary information.

7. What is the default undo management mode in ORACLE?


The default undo management mode is manual.

8. How can you dynamically size the SGA?

You can do this using the Alter System command.

9. What is the Multiple Block size?

We can assign different block sizes for each table space. This is called the Multiple Block size.

10. Where are the compiled functions and procedures stored in memory?


These are stored in the Library Cache.

11. What is SQL*PLUS?

It is a browser-based interface to communicate with the database.

12. What are the advantages of creating clusters in ORACLE?

It improves the efficiency of join queries and they are storage efficient.

13. What are Bind Variables?

A bind variable is a variable that you declare in a host environment. Bind variables can be used to pass run-time values, either number or character, into or out of one or more PL/SQL programs. The PL/SQL programs use bind variables as they would use any other variable. You can reference variables declared in the host or calling environment in PL/SQL statements, unless the statement is in a procedure, function, or package. This includes host language variables declared in precompiler programs, screen fields in Oracle Developer Forms applications, and iSQL*Plus bind variables.

14. How to create Bind Variables?

To declare a bind variable in the iSQL*Plus environment, use the command VARIABLE. For example, you declare a variable of type NUMBER and VARCHAR2 as follows:

VARIABLE return_code NUMBER

VARIABLE return_msg  VARCHAR2(30)

Both SQL and iSQL*Plus can reference the bind variable, and iSQL*Plus can display its value through the iSQL*Plus PRINT command.

15. Explain few programming guidelines for PL/SQL ?

To produce clear code and reduce maintenance when developing a PL/SQL block follow the below listed guidelines

-              Documenting code with comments

-              Developing a case convention for the code

-              Developing naming conventions for identifiers and other objects

-              Enhancing readability by indenting

16. What are the advantages of using cursors with FOR LOOPS?

A cursor FOR loop is a shortcut because of the following reasons

-              the cursor is opened automatically when the for loop is encountered for the first time and fetches the first row

-              rows are fetched once for each iteration in the loop

-              The loop itself is terminated automatically at the end of the iteration where the last row is fetched.

17. What is the use of NO WAIT option with SELECT…. FOR UPDATE clause?

The optional NOWAIT keyword tells Oracle not to wait if requested rows have been locked by another user. Control is immediately returned to your program so that it can do other work before trying again to acquire the lock. If you omit the NOWAIT keyword , Oracle waits until the rows are available.

18. Can we use raise system defined exceptions  explicitly by issuing the RAISE statement?

Yes, you can. For example : RAISE NO_DATA_FOUND

19. Can we handle the exception raised by RAISE_APPLICATION_ERROR?

Yes. For example, you can write “WHEN OTHERS” exception handler, and handler for this.

20. Can we assign default values to all modes of parameters in a subprogram?

You can assign default values only to parameters of the IN mode. OUT and IN OUT parameters are not permitted to have default values.

21. How Procedures are different from Functions?

You create a procedure to store a series of actions for later execution. A procedure can contain zero or more parameters that can be transferred to and from the calling environment, but a procedure does not have to return a value.

You create a function when you want to compute a value, which must be returned to the calling environment. A function can contain zero or more parameters that are transferred from the calling environment. Functions should return only a single value, and the value is returned through a RETURN statement. Functions used in SQL statements cannot have OUT or IN OUT mode parameters.

22. What is the use of SHOW ERRORS command?

SHOW ERRORS command is used  at the SQL prompt to obtain compilation errors for the last object you compiled.

You can also use the command with a specific program unit. The syntax is as follows:

SHOW ERRORS [{FUNCTION|PROCEDURE|PACKAGE|PACKAGE BODY|TRIGGER|VIEW} [schema.]name]

Example : SHOW ERRORS PROCEDURE p1

Using the SHOW ERRORS command, you can view only the compilation errors that are generated by the latest statement that is used to create a subprogram. The USER_ERRORS data dictionary view stores all the compilation errors generated previously while creating subprograms.

23. How to drop one member of a package?

You cannot drop members of a package using DROP command. When you drop the package, all the members of the package are automatically dropped. To drop or add any members of the package, rewrite the whole package again.

24. What will happen to the dependent constructs of a package ,if we change the package specification?

Changes to the package body do not require recompilation of dependent constructs, whereas changes to the package specification require recompilation of every stored subprogram that references the package. To reduce the need for recompiling when code is changed, place as few constructs as possible in a package specification.

25. Explain the firing sequence for a trigger on a table.

The sequence is as below :

a.            Before Statement Trigger

b.            Before Row Trigger

c.             After row trigger

d.            After statement Trigger

26. Can we write INSTEAD OF triggers on tables?

No, it is written only on views

27. What will happen to triggers when the table on which the trigger is written?

All triggers on a table are automatically dropped when the  table is dropped.

Share

Related posts:

  1. Oracle PL/SQL Frequently Asked Questions
  2. COBOL Frequently Asked Questions
  3. WebSphere 3.5 Frequently Asked Questions
  4. .NET Frequently Asked Questions
  5. JSP Frequently Asked Questions
Tags: , , , , , , , , , , , , , , , , , , ,
Technical, , , , , , , , , , , , , , , , , , , Permalink

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>