List Of Important Oracle Interview Questions Part – 2
1.What are the various types of queries?
The types of queries are:
1.Normal Queries
2.Sub Queries
3.Co-related queries
4.Nested queries
5.Compound queries
2.What is a transaction?
A transaction is a set of SQL statements between any two COMMIT and ROLLBACK statements.
3.What is PL/SQL?
PL/SQL is Oracle’s Procedural Language extension to SQL.The language includes object oriented programming techniques such as encapsulation,function overloading,information hiding (all but inheritance),and so,brings state-of-the-art programming to the Oracle database server and a variety of Oracle tools.
4.Is there a PL/SQL Engine in SQL
*Plus?
No.Unlike Oracle Forms,SQL
*Plus does not have a PL/SQL engine.Thus,all your PL/SQL are send directly to the database engine for execution.This makes it much more efficient as SQL statements are not stripped off and send to the database individually.
5.Is there a limit on the size of a PL/SQL block?
Currently,the maximum parsed/compiled size of a PL/SQL block is 64K and the maximum code size is 100K.You can run the following select statement to query the size of an existing package or procedure.SQL> select
* from dba_object_size where name = ‘procedure_name’
6.How can I protect my PL/SQL source code?
PL/SQL V
2.2,available with Oracle
7.2,implements a binary wrapper for PL/SQL programs to protect the source code.This is done via a standalone utility that transforms the PL/SQL source code into portable binary object code (somewhat larger than the original).This way you can distribute software without having to worry about exposing your proprietary algorithms and methods.SQL
*Plus and SQL
*DBA will still understand and know how to execute such scripts.Just be careful,there is no “decode” command available.The syntax is: wrap iname=myscript.sql oname=xxxx.yyy .
7.What is the difference between a procedure and a function?
Functions return a single variable by value whereas procedures do not return any variable by value.Rather they return multiple variables by passing variables by reference through their OUT parameter.
8.What is Over Loading and what are its restrictions?
OverLoading means an object performing different functions depending upon the no.of parameters or the data type of the parameters passed to it.
9.What are mutating triggers?
A trigger giving a SELECT on the table on which the trigger is written.
10.What is the use of Data Dictionary?
It Used by Oracle to store information about various physical and logical Oracle structures e.g.Tables,Tablespaces,datafiles,etc.
11.Can Check constraint be used for self referential integrity? How?
Yes.In the CHECK condition for a column of a table,we can reference some other column of the same table and thus enforce self referential integrity.
12.What is the significance of the and & operators in PL SQL?
The operator means that the PL SQL block requires user input for a variable.The & operator means that the value of this variable should be the same as inputted by the user previously for this same variable.
13.Can you pass a parameter to a cursor?
Explicit cursors can take parameters,as the example below shows.A cursor parameter can appear in a query wherever a constant can appear.CURSOR c1 (median IN NUMBER) IS SELECT job,ename FROM emp WHERE sal > median;
14.What are the various types of RollBack Segments?
The types of Rollback sagments are as follows :
1.Public Available to all instances
2.Private Available to specific instance.
15.What is Multi Threaded Server (MTA)?
In a Single Threaded Architecture (or a dedicated server configuration) the database manager creates a separate process for each database user.But in MTA the database manager can assign multiple users (multiple user processes) to a single dispatcher (server process),a controlling process that queues request for work thus reducing the databases memory requirement and resources.
16.What is a package cursor?
A package cursor is a cursor which you declare in the package specification without an SQL statement.The SQL statement for the cursor is attached dynamically at runtime from calling procedures.
17.What all important parameters of the init.ora are supposed to be increased if you want to increase the SGA size?
In our case,db_block_buffers was changed from 60 to 1000 (std values are 60,550 3500) shared_pool_size was changed from 3.5MB to 9MB
(std values are 3.5,5 9MB) open_cursors was changed from 200 to 300 (std values are 200 300) db_block_size was changed from 2048 (2K) to 4096 (4K) {at the time of database creation}.The initial SGA was around 4MB when the server RAM was 32MB and The new SGA was around 13MB when the server RAM was increased to 128MB.
18.What is actual parameter?
Subprograms pass information using parameters.The variables or expressions referenced in the parameter list of a subprogram call are actual parameters.For example,the following procedure call lists two actual parameters named emp_num and amount: Eg.raise_salary(emp_num,amount);
19.What is formal parameter?
The variables declared in a subprogram specification and referenced in the subprogram body are formal parameters.For example,the following procedure declares two formal parameters named emp_id and increase: Eg.PROCEDURE raise_salary (emp_id INTEGER,increase REAL) IS current_salary REAL;
20.What is a forward declaration?What is its use?
PL/SQL requires that you declare an identifier before using it.Therefore,you must declare a subprogram before calling it.This declaration at the start of a subprogram is called forward declaration.A forward declaration consists of a subprogram specification terminated by a semicolon.
21.What is difference between UNIQUE constraint and PRIMARY KEY constraint?
A column defined as UNIQUE can contain Nulls while a column defined as PRIMARY KEY can’t contain Nulls.
22.How are extents allocated to a segment for DBA?
Oracle8 and above rounds off extents to a multiple of 5 blocks when more than 5 blocks are requested.If one requests 16K or 2 blocks (assuming a 8K block size),Oracle doesn’t round it up to 5 blocks,but it allocates 2 blocks or 16K as requested.
If one asks for 8 blocks,Oracle will round it up to 10 blocks.Space allocation also depends upon the size of contiguous free space available.If one asks for 8 blocks and Oracle finds a contiguous free space that is exactly 8 blocks,it would give it you.If it were 9 blocks,Oracle would also give it to you.
Clearly Oracle doesn’t always round extents to a multiple of 5 blocks.The exception to this rule is locally managed tablespaces.If a tablespace is created with local extent management and the extent size is 64K,then Oracle allocates 64K or 8 blocks assuming 8K-block size.Oracle doesn’t round it up to the multiple of 5 .
23.What is 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.
24.What is an Oracle sequence?
A sequence generates a serial list of unique numbers for numerical columns of a database’s tables.
25.Explain about horizontal,Vertical tool bar canvas views?
Tool bar canvas views are used to create tool bars for individual windows.Horizontal tool bars are display at the top of a window,just under its menu bar.Vertical Tool bars are displayed along the left side of a window .
26.What does a Control file Contain?
* A Control file records the physical structure of the database.It contains the following information.
* Database Name
* Names and locations of a database’s files and redo log files.
* Time stamp of database creation.
27.How to define Data Block size?
A data block size is specified for each ORACLE database when the database is created.A database users and allocated free database space in ORACLE data blocks.Block size is specified in INIT.ORA file and can’t be changed latter.
28.What are the Characteristics of Data Files?
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.
29.What is Rollback Segment?
A Database contains one or more Rollback Segments to temporarily store “undo” information.
30.What is a timer?
Timer is an “internal time clock” that you can programmatically create to perform an action each time the times.