You are on page 1of 141

HCL Technologies Banking Center

Confidential

DBA Related
1. What is the most challenging aspect of your job?
This question will give you clues about the mindset of the DBA. When asked what is
challenging about the DBA job, the DBAs answer will reveal a great deal about his or
her personality and ability to work well with other people. The DBA who talks about the
technical challenges of the job and difficulties administering and maintaining the
database may not be ideally suited for a position where contact for the development
staff is critical. On the other hand, the DBA who speaks openly of the challenges
associated with getting the developers fast answers and accurate information might be
a better consideration.
2. How do you perceive the relationship between the DBA and the development staff?
The answer to this question is critical when evaluating a DBA candidate. Many DBAs, by
virtue of their high pay and product-specific knowledge, tend to think of developers as
underlings; in some cases, DBAs view developers with outright contempt, believing their
queries to be naive. On the other hand, DBAs with the proper attitude will respond to
this question by talking about the developers as clients to whom they provide data
services essential to the application. In some shops, the DBAs may be responsible for
code, reviewing SQL queries, or DML statements written by developers; so, a good
relationship is vital.
3. Do you treat your test and production systems differently? If so, why?
The answer to this question will often provide insight into the priorities of the
candidate. In many shops, the DBA doesnt perceive the test databases as being as
important as the production database. The appropriate DBA candidate will note that the
data integrity of the test databases is crucial to the development staff because it is
their production environment in many cases.
4. What experience have you had analyzing new systems?
The answer to this question will reveal a great deal about the breadth of the DBAs
background. Although technical proficiency is an absolute requirement for the DBA, you
must remember that the DBA needs to have some tangential knowledge about the
functional areas within the business that they are supporting: for example, networking;
Java syntax; or business-side concerns, like finance or accounting. DBAs with a strong
business background will often be very useful to the initial design and implementation of
new business functionality within your organization.
5. Balance, grasshopper
A balance between technical aptitude and effective communication skills is essential for
any top-notch IT professional, and a DBA is no exception. Check technical references
and drill down on their certifications and work experience first. After gauging those
skills, the open-ended questions provided in this article should give you a good idea if
the candidate is a nice cultural fit for your team.

ORACLE Question Bank

Page 1 of 141

HCL Technologies Banking Center

Confidential

Job profile of a DBA


A budding DBA apprentice must have a general idea of how the Oracle database works
and thinks and must have a good logic flow. (S)he then becomes a Junior DBA only
when:
1. They can recover from any disaster and explain why their method is the most efficient.
2. They are able to tune any type of database (OLTP, DSS, etc.).
3. Can do all of the admin tasks, such as create users and manage profiles and roles,
database security, etc.
4. Understand an ERD (entity relationship diagram) preferably using the CASE standard.
5. Have a strong understanding of schema objects like PK, FK, Triggers, Packages, Tables,
Snapshots, etc.
6. Light SQL Programming skills
7. Have a firm understanding of the Oracle internals such as what comprises a data block, a
data-file, etc.
A senior DBA would have a more Pro-Active role, which will include:
1. Would look after the junior DBAs and would help them when needed.
2. Be overall responsible for all databases.
3. Insure that the company is not falling behind in the technology Trend/Opportunities.
4. Look at the current business needs and find ways to improve business efficiency through
the database.
5. Look at the Future business needs and prepare for them.
6. Be able to hold Training seminars for technical and non-technical employees.
7. Hire/interview potential Oracle DBAs
8. Consult with and assist the Project Manager in offering advice/service.
Environment in which a DBA generally works
Operating Systems - 132 platforms (if you are talking about the number of platforms that
Oracle supports) as far as the Operating system is concerned. Don't be shocked. The most
common ones include Sun OS, AIX, HP - UX, Sequent and NT.
Oracle Configurations
1. Dedicated Server,
2. Multi Threaded Server,
3. Oracle Parallel Server
Application Types
DSS, OLTP or a mix of both and OLAP

ORACLE Question Bank

Page 2 of 141

HCL Technologies Banking Center

Confidential

Role of DBA in Database Management


If you are asking about the regular tasks that a DBA has to do, below are a few tips that
could help you. All these (and other activities - there are many to be listed) could be
automated using Shell, SQL, and PL-SQL.
1. Read the alert log at least daily.
2. Monitor table-space growth and resize if necessary.
3. Monitor backups and do a test restore at least twice a year.
4. Monitor disk space usage, especially where log files are written.
5. Check for invalid objects regularly.
6. Check for updates/patches to applications that you are responsible for and apply them
if necessary.
The rest of your tasks will be at others request and not on a regular basis.
Those tasks will include:
1. Set up users/schemas/roles.
2. Refresh test/development instances.
3. Apply upgrades.
4. Add/modify table-spaces, rollback segments, etc.

ORACLE Question Bank

Page 3 of 141

HCL Technologies Banking Center

Confidential

To be an effective DBA, one must have the following:


1. Excellent communications skills. That's the #1 job requirement. As a DBA, you'll have
a wide array of demanding customers: application developers, systems administrators, end
users, management, you name it. The role spans many different groups, each with its own
language and expectations. You will need to be able to communicate effectively with each
of them. If you can't do that, you'll need to find a shop that only requires you to
communicate with the groups you are comfortable with.
2. Experience. "But how do I get DBA experience if I'm not a DBA?" you may ask. Fair
enough question. Work on an application that really stresses Oracle; a great example is a
large data-warehousing app. Data warehouses have large data loads and support large
transactions or large numbers of users. All of those stress Oracle. In support of the
application, you'll learn a lot about Oracle's internals as well as lots of tricks to work
around the issues.
3. Experience. Volunteer to do menial DBA tasks. Centralize user account administration
and do the "create user" work. If your organization supports mentoring, take advantage of
the more senior DBA's willingness to hand over the more menial tasks. If I were
interviewing a DBA, I would ask this question: "What errors did you hit during
recoveries?" If they've never hit errors during recoveries, they're either junior staff
or incredibly lucky.
4. Enthusiasm. People tend to choose people who want the job the most. You can't coach
speed.
5. Willingness to learn. I don't know everything. Neither do you. Since the role is so
varied, you have to constantly be in learning mode. If the certification process helps
direct your education process, great. If you have a different path in mind, great.
There's nothing wrong with learning more about the business processes your applications
support. Since you'll probably be tempted to go independent eventually, learn about program
management, work prioritization, and leadership.
Others may disagree, but this works for me. Please note that certification does not come
into play until #5. If you can use your certification to enhance your salary, you
probably already have a lot of the top considerations taken care of.

ORACLE Question Bank

Page 4 of 141

HCL Technologies Banking Center

Confidential

Oracle Call Interface (OCI)


1. What is the Oracle Call Interface?
The Oracle Call Interface (OCI) is a set of low-level APIs (Application Programming
Interface Calls) used to interact with Oracle databases. It allows one to use operations like
logon, execute, parse, fetch, etc. OCI programs are normally written in C or C++, although
they can be written in almost any programming language.
Unlike with the Oracle Precompilers (like Pro*C and Pro*COBOL), OCI programs are not
precompiled.
2. Should one use OCI or the Oracle Precompilers?
OCI is superior to Pro*C in the following ways:

Performance is much better with OCI


Reduced code size

Direct access to built-in functions (No intermediate files or substitutions).

Piecewise Operation on LONG fields (All LONG field problems are solved)

In Pro*C one cannot dynamically allocate memory to be used as bind variables

You cannot control the Pro*C precompiler to provide better and more compilable Ccode.

Common problems with OCI:

OCI code is difficult to write and to maintain


Very few people can write, let alone maintain OCI code

An OCI application program must do the following:

Connect to one or more databases: call the OCILogon (olog, olon or orlon) routines
Open the cursors needed by the program: use oexec, oexn, ofen or oftech calls.

Process the SQL statements that are needed to perform the application's tasks.

Close the cursors using the oclose routine.

Disconnect from the databases: use ologoff to close an open connection to oracle.

3. How does one write an OCI program?

ORACLE Question Bank

Page 5 of 141

HCL Technologies Banking Center

Confidential

Look at this very basic sample Oracle OCI8 program:


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <oci.h>
#pragma comment(lib, "d:\\orant\\oci80\\lib\\msvc\\ora803.lib")
static
static
static
static
static
static

OCIEnv
OCIError
OCISvcCtx
OCIStmt
OCIDefine
OCIBind

void main()
{
int
char
int
char
int

*p_env;
*p_err;
*p_svc;
*p_sql;
*p_dfn = (OCIDefine *) 0;
*p_bnd = (OCIBind *) 0;

p_bvi;
p_sli[20];
rc;
errbuf[100];
errcode;

rc = OCIInitialize((ub4) OCI_DEFAULT, (dvoid *)0, /* Initialize OCI */


(dvoid * (*)(dvoid *, size_t)) 0,
(dvoid * (*)(dvoid *, dvoid *, size_t))0,
(void (*)(dvoid *, dvoid *)) 0 );
/* Initialize evironment */
rc = OCIEnvInit( (OCIEnv **) &p_env, OCI_DEFAULT, (size_t) 0, (dvoid **) 0 );
/* Initialize handles */
rc = OCIHandleAlloc( (dvoid *) p_env, (dvoid **) &p_err, OCI_HTYPE_ERROR,
(size_t) 0, (dvoid **) 0);
rc = OCIHandleAlloc( (dvoid *) p_env, (dvoid **) &p_svc, OCI_HTYPE_SVCCTX,
(size_t) 0, (dvoid **) 0);
/* Connect to database server */
rc = OCILogon(p_env, p_err, &p_svc, "scott", 5, "tiger", 5, "d458_nat", 8);
if (rc != 0) {
OCIErrorGet((dvoid *)p_err, (ub4) 1, (text *) NULL, &errcode, errbuf, (ub4)
sizeof(errbuf), OCI_HTYPE_ERROR);
printf("Error - %.*s\n", 512, errbuf);
exit(8);
}

ORACLE Question Bank

Page 6 of 141

HCL Technologies Banking Center

Confidential

/* Allocate and prepare SQL statement */


rc = OCIHandleAlloc( (dvoid *) p_env, (dvoid **) &p_sql,
OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0);
rc = OCIStmtPrepare(p_sql, p_err, "select ename from emp where deptno=:x",
(ub4) 37, (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT);
/* Bind the values for the bind variables */
p_bvi = 10; /* Use DEPTNO=10 */
rc = OCIBindByName(p_sql, &p_bnd, p_err, (text *) ":x",
-1, (dvoid *) &p_bvi, sizeof(int), SQLT_INT, (dvoid *) 0,
(ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT);
/* Define the select list items */
rc = OCIDefineByPos(p_sql, &p_dfn, p_err, 1, (dvoid *) &p_sli,
(sword) 20, SQLT_STR, (dvoid *) 0, (ub2 *)0,
(ub2 *)0, OCI_DEFAULT);
/* Execute the SQL statement */
rc = OCIStmtExecute(p_svc, p_sql, p_err, (ub4) 1, (ub4) 0,
(CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT);
while (rc != OCI_NO_DATA) {
/* Fetch the remaining data */
printf("%s\n",p_sli);
rc = OCIStmtFetch(p_sql, p_err, 1, 0, 0);
}
rc = OCILogoff(p_svc, p_err);
/* Disconnect */
rc = OCIHandleFree((dvoid *) p_sql, OCI_HTYPE_STMT); /* Free handles */
rc = OCIHandleFree((dvoid *) p_svc, OCI_HTYPE_SVCCTX);
rc = OCIHandleFree((dvoid *) p_err, OCI_HTYPE_ERROR);
return;
}

4. How does one compile and link an OCI program?


1.

Write an OCI program (e.g. myoci.c). You can find examples in the
$ORACLE_HOME/rdbms/demo directory.
2. Copy the make file $ORACLE_HOME/rdbms/demo/demo_rdbms.mk into the
directory where your OCI program is located. You can also copy some of the sample
OCI files (cdemo1.c, etc.) provided by Oracle to compile and link.
3. Issue the following command
make -f demo_rdbms.mk build EXE=cdemo1 OBJS=cdemo1.o

ORACLE Question Bank

Page 7 of 141

HCL Technologies Banking Center

Confidential

Precompiler
1. What is a precompiler and what is it used for?
A precompiler is a tool that allows programmers to embed SQL statements in high-level
source programs like C, C++, COBOL, etc. The precompiler accepts the source program as
input, translates the embedded SQL statements into standard Oracle runtime library calls,
and generates a modified source program that one can compile, link, and execute in the usual
way. Examples are the Pro*C Precompiler for C, Pro*Cobol for Cobol, SQLJ for Java etc.
2. What languages are supported?
The following 3GL languages are supported by the Oracle precompilers:
File
Host Language:
Precompile to:
Extension:
Pro* COBOL

*.PCO

*.COB

Pro* Ada

*.PAD

*.ADA

Pro* Fortran

*.PFO

*.FOR

Pro* C (C++ included)

*.PC

*.C

Pro* PL/I

*.PPL

*.PL1

Pro* Pascal
*.PPA
*.PAS
Please note that Oracle8 does not support Pascal, PL/I and Ada.
3. What is the difference between OCI and the Precompilers?
The Oracle OCI (Oracle Call Interface), is an alternate low-level interface to the Oracle
database.
The SQL precompilers for the various host languages (Pro*C, Pro*Ada, Pro*Fortran,
Pro*COBOL, etc.) reads EXEC SQL commands and generate data structures and calls to its
runtime library: SQLLIB (libsql.a in UNIX). SQLLIB, in turn, calls the User Program
Interface (UPI) to communicate with the database. It does not generate calls to the Oracle
Call Interface (OCI) but you can mix OCI and Precompiler calls.
4. Should I use Pro*C V1 or V2?
Try to make the switch to version 2.0 as soon as possible. Starting with Oracle7 release 7.3,
it will be the only version available. The support matrix:
Database Version:
Pro*C Version:
7.0

1.5

7.1

1.6 and 2.0

7.2

1.6 and 2.1

7.3

2.2

ORACLE Question Bank

Page 8 of 141

HCL Technologies Banking Center

Confidential

8.x
8.x
Because Pro*C 2.x behaves differently from Pro*C 1.x, and to ease migration, both versions
of Pro*C were shipped with 7.1 and 7.2. I recommend using 2.x or higher for any new
development. You can use the PARSE=PARTIAL or PARSE=NONE options to get behavior
similar to version 1.x.
5. How does one compile a precompiler program?
The following syntax is used to precompile a Pro*C program:
proc iname=myprog.pc host=C
Oracle includes some sample precompiler programs with it's installation. These are normally
located under the $ORACLE_HOME/precomp/demo/proc (or related) directories.
After you've precompiled your program, invoke the standard host language compiler and
linker. Also remember, if you modify your source code, change the original precompiled
source program. In C, for example, you would modify the *.PC file and not the *.C file. The
*.C file gets overwritten every time you precompile your program.
Look at the following table for other host languages:
Language: Program: Precompiler: Precompiled to:
C

*.pc

proc

*.c

COBOL

*.pco

procob

*.cob

FORTRAN *.pfo

profor

*.for

PASCAL

*.ppa

propas

*.pas

ADA

*.pad

proada

*.ada

6. How does one compile a PRO*C program?


You can study the sample make file provided by Oracle and construct your own, but it would
probably be better to just use "make" to precompile and then compile your program in one
step. Look at this Unix examples:
Oracle7:
make -f $ORACLE_HOME/precomp/demo/proc/proc.mk build EXE=myprog
OBJS=myprog.o

ORACLE Question Bank

Page 9 of 141

HCL Technologies Banking Center

Confidential

Oracle8:
make -f $ORACLE_HOME/precomp/demo/proc/demo_proc.mk build EXE=myprog
OBJS=myprog.o
NOTE: OBJS and EXE have to be entered in caps!!!

7. How can I tell Pro*C what directory my header files are in?
Is there some way to tell the Pro*C preprocessor to search other directories for include
(*.h) files, similar to the C compiler switch "-I"? I am hoping to avoid having to change all of
my #include statements...
As documented in the Pro*C manual (in the chapter called "Running the Precompiler") there
is an INCLUDE flag that can be used for this. Look at this example:
proc iname=inputfile.pc include=directory1 include=directory2...
8. What is an indicator variable and why should I use it?
Indicator variables are used to explicitly handle NULL values. When you SELECT or FETCH
a NULL value into a host variable/array an "ORA-01405: fetched column values is NULL"
run-time error will result.
This behavior was introduced with Oracle7 when you recompiled your programs with the
DBMS=V7 (the default) precompiler option.
One workaround for this is to use the NVL() function to prevent the selection of NULL
values.
Example:
EXEC SQL SELECT ENAME, SAL, COMM
INTO :emp_name, :emp_sal, :emp_comm:comm_indicator
FROM emp;
if (comm_indicator == -1)
pay = emp_sal;
else
pay = emp_sal + emp_comm;

ORACLE Question Bank

Page 10 of 141

HCL Technologies Banking Center

Confidential

9. How does one execute PL/SQL code from Pro*C?


Look at this example:
EXEC SQL EXECUTE
begin
dbms_application_info.set_client_info('My C Program with embedded PL/SQL');
end;
END-EXEC;

ORACLE Question Bank

Page 11 of 141

HCL Technologies Banking Center

Confidential

Jserver and JDBC


1. What is JServer and what is it used for?
Oracle JServer Option is a Java Virtual Machine (Java VM), which runs within the Oracle
database server's address space. Oracle also provides a JServer Accelerator to compile
Java code natively. This speeds up the execution of Java code by eliminating interpreter
overhead.
2. How does one install the Oracle JServer Option?
Make sure your database is started with large java_pool_size (>20M) and shared_pool_size
(>50M) INIT.ORA parameter values. Run the $ORACLE_HOME/javavm/install/initjvm.sql
script from SYS AS SYSDBA to install the Oracle JServer Option on a database.
The rmjvm.sql script can be used to deinstall the JServer option from your database.
3. What is JDBC and what is it used for?
JDBC is a set of classes and interfaces written in Java to allow other Java programs to
send SQL statements to a relational database management system.
Oracle provides three categories of JDBC drivers:

JDBC Thin Driver (No local Net8 installation required/ handy for applets)
JDBC OCI for writing stand-alone Java applications
JDBC KPRB driver (default connection) for Java Stored Procedures and Database
JSP's.

Oracle's JDBC Thin driver uses Java sockets to connect directly to Oracle. It provides its
own TCP/IP version of Oracle's Net8 (SQL*Net) protocol. Because it is 100% Java, this
driver is platform independent and can also run from a Web Browser (applets).
Oracle's JDBC OCI drivers uses Oracle OCI (Oracle Call Interface) to interact with an
Oracle database. You must use a JDBC OCI driver appropriate to your Oracle client
installation. The OCI driver works through either SQL*Net or Net8.

JDBC OCI7 works with an Oracle7 client.


JDBC OCI8 works with an Oracle8 client.

Either of these client versions can access Oracle7 or Oracle8 servers.


The JDBC OCI drivers allow you to call the OCI directly from Java, thereby providing a
high degree of compatibility with a specific Version of Oracle. Because they use native
methods, they are platform specific.

ORACLE Question Bank

Page 12 of 141

HCL Technologies Banking Center

Confidential

Oracle's JDBC KBPR driver is mainly used for writing Java stored procedures, triggers and
database JSPs. It uses the default/ current database session and thus requires no
additional database username, password or URL.
All three drivers support the same syntax and API's. Oracle needs three drivers to support
different deployment options. Looking at source code, they will only differ in the way you
connect to the database. Remember, you must use a JDBC version that matches the version
of your Java Development Kit.
4. How does one connect with the JDBC Thin Driver?
The JDBC thin driver provides the only way to access Oracle from the Web (applets). It is
smaller and faster than the OCI drivers, and doesn't require a pre-installed version of the
JDBC drivers.
import java.sql.*;
class dbAccess {
public static void main (String args []) throws SQLException
{
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@qit-uq-cbiw:1526:orcl", "scott", "tiger");
// @machineName:port:SID, userid, password
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION");
while (rset.next())
System.out.println (rset.getString(1)); // Print col 1
stmt.close();
}

5. How does one connect with the JDBC OCI Driver?


One must have Net8 (SQL*Net) installed and working before attempting to use one of the
OCI drivers.
import java.sql.*;
class dbAccess {
public static void main (String args []) throws SQLException
{
try {
Class.forName ("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}

ORACLE Question Bank

Page 13 of 141

HCL Technologies Banking Center

Confidential

Connection conn = DriverManager.getConnection


("jdbc:oracle:oci8:@qit-uq-cbiw_orcl", "scott", "tiger");
// or oci7 @TNSNames_Entry, userid, password

Statement stmt = conn.createStatement();


ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION");
while (rset.next())
System.out.println (rset.getString(1)); // Print col 1
stmt.close();

}
6. How does one connect with the JDBC KPRB Driver?
One can obtain a handle to the default or current connection (KPRB driver) by calling the
OracleDriver.defaultConenction() method. Please note that you do not need to specify a
database URL, username or password as you are already connected to a database session.
Remember not to close the default connection. Closing the default connection might throw
an exception in future releases of Oracle.
import java.sql.*;
class dbAccess {
public static void main (String args []) throws SQLException
{
Connection conn = (new oracle.jdbc.driver.OracleDriver()).defaultConnection();
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION");
while (rset.next())
System.out.println (rset.getString(1)); // Print col 1
stmt.close();
}

7. Where can one get more info about JDBC?


1.
2.
3.
4.

Download Sun's Java Developers Kit and various other API's


JDBC Guide: Getting Started
Download Oracle's JDBC Drivers
The comp.lang.java FAQ List

ORACLE Question Bank

Page 14 of 141

HCL Technologies Banking Center

Confidential

7. What is SQLJ and what is it used for?


SQLJ is an ANSI standard way of coding SQL access in Java. It provides a Java
precompiler that translates SQLJ call to JDBC calls. The idea is similar to that of other
Oracle Precompilers.
SQLJ is more concise and thus easier to write than JDBC, and provides compile-time
schema validation and syntax checking for easier debugging. SQLJ reads input either from
a *.SQLJ file, or a Java source file in which SQLJ statements are embedded. The SQLJ
precompiler translates the SQLJ statements into their equivalent JDBC calls. SQLJ
supports static SQL.
8. How does one write SQLJ programs?
See the Scripts and sample programs section for some SQLJ example programs.
9. How does one deploy SQLJ programs?
Use the sqlj compiler to compile your *.sqlj files to *.java and *.ser files. The *.ser files
contain vendor specific database code. Thereafter one invokes the javac compiler to compile
the .java files to *.class files. The *.class and *.ser files needs to be deployed.
10. Where can one get more info about SQLJ?

The SQLJ Organization


Sun's InfoBus Controls

11. What is JDeveloper and what is it used for?


JDeveloper is the Oracle IDE (Integrated Development Environment) for developing SQLJ
and JDBC programs, applets, stored procedures, EJB's, JSP's etc.
JDeveloper are extremely resource hungry and requires a big workstation. However, it
provides an extremely productive environment for Java Developers.
12. How does one set runtime parameter in JDeveloper?
Navigate to Project |--> Project Properties... |--> Run/Debug and enter field parameters.
These parameters will be picked up when you execute a Java program from JDeveloper.
public static void main(String[] args) { ...

ORACLE Question Bank

Page 15 of 141

HCL Technologies Banking Center

Confidential

13. What is InfoBus DAC and what is it used for?


InfoBus DAC (Data Aware Controls) is a standard Java extension used in JDeveloper to
create data aware forms. It replaced the JBCL interface that was used in JDeveloper V1
and V2. More info about Infobus is available from the following URL:
java.sun.com/beans/infobus
To use InfoBus DAC, import javax.infobus.*; into your Java program.
14. What is a JSP and what is it used for?
Java Server Pages (JSP) is a platform independent presentation layer technology that
comes with SUN's J2EE platform. JSPs are normal HTML pages with Java code pieces
embedded in them. JSP pages are saved to *.jsp files. A JSP compiler is used in the
background to generate a Servlet from the JSP page.
15. What is the difference between ASP and JSP?
Active Server Pages (ASP) is a Microsoft standard, which is easier to develop than Java
Server Pages (JSP). However ASP is a proprietary technology and is less flexible than JSP.
For more information about ASP, see the Oracle ASP FAQ.
16. How does one invoke a JSP?
A JSP gets invoked when you call a *.jsp file from your Web Server like you would call a
normal *.html file. Obviously your web server need to support JSP pages and must be
configured properly to handle them.
17. How does a JSP gets executed?
The first time you call a JSP, a servlet (*.java) will be created and compiled to a .class file.
The class file is then executed on the server. Output produced by the servlet is returned to
the web browser. Output will typically be HTML or XML code.
18. How does one write a JSP page?
You can use Oracle JDeveloper to create JSP pages. Alternatively you can open a standard
text file and code the required HTML and Java manually. Look at this example:
<HTML>
<BODY>
<% out.println("Hello World"); %> <P>
Today is: <%= new java.util.Date() %> <P>
Page generated with: <%= this.getServeleteInfo() %> <P>

ORACLE Question Bank

Page 16 of 141

HCL Technologies Banking Center

Confidential

19. What is a Java Stored Procedure/ Trigger?


A Java Stored Procedure is a procedure coded in Java (as opposed to PL/SQL) and stored in
the Oracle database. Java Stored procedures are executed by the database JVM in
database memory space.
Java Stored Procedures can be developed in JDBC or SQLJ. Interfacing between PL/SQL
and Java are extremely easy. Please note that Java Stored procedures are by default
executed with invokers rights. PL/SQL procedures are by default executed with defines
rights.
Note: JSP is Java Server Pages and NOT Java Stored Procedures.
20. How does one write a Java Stored Procedure?
Java Stored Procedures must comply with the following rules:
7. No constructor method is needed
8. Variables and methods must be declared static
9. Use the default database connection (no userid/ password required, run in session)
10. Declare output variables as arrays
public static void getEmpInfo(int empno, String[] empName, int[] salary) {
21. How does on load a Java Stored Procedure into the database?
Create a deployment profile from JDeveloper or use the loadjava command line utility.
22. How does on drop a Java Stored Procedure from the database?

SQL*Plus: drop java class .../ drop package ... (drop the wrapper)
dropjava utility: dropjava -u scott/tiger myPackage.myClass

23. How does on call/execute a Java Stored Procedure?

From SQL*Plus: Use execute or call


From JDBC: Use the CallableStatement object
From SQLJ: #sql { call ...} eg: #sql { call ACME.BEGINRENTAL(:in memberID, :in
employeeID, :out, ...) };

ORACLE Question Bank

Page 17 of 141

HCL Technologies Banking Center

Confidential

24. What happens when you write to the console from a Java Stored Procedure?
Console output from System.out.println() statements will be written to trace files in the
Oracle UDUMP destination directory.

ORACLE Question Bank

Page 18 of 141

HCL Technologies Banking Center

Confidential

Oracle Objects for OLE


What is Oracle Objects for OLE?
Oracle Objects for OLE (OO4O) is a middleware product manufactured by Oracle
Corporation that allows native access (no ODBC) to Oracle databases from client
applications via Microsoft OLE (Object Linking and Embedding) and COM.
One can bind grids, text box widgets, and so on to OO4O via its own Data Control, one can
also create dynasets, execute stored procedure code, or just about any other Oracle
command one can think of. Oracle Objects consists of the following three components:

An OLE 2.0 Automation (InProcess) Server - This provides an OLE Automation


interface to applications that support OLE automation scripting such as Visual Basic
(VB).
An Oracle Data Control - This is the Visual Basic custom control (VBX).
Two C++ Class Libraries - C-Libraries for Microsoft Foundation Classes (MFC) and
Borland (OWL).

OO4O's predecessor was called Oracle Glue.


How does OO4O compare to ODBC?
OO4O provides native access to Oracle and only Oracle databases, and is thus faster than
ODBC access. ODBC is more generic and not database specific at all. One can use ODBC to
connect to databases like Oracle, DB/2, SQLServer, etc. For more information about ODBC,
read the ODBC FAQ.
OO4O closely follows the ODBC query interface model, one can retain over 95% code
compatibility between the OO4O and ODBC versions of data layer procedures. This
translates to very short retooling times when porting between OO4O and ODBC.
Can I use OO4O to access Oracle data from Microsoft applications?
Yes, you can use OO4O from any Microsoft application that uses the VB-style macro
language. This includes applications like:
Microsoft Visual Basic
Microsoft Excel
Microsoft MS-Access
Active Server Pages (ASP)
C++, etc.

ORACLE Question Bank

Page 19 of 141

HCL Technologies Banking Center

Confidential

How does one install and configure OO4O?


Follow these steps to install and configure OO4O:
1. Install the Oracle Client CD on your workstation. This will install OO4O (Oracle
Objects for OLE) and SQL*Net on your system.
2. Configure SQL*Net and ensure you can tnsping and connect your Oracle database.
This is done by adding an entry to the TNSNAMES.ORA file or by using utilities like
the "Net Easy Configurator" to do it for you. See the SQL*Net FAQ for details.
3. You are ready to GO!!!
What OO4O Objects are available for use while programming?
OO4O makes the following high-level Objects available for use:
OraSession

The first top-level object needed before we can connect to an


Oracle database.

OraServer

Represents a physical connection to an Oracle database server


instance. The OpenDatabase function can be used to create client
sessions by returning an OraDatabase object.

OraDatabase

Represents a single login to an Oracle database. Similar to the ADO


Connection object. OraDatabase objects are returned by the
OraSession.OpenDatabase function.

OraConnection

Returns various pieces of user information about the current


OraSession object. It can be shared by many OraDatabase objects,
but each OraDatabase must exist in the same OraSession object.

OraDynaset

Similar to an ADO Recordset object. Represents the results


retrieved by a call to the OraDatabase.CreateDynaset function.

OraField

Represents a column of data within an OraDynaset object. Similar to


the ADO Field object of an ADO Recordset.

OraClient

Automatically created by OO4O as needed. Maintains a list of all


active OraSession objects currently running on the workstation.

OraParameter

Represents a bind variable for a SQL statement or PL/SQL block to


be executed using the OraDynaset object. Similar to the Parameter
object in an ADO Command object.

OraParamArray

Allows arrays of parameters to be set for the


OraDatabase.Parameters function.

OraSQLStmt

Represents a single SQL statement. Typically used with SQL


statements that include bind variables to improve performance as
Oracle does not have to parse the statement each time it is
executed. Can be thought of as conceptually similar to the ADO
Command object.

OraMetaData

Returns meta data to describe a particular schema such as column

ORACLE Question Bank

Page 20 of 141

HCL Technologies Banking Center

Confidential

names. Similar to the SQL Server DMO object library. See the meta
data example below.

OraAQ

The CreateAQ method of the OraDatabase returns an OraAQ


object. This provides access to Oracle's Advanced Queuing message
system that allows messages to be passed between applications,
much like MSMQ.

How does one connect to an Oracle Database?


Connect to Oracle using the OpenDatabase function. The OpenDatabase function returns an
OraDatabase object. Parameters are DB_NAME, CONNECT_DESCRIPTOR and
CONNECT_OPTIONS. Look at the following Visual Basic code example:
Dim OraSession As Object 'Declare variables as OLE Objects
Dim OraDatabase As Object
Dim OraDynaset As Object
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
Set OraDatabase = OraSession.DbOpenDatabase("SQL*Net_Connect_String",
"scott/tiger", 0&)
MsgBox "Connected to " & OraDatabase.Connect & "@" &
OraDatabase.DatabaseName
MsgBox "OO4O Version: " & OraSession.OIPVersionNumber
MsgBox "Oracle Version: " & OraDatabase.RDBMSVersion
How does one select data from an Oracle Database using OO4O?
Use the OraDynaSet object to define recordsets. Look at this simple example:
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
Set OraDatabase = OraSession.DbOpenDatabase("SQL*Net_Connect_String",
"scott/tiger", 0&)
Set OraDynaset = OraDatabase.DbCreateDynaset("select empno, ename from
emp", 0&)
MsgBox "Employee " & OraDynaset.Fields("empno").value & ", #" &
OraDynaset.Fields("ename").value
One can also loop through the result set using code like this:
Do While(OraDynaset.EOF = FALSE)
Response.write(OraDynaset.Fields("TNAME") & "<BR>")
osRecordSet.MoveNext
Loop

ORACLE Question Bank

Page 21 of 141

HCL Technologies Banking Center

Confidential

How does one use bind variables in OO4O?


Use the "OraParameters.Add Name, Value, IOType" method to substitute bind variables
with values before executing a statement. If you don't, you will get error "not all variables
bound". The IOType filed can be one of the following:
1 ORAPARM_INPUT

Use as input variable only

2 ORAPARM_OUTPUT Use as output variable only


3 ORAPARM_BOTH

Use the variable for input and output

Look at this example:


sqlStmt = "SELECT tname FROM tab WHERE tname LIKE :var1"
OraDatabase.Parameters.add "var1", "%A%", 1 ' Substitute Name=Value of type
ORAPARM_INPUT
Set osRecordSet = OraDatabase.DbCreateDynaset(sqlStmt, cint(0))
Do While(osRecordset.EOF = FALSE)
' Use data: osRecordset.Fields("TNAME") in this example...
osRecordSet.MoveNext
Loop
How does one execute DML and DDL statements using OO4O?
One can use any valid DDL and DML statement with the ExecuteSQL (or DBExecuteSQL)
method. Look at this example:
rowcount = OraDatabase.ExecuteSQL("create table X (A date)")
rowcount = OraDatabase.ExecuteSQL("insert into X values (sysdate)")
OraSession.CommitTrans ' or OraSession.Rollback
How does one call a stored procedure from OO4O?
A stored procedure block can be executed from the CreateSQL or ExecuteSQL methods.
OO4O supports the SQL statement objects for PL/SQL stored procedures. Look at this VB
example:
sql1 = "begin test_sproc(param2=>'two_b', param1=>'one_b'); end;"
rowcnt = OraDatabase.DbExecuteSQL(sql1)
More complex example using input and output parameters. Note that the output parameter
returns a cursor:
OraDatabase.Parameters.Add "NAME", "SUPERSPORT", ORAPARM_INPUT
OraDatabase.Parameters("NAME").ServerType = ORATYPE_VARCHAR2
OraDatabase.Parameters.Add "ORDCURSOR", 0, ORAPARM_OUTPUT
OraDatabase.Parameters("ORDCURSOR").ServerType = ORATYPE_CURSOR
Set OraSQLStmt = OraDatabase.CreateSql("begin
CUSTOMERS.GetCutomerSalesOrder(:Name,:OrdCursor);end;", ORASQL_FAILEXEC)

ORACLE Question Bank

Page 22 of 141

HCL Technologies Banking Center

Confidential

Set OrderDynaset = OraDatabase.Parameters("ORDCURSOR").Value


'Now display the Dynaset's field value
MsgBox "Order Details are " & OrderDynaset.fields("ordid").Value & " " &
How does one use the OraMetaData Object to describe tables?
The OraMetaData object (available from Oracle8i) can be used to retrieve all sorts of
information about an Oracle schema. For example, one can list all objects in a schema, all
columns of a table, etc. Look at this simple ASP example:
Response.write("<H1>Describe Table EMP:</H1>")
Set objOraMetaData = OraDatabase.Describe("EMP")
Set objOraMDAttribute = objOraMetaData("ColumnList")
Set objColumnList = objOraMDAttribute.Value
For iColCount = 0 To objColumnList.Count - 1
Set objColumnDetails = objColumnList(iColCount).Value
Response.Write "<P >Column: " & objColumnDetails("Name") & _
"<BR>Type: " & objColumnDetails("DataType") & _
"<BR>Size: " & objColumnDetails("DataSize") & _
"<BR>IsNull: " & objColumnDetails("IsNull") & _
"<BR>Precision: " & objColumnDetails("Precision") & _
"<BR>Scale: " & objColumnDetails("Scale")
Next

ORACLE Question Bank

Page 23 of 141

HCL Technologies Banking Center

Confidential

Oracle Media Objects


What is Oracle Media Objects (OMO)?
Oracle Media Objects is a highly graphical authoring environment (similar in metaphor to
HyperCard) for creating multimedia applications for client/server, CD-ROM, and interactive
television (ITV) configurations.
With Oracle Media Objects, you can create a variety of applications: computer-based
training, entertainment and educational CD-ROM titles, kiosks, set-top box applications and
presentations.
How does one program using OMO?
Oracle Media Objects provides an English-like, interpreted, event-driven scripting language
called Oracle Media Talk to control and to customize the behavior and objects of
applications.
Here is an example of Media Talk script:
beep
set the loc of card button id 1 to 100, 200
hide cd bitmap "ColorImage"
go to next card
WARNING: Oracle Media Objects V1.1.2 will be the last release of OMO ever. Please
call Oracle before you undertake serious development.

ORACLE Question Bank

Page 24 of 141

HCL Technologies Banking Center

Confidential

Personal Oracle Light (POL)


What is Personal Oracle Light?
Personal Oracle Light (POL) is a lightweight, single-user object/relational database that
runs on desktops, laptops, down to the smallest hand help devices. It is designed for mobile
and distributed applications. Some of the main features are:
POL runs in under 1 megabyte of memory, and can be installed in 3 megabytes of
hard disk space;
has full Java and SQL support (no PL/SQL);
is ODBC and JDBC compliant;
can handle up to 16 concurrent application connections;
supports replication via file, HTTP, SQL*Net, and Oracle Mobile Agents;
runs on WindowsNT, Windows95/98, WindowsCE, and PalmOS.
NOTE: One must download and install a Java VM from the JavaSoft web site before all
Oracle Lite components can work properly.
How compatible is Oracle Lite with the standard Oracle Server?
Although code compatibility is very high, the following features are not supported in Oracle
Light:

PL/SQL (use Java Stored Procedures and triggers instead)


Oracle Light is intended as a small, single-user client database and do not support
any server functionalities like Java CORBA ORB's, SQL*Net Listeners, etc.
In Oracle Lite, all rows are stored as objects, and there is a relational layer on top
of the object layer to allow relational views of the data. Oracle7/8 stores data in a
relational format, then uses an object metalayer to provide object views and
functionality.
Only selected dictionary views are available, eg. ALL_TABLES, ALL_VIEWS,
ALL_USERS, CAT, etc.
An Oracle Lite database can only be queried from a remote client if it's data is
replicated.

How does one connect to a POL database?


To connect to a POL database, the username is typically SYSTEM (with POL v2.4 the
default username is OOT_SCH). The password is ignored as the POL database is initially not
password protected, but must be specified for SQL*Plus. The connect string should be
ODBC:data_source_name. The "ODBC:" tells SQL*Plus that this is not a SQL*Net
connection, and that it must use the Oracle Open Client Adapter (OCA) to access the
database.
The following command line is used to access the default starter database via SQL*Plus:

ORACLE Question Bank

Page 25 of 141

HCL Technologies Banking Center

Confidential

plus33 system/manager@odbc:polite:polite
SQL> select * from all_tables;
SQL> exit;
How does one write Java Stored Procedures?
Step 1: Create the Java Class and Methods in a file
In this example we will create a Java class "EMPL" in a file called EMPL.java to implement
the get_sal method:
import java.sql.*;
public class EMPL {
public static int get_sal(Connection conn, int empno) throws Exception
{
Statement s = conn.createStatement();
ResultSet r = s.executeQuery("SELECT sal, nvl(comm,0) FROM EMP WHERE
empno="+empno);
int sal = 0;
if (r.next()) {
sal = r.getInt(1) + r.getInt(2); /* sal = :sal + :comm */
} else {
throw new Exception("Employee "+empno+" is invalid.");
}

r.close(); s.close();
System.out.println("Salary for employee "+empno+" is "+sal);
return sal;

}
Step 2: Attach the Java Class to the Table
ALTER TABLE EMP ATTACH SOURCE "EMPL" IN '.';
Step 3: Execute the Method
To execute the get_sal method from SQL*Plus:
SELECT EMP."get_sal"(7369) FROM DUAL;
To execute this method from ODBC:
SQLExecDirect(hstm, "SELECT EMP.\"get_sal\"(7369) FROM DUAL");

ORACLE Question Bank

Page 26 of 141

HCL Technologies Banking Center

Confidential

How does one replicate data using Oracle Lite?


Oracle Lite supports read-only and updatable snapshot replication.
Any other Oracle Lite tips?

Use the ODBC function to get the DB name: SELECT CAST({FN DATABASE()} AS
CHAR(16)) FROM DUAL;
To create a new database use the following command line: CREATEDB polite
new_db_name
Connect to your newly created DB with connect string:
system/manager@odbc:polite:new_db_name

ORACLE Question Bank

Page 27 of 141

HCL Technologies Banking Center

Confidential

OEM
What is OEM (Oracle Enterprise Manager)?
OEM is a set of system management tools provided by Oracle for managing the Oracle
environment. It provides tools to automate tasks (both one-time and repetitive in nature) to
take database administration a step closer to "Lights Out" management.
What are the components of OEM?
Oracle Enterprise Manager (OEM) has the following components:

Management Server (OMS): Middle tier server that handles communication with
the intelligent agents. The OEM Console connects to the management server to
monitor and configure the Oracle enterprise.
Console: This is a graphical interface from where one can schedule jobs, events, and
monitor the database. The console can be opened from a Windows workstation, Unix
XTerm (oemapp command) or Web browser session (oem_webstage).
Intelligent Agent (OIA): The OIA runs on the target database and takes care of
the execution of jobs and events scheduled through the Console.
Data Gatherer (DG): The DG runs on the target database and takes care of the
gathering database statistics over time.

How does one stop and start the OMS?


Use the following command sequence to stop and start the OMS (Oracle Management
Server):
oemctrl start oms
oemctrl status oms sysman/oem_temp
oemctrl stop oms sysman/oem_temp
Windows NT/2000 users can just stop and start the required services. The default OEM
administrator is "sysman" with a password of "oem_temp".
How does one create a repository?
For OEM v2 and above, start the Oracle Enterprise Manager Configuration Assistant
(oemca on Unix) to create and configure the management server and repository. Remember
to setup a backup for the repository database after creating it.
The following describes means to create a OEM V1.x (old!!!) repository on WindowsNT:

Create a tablespace that would hold the repository data. A size between 200- 250
MB would be ideal. Let us call it Dummy_Space.
Create an Oracle user who would own this repository. Assign DBA, SNMPAgent,
Exp_Full_database, Imp_Full_database roles to this user. Lets call this user
Dummy_user. Assign Dummy_Space as the default tablespace.

ORACLE Question Bank

Page 28 of 141

HCL Technologies Banking Center

Confidential

Create an operating system user with the same name as the Oracle username. I.e.
Dummy_User. Add `Log on as a batch job' under advanced rights in User manager.
Fire up Enterprise manager and log in as Dummy_User and enter the password. This
would trigger the creation of the repository. From now on, Enterprise manager is
ready to accept jobs.

How does one list one's databases in the OEM Console?


Follow these steps to discover databases and other services from the OEM Console:
1. Ensure the GLOBAL_DBNAME parameter is set for all databases in your LISTENER.ORA
file (optional). These names will be listed in the OEM Console. Please note that names
entered are case sensitive.
2. Start the Oracle Intelligent Agent on the machine you want to discover. See section
"How does one start the Oracle Intelligent Agent?".
3. Start the OEM Console, navigate to menu "Navigator/ Discover Nodes". The OEM
Discovery Wizard will guide you through the process of discovering your databases and
other services.
Should the OEM Console be displayed at all times (when there are scheduled jobs)?
When a job is submitted the agent will confirm the status of the job. When the status
shows up as scheduled, you can close down the OEM console. The processing of the job is
managed by the OIA (Oracle Intelligent Agent). The OIA maintains a .jou file in the agent's
subdirectory. When the console is launched communication with the Agent is established
and the contents of the .jou file (binary) are reported to the console job subsystem.
Note that OEM will not be able to send e-mail and paging notifications when the Console is
not started.
What kind of jobs can one schedule with OEM?
OEM comes with pre-defined jobs like Export, Import, run DOS commands, run sql scripts,
SQL*Plus commands etc. It also gives you the flexibility of scheduling custom jobs written
with the TCL language.
What is the Oracle Intelligent Agent?
The Oracle Intelligent Agent (OIA) is an autonomous process that needs to run on a remote
node in the network to make the node OEM manageable. The Oracle Intelligent Agent is
responsible for:
Discovering targets that can be managed (Database Servers, Net8 Listeners, etc.);
Monitoring of events registered in Enterprise Manager; and
Executing tasks associated with jobs submitted to Enterprise Manager.

ORACLE Question Bank

Page 29 of 141

HCL Technologies Banking Center

Confidential

How does one start the Oracle Intelligent Agent?


One needs to start an OIA (Oracle Intelligent Agent) process on all machines that will to be
managed via OEM.
On Unix, issue these commands:
lsnrctl dbsnmp_start
lsnrctl dbsnmp_status
On Windows NT, start the "OracleAgent" Service.
If the agent doesn't want to start, ensure your environment variables are set correctly and
delete the following files before trying again:
1) In $ORACLE_HOME/network/admin: snmp_ro.ora and snmp_rw.ora.
2) Also delete ALL files in $ORACLE_HOME/network/agent/.
What is the Oracle Data Gatherer?
The Data Gatherer (DG) is an underlying service that Capacity Planners (CP) and
Performance Monitors (PM) use to gather operating system and database statistics. The
Data Gatherer is available on most platforms from Oracle version 8.0.4 or 8.0.5.
There is no separate user manual for the DG. More information about the DG can be
obtained from the OEM Configuration Guide.
How does one start the Oracle Data Gatherer?
USAGE: vppcntl <-stop> <-start> <-ping> <-refresh>
On Windows NT, start the "Data Gatherer Service", on Unix, issue these commands:
$ vppcntl -start
The Oracle Data Gatherer is running.
$ vppcntl -ping
The Oracle Data Gatherer is running.
You will notice a "vppdc" process running on your system. Remember to check the log file;
$ORACLE_HOME/odg/log/alert_dg.log for problems.
Can one write scripts to send alert messages to the console?
Start the OEM console and create a new event. Select option "Enable Unsolicited Event".
Select test "Unsolicited Event". When entering the parameters, enter values similar to
these:
Event Name:
/oracle/script/myalert
Object:
*
Severity: *

ORACLE Question Bank

Page 30 of 141

HCL Technologies Banking Center

Confidential

Message:
*
One can now write the script and invoke the oemevent command to send alerts to the
console. Look at this example:
oemevent /oracle/script/myalert DESTINATION alert "My custom error
message"
where DESTINATION is the same value as entered in the "Monitored Destinations" field
when you've registered the event in the OEM Console.
Are there any troubleshooting tips for OEM?

Create the OEM repository with a user (which will manage the OEM) and store it in
a tablespace that does not share any data with other database users. It is a bad
practice to create the repository with SYS and System.
If you are unable to launch the console or there is a communication problem
with the intelligent agent (daemon).
Ensure OCX files are registered. Type the following in the DOS prompt (the current
directory should be $ORACLE_HOME\BIN:
C:\Orawin95\Bin> RegSvr32 mmdx32.OCX

C:\Orawin95\Bin> RegSvr32 vojt.OCX


If you have a problem starting the Oracle Agent
Solution A: Backup the *.Q files and Delete all the *.Q Files
($Oracle_home/network/agent folder)
Backup and delete SNMP_RO.ora, SNMP_RW.ora, dbsnmp.ver and services.ora files
($Oracle_Home/network/admin folder)
Start the Oracle Agent service.
Solution B: Your version of Intelligent Agent could be buggy. Check with Oracle for
any available patches. For example, the Intelligent Agent that comes with Oracle
8.0.4 is buggy.

Sometimes you get a Failed status for the job that was executed successfully.
Check the log to see the results of the execution rather than relying on this status.
This is one of the known bugs.

ORACLE Question Bank

Page 31 of 141

HCL Technologies Banking Center

Confidential

Important Questions in Oracle, Developer /2000(Form 4.5 and Reports 2.5)

1) What are the Back ground processes in Oracle and what are they.
There are basically 9 Processes but in a general system we need to mention the first five
background processes. They do the house keeping activities for the Oracle and are common
in any system.
The various background processes in oracle are
a) Data Base Writer(DBWR) :: Data Base Writer Writes Modified blocks from
Database buffer cache to Data Files. This is required since the data is not written
whenever a transaction is commited.
b)LogWriter(LGWR) :: LogWriter writes the redo log entries to disk. Redo Log data is
generated in redo log buffer of SGA. As transaction commits and log buffer fills, LGWR
writes log entries into a online redo log file.
c) System Monitor(SMON) :: The System Monitor performs instance recovery at instance
startup.This is useful for recovery from system failure
d)Process Monitor(PMON) :: The Process Monitor peforms process recovery when user
Process fails. Pmon Clears and Frees resources that process was using.
e) CheckPoint(CKPT) :: At Specified times, all modified database buffers in SGA are
written to data files by DBWR at Checkpoints and Updating all data files and control files
of database to indicate the
most recent checkpoint
f)Archieves(ARCH) :: The Archiver copies online redo log files to archival storal when they
are busy.
g) Recoveror(RECO) :: The Recoveror is used to resolve the distributed transaction in
network
h) Dispatcher (Dnnn) :: The Dispatcher is useful in Multi Threaded Architecture
i) Lckn :: We can have upto 10 lock processes for inter instance locking in parallel sql.

2) How many types of Sql Statements are there in Oracle


There are basically 6 types of sql statments.They are
a) Data Defination Language(DDL) :: The DDL statments define and maintain objects and
drop objects.
b) Data Manipulation Language(DML) :: The DML statments manipulate database data.
c) Transaction Control Statements :: Manage change by DML
d) Session Control :: Used to control the properties of current session enabling and
disabling roles and changing .e.g :: Alter Statements,Set Role
e) System Control Statements :: Change Properties of Oracle Instance .e.g:: Alter System
f) Embedded Sql :: Incorporate DDL,DML and T.C.S in Programming Language.e.g:: Using
the Sql Statements in languages such as 'C', Open,Fetch, execute and close

ORACLE Question Bank

Page 32 of 141

HCL Technologies Banking Center

Confidential

3) What is a Transaction in Oracle


A transaction is a Logical unit of work that compromises one or more SQL Statements
executed by a single User. According to ANSI, a transaction begins with first executable
statment and ends when it is explicitly commited or rolled back.
4) Key Words Used in Oracle
The Key words that are used in Oracle are ::
a) Commiting :: A transaction is said to be commited when the transaction makes
permanent changes resulting from the SQL statements.
b) Rollback :: A transaction that retracts any of the changes resulting from SQL
statements in Transaction.
c) SavePoint :: For long transactions that contain many SQL statements, intermediate
markers or savepoints are declared. Savepoints can be used to divide a transactino into
smaller points.
d) Rolling Forward :: Process of applying redo log during recovery is called rolling
forward.
e) Cursor :: A cursor is a handle ( name or a pointer) for the memory associated with a
specific stament. A cursor is basically an area allocated by Oracle for executing the Sql
Statement. Oracle uses an implicit cursor statement for Single row query and Uses Explcit
cursor for a multi row query.
f) System Global Area(SGA) :: The SGA is a shared memory region allocated by the
Oracle that contains Data and control information for one Oracle Instance.It consists of
Database Buffer Cache and Redo log Buffer.
g) Program Global Area (PGA) :: The PGA is a memory buffer that contains data and
control information for server process.
g) Database Buffer Cache :: Databese Buffer of SGA stores the most recently used
blocks of datatbase data.The set of database buffers in an instance is called Database
Buffer Cache.
h) Redo log Buffer :: Redo log Buffer of SGA stores all the redo log entries.
i) Redo Log Files :: Redo log files are set of files that protect altered database data in
memory that has not been written to Data Files. They are basically used for backup when a
database crashes.
j) Process :: A Process is a 'thread of control' or mechansim in Operating System that
executes series of steps.
5) What are Procedure,functions and Packages
Procedures and functions consist of set of PL/SQL statements that are grouped together
as a unit to solve a specific problem or perform set of related tasks.
Procedures do not Return values while Functions return one One Value
Packages
:: Packages Provide a method of encapsulating and storing related
procedures, functions, variables and other Package Contents
6) What are Database Triggers and Stored Procedures
Database Triggers :: Database Triggers are Procedures that are automatically executed as
a result of insert in, update to, or delete from table.

ORACLE Question Bank

Page 33 of 141

HCL Technologies Banking Center

Confidential

Database triggers have the values old and new to denote the old value in the table before it
is deleted and the new indicated the new value that will be used. DT are useful for
implementing complex business rules which cannot be enforced using the integrity rules. We
can have the trigger as Before trigger or After Trigger and at Statement or Row level.
e.g:: operations insert,update ,delete 3
before ,after
3*2 A total of 6 combinatons
At statment level(once for the trigger) or row level( for every execution )
6*2
A total of 12.
Thus a total of 12 combinations are there and the restriction of usage of 12 triggers has
been lifted from Oracle 7.3 Onwards.
Stored Procedures :: Stored Procedures are Procedures that are stored in Compiled form
in the database.The advantage of using the stored procedures is that many users can use
the same procedure in compiled and ready to use format.
7) How many Integrity Rules are there and what are they
There are Three Integrity Rules. They are as follows ::
a) Entity Integrity Rule :: The Entity Integrity Rule enforces that the Primary key cannot
be Null
b) Foreign Key Integrity Rule :: The FKIR denotes that the relationship between the
foreign key and the primary key has to be enforced.When there is data in Child Tables the
Master tables cannot be deleted.
c) Business Integrity Rules :: The Third Intigrity rule is about the complex business
processes which cannot be implemented by the above 2 rules.
8) What are the Various Master and Detail Relation ships.
The various Master and Detail Relationship are
a) NonIsolated :: The Master cannot be deleted when a child is exisiting
b) Isolated :: The Master can be deleted when the child is exisiting
c) Cascading :: The child gets deleted when the Master is deleted.
9) What are the Various Block Coordination Properties
The various Block Coordination Properties are
a) Immediate
Default Setting. The Detail records are shown when the Master Record are shown.
b) Deffered with Auto Query
Oracle Forms defer fetching the detail records until the operator navigates to the detail
block.
c) Deffered with No Auto Query
The operator must navigate to the detail block and explicitly execute a query
10) What are the Different Optimisation Techniques
The Various Optimisation techniques are
a) Execute Plan :: we can see the plan of the query and change it accordingly based on the
indexes
b) Optimizer_hint ::
set_item_property('DeptBlock',OPTIMIZER_HINT,'FIRST_ROWS');

ORACLE Question Bank

Page 34 of 141

HCL Technologies Banking Center

Confidential

Select /*+ First_Rows */ Deptno,Dname,Loc,Rowid from dept


where (Deptno > 25)
c) Optimize_Sql ::
By setting the Optimize_Sql = No, Oracle Forms assigns a single cursor for all SQL
statements.This slow downs the processing because for evertime the SQL must be parsed
whenver they are executed.
f45run module = my_firstform userid = scott/tiger optimize_sql = No
d) Optimize_Tp ::
By setting the Optimize_Tp= No, Oracle Forms assigns seperate cursor only for each query
SELECT statement. All other SQL statements reuse the cursor.
f45run module = my_firstform userid = scott/tiger optimize_Tp = No
11) How do u implement the If statement in the Select Statement
We can implement the if statement in the select statement by using the Decode statement.
e.g select DECODE (EMP_CAT,'1','First','2','Second'Null);
Here the Null is the else statement where null is done .
12)How many types of Exceptions are there
There are 2 types of exceptions. They are
a) System Exceptions
e.g. When no_data_found, When too_many_rows
b) User Defined Exceptions
e.g. My_exception exception
When My_exception then
13) What are the inline and the precompiler directives
The inline and precompiler directives detect the values directly
14) How do you use the same lov for 2 columns
We can use the same lov for 2 columns by passing the return values in global values and
using the global values in the code
15) How many minimum groups are required for a matrix report
The minimum number of groups in matrix report are 4
16) What is the difference between static and dynamic lov
The static lov contains the predetermined values while the dynamic lov contains values that
come at run time
17) What are snap shots and views
Snapshots are mirror or replicas of tables. Views are built using the columns from one or
more tables. The Single Table View can be updated but the view with multi table cannot be
updated

ORACLE Question Bank

Page 35 of 141

HCL Technologies Banking Center

Confidential

18) What are the OOPS concepts in Oracle.


Oracle does implement the OOPS concepts. The best example is the Property Classes. We
can categorise the properties by setting the visual attributes and then attach the property
classes for the objects. OOPS supports the concepts of objects and classes and we can
consider the peroperty classes as classes and the items as objects
19) What is the difference between candidate key, unique key and primary key
Candidate keys are the columns in the table that could be the primary keys and the primary
key is the key that has been selected to identify the rows. Unique key is also useful for
identifying the distinct rows in the table.
20)What is concurrency
Cuncurrency is allowing simultaneous access of same data by different users. Locks useful
for accesing the database are
a) Exclusive
The exclusive lock is useful for locking the row when an insert,update or delete is being
done.This lock should not be applied when we do only select from the row.
b) Share lock
We can do the table as Share_Lock as many share_locks can be put on the same resource.
21) Previleges and Grants
Previleges are the right to execute a particulare type of SQL statements.
e.g :: Right to Connect, Right to create, Right to resource
Grants are given to the objects so that the object might be accessed accordingly.The grant
has to be
given by the owner of the object.
22)Table Space,Data Files,Parameter File, Control Files
Table Space :: The table space is useful for storing the data in the database.When a
database is created two table spaces are created.
a) System Table space :: This data file stores all the tables related to the system and dba
tables
b) User Table space
:: This data file stores all the user related tables
We should have seperate table spaces for storing the tables and indexes so that the access
is fast.
Data Files :: Every Oracle Data Base has one or more physical data files.They store the data
for the database.Every datafile is associated with only one database.Once the Data file is
created the size cannot change.To increase the size of the database to store more data we
have to add data file.
Parameter Files :: Parameter file is needed to start an instance.A parameter file contains
the list of instance configuration parameters e.g.::
db_block_buffers = 500
db_name = ORA7
db_domain = u.s.acme lang
Control Files :: Control files record the physical structure of the data files and redo log
files

ORACLE Question Bank

Page 36 of 141

HCL Technologies Banking Center

Confidential

They contain the Db name, name and location of dbs, data files ,redo log files and time
stamp.
23) Describe the Physical Storage of the Data
The finest level of granularity of the data base are the data blocks.
Data Block :: One Data Block correspond to specific number of physical database space
Extent
:: Extent is the number of specific number of contigious data blocks.
Segments :: Set of Extents allocated for Extents. There are three types of Segments
a) Data Segment :: Non Clustered Table has data segment data of every table is stored in
cluster data segment
b) Index Segment :: Each Index has index segment that stores data
c) Roll Back Segment :: Temporarily store 'undo' information
24) What are the Pct Free and Pct Used
Pct Free is used to denote the percentage of the free space that is to be left when
creating a table. Similarly Pct Used is used to denote the percentage of the used space that
is to be used when creating a table
eg.:: Pctfree 20, Pctused 40
25) What is Row Chaining
The data of a row in a table may not be able to fit the same data block.Data for row is
stored in a chain of data blocks .
26) What is a 2 Phase Commit
Two Phase commit is used in distributed data base systems. This is useful to maintain the
integrity of the database so that all the users see the same values. It contains DML
statements or Remote Procedural calls that reference a remote object. There are basically
2 phases in a 2 phase commit.
a) Prepare Phase :: Global coordinator asks participants to prepare
b) Commit Phase :: Commit all participants to coordinator to Prepared, Read only or abort
Reply
27) What is the difference between deleting and truncating of tables
Deleting a table will not remove the rows from the table but entry is there in the
database dictionary and it can be retrieved But truncating a table deletes it completely and
it cannot be retrieved.
28) What are mutating tables
When a table is in state of transition it is said to be mutating. eg :: If a row has been
deleted then the table is said to be mutating and no operations can be done on the table
except select.
29) What are Codd Rules
Codd Rules describe the ideal nature of a RDBMS. No RDBMS satisfies all the 12 codd rules
and Oracle Satisfies 11 of the 12 rules and is the only Rdbms to satisfy the maximum
number of rules.

ORACLE Question Bank

Page 37 of 141

HCL Technologies Banking Center

Confidential

30) What is Normalisation


Normalisation is the process of organising the tables to remove the redundancy.There are
mainly 5 Normalisation rules.
a) 1 Normal Form :: A table is said to be in 1st Normal Form when the attributes are
atomic
b) 2 Normal Form :: A table is said to be in 2nd Normal Form when all the candidate keys
are dependant on the primary key
c) 3rd Normal Form :: A table is said to be third Normal form when it is not dependant
transitively
31) What is the Difference between a post query and a pre query
A post query will fire for every row that is fetched but the pre query will fire only once.
32) Deleting the Duplicate rows in the table
We can delete the duplicate rows in the table by using the Rowid
33) Can U disable database trigger? How?
Yes. With respect to table
ALTER TABLE TABLE
[ DISABLE all_trigger ]
34) What is pseudo columns ? Name them?
A pseudocolumn behaves like a table column, but is not actually stored in the table. You can select
from pseudocolumns, but you cannot insert, update, or delete their values. This section describes
these pseudocolumns:
* CURRVAL
* NEXTVAL
* LEVEL
* ROWID
* ROWNUM
35) How many columns can table have?
The number of columns in a table can range from 1 to 254.
36) Is space acquired in blocks or extents ?
In extents .
37) what is clustered index?
In an indexed cluster, rows are stored together based on their cluster key values .
Can not applied for HASH.
38) what are the datatypes supported By oracle (INTERNAL)?
Varchar2, Number,Char , MLSLABEL.

ORACLE Question Bank

Page 38 of 141

HCL Technologies Banking Center

Confidential

39 ) What are attributes of cursor?


%FOUND , %NOTFOUND , %ISOPEN,%ROWCOUNT
40) Can you use select in FROM clause of SQL select?
Yes.

ORACLE Question Bank

Page 39 of 141

HCL Technologies Banking Center

Confidential

Forms 4.5 Questions


1) Which trigger are created when master -detail relation?
Master delete property
* NON-ISOLATED (default)
a) on check delete master
b) on clear details
c) on populate details
* ISOLATED
a) on clear details
b) on populate details
* CASCADE
a) per-delete
b) on clear details
c) on populate details

2) which system variables can be set by users?


SYSTEM.MESSAGE_LEVEL
SYSTEM.DATE_THRESHOLD
SYSTEM.EFFECTIVE_DATE
SYSTEM.SUPPRESS_WORKING
3) What are object group?
An object group is a container for a group of objects. You define an object group when you want to
package related objects so you can copy or reference them in another module.
4) What are referenced objects?
Referencing allows you to create objects that inherit their functionality and appearance from other
objects. Referencing an object is similar to copying an object, except that the resulting reference
object maintains a link to its source object. A reference object automatically inherits any changes
that have been made to the source object when you open or regenerate the module that contains
the reference object.
5) Can you store objects in library?
Referencing allows you to create objects that inherit their functionality and appearance from other
objects. Referencing an object is similar to copying an object, except that the resulting reference
object maintains a link to its source object. A reference object automatically inherits any changes
that have been made to the source object when you open or regenerate the module that contains
the reference object.

ORACLE Question Bank

Page 40 of 141

HCL Technologies Banking Center

Confidential

6) Is forms 4.5 object oriented tool ? why?


yes , partially. 1) PROPERTY CLASS - inheritance property
2) OVERLOADING : procedures and functions.
7) Can you issue DDL in forms?
yes, but you have to use FORMS_DDL.
Referencing allows you to create objects that inherit their functionality and appearance from other
objects. Referencing an object is similar to copying an object, except that the resulting reference
object maintains a link to its source object. A reference object automatically inherits any changes
that have been made to the source object when you open or regenerate the module that contains
the reference object.
Any string expression up to 32K:
a literal

an expression or a variable representing the text of a block of dynamically created PL/SQL


code

a DML statement or

a DDL statement
Restrictions:
The statement you pass to FORMS_DDL may not contain bind variable references in the string, but
the values of bind variables can be concatenated into the string before passing the result to
FORMS_DDL.
8) What is SECURE property?
Hides characters that the operator types into the text item. This setting is typically used for
password protection.
9 ) What are the types of triggers and how the sequence of firing in text item
Triggers can be classified as Key Triggers, Mouse Triggers ,Navigational Triggers.
Key Triggers :: Key Triggers are fired as a result of Key action.e.g :: Key-next-field, Key-up,KeyDown
Mouse Triggers :: Mouse Triggers are fired as a result of the mouse navigation.e.g. When-mousebutton-presed,when-mouse-doubleclicked,etc
Navigational Triggers :: These Triggers are fired as a result of Navigation. E.g : Post-Textitem,Pre-text-item.
We also have event triggers like when new-form-instance and when-new-block-instance.
We cannot call restricted procedures like go_to(my_block.first_item) in the Navigational triggers
But can use them in the Key-next-item.
The Difference between Key-next and Post-Text is an very important question. The key-next is
fired as a result of the key action while the post text is fired as a result of the mouse movement.
Key next will not fire unless there is a key event.
The sequence of firing in a text item are as follows ::
a) pre - text
b) when new item

ORACLE Question Bank

Page 41 of 141

HCL Technologies Banking Center

Confidential

c) key-next
d) when validate
e) post text
10 ) Can you store pictures in database? How?
Yes , in long Raw datatype.
11) What are property classes ? Can property classes have trigger?
Property class inheritance is a powerful feature that allows you to quickly define objects that
conform to your own interface and functionality standards. Property classes also allow you to make
global changes to applications quickly. By simply changing the definition of a property class, you can
change the definition of all objects that inherit properties from that class.
Yes . All type of triggers .
* 12 a) If you have property class attached to an item and you have same trigger written for
the item .
Which will fire first?
Item level trigger fires , If item level trigger fires, property level trigger won't fire. Triggers at
the lowest level are always given the first preference. The item level trigger fires first and then
the block and then the Form level trigger.
13) What are record groups ? * Can record groups created at run-time?
A record group is an internal Oracle Forms data structure that has a column/row framework similar
to a database table. However, unlike database tables, record groups are separate objects that
belong to the form module in which they are defined. A record group can have an unlimited number
of columns of type CHAR, LONG, NUMBER, or DATE provided that the total number of columns
does not exceed 64K. Record group column names cannot exceed 30 characters.
Programmatically, record groups can be used whenever the functionality offered by a twodimensional array of multiple data types is desirable.
TYPES OF RECORD GROUP:
Query Record Group A query record group is a record group that has an associated SELECT
statement.
The columns in a query record group derive their default names, data types, and lengths from
the database columns referenced in the SELECT statement. The records in a query record group
are the rows retrieved by the query associated with that record group.
Non-query Record Group A non-query record group is a group that does not have an associated
query, but whose structure and values can be modified programmatically at runtime.
Static Record Group A static record group is not associated with a query; rather, you define its
structure and row values at design time, and they remain fixed at runtime.

14) What are ALERT?


An ALERT is a modal window that displays a message notifiying operator of some application
condition.

ORACLE Question Bank

Page 42 of 141

HCL Technologies Banking Center

Confidential

15) Can a button have icon and lable at the same time ?
-NO
16) What is mouse navigate property of button?
When Mouse Navigate is True (the default), Oracle Forms performs standard navigation to move
the focus to the item when the operator activates the item with the mouse.
When Mouse Navigate is set to False, Oracle Forms does not perform navigation (and the resulting
validation) to move to the item when an operator activates the item with the mouse.
17) What is FORMS_MDI_WINDOW?
Forms run inside the MDI application window. This property is useful for calling a form from
another one.
18) What are timers ? when when-timer-expired does not fire?
The When-Timer-Expired trigger can not fire during trigger, navigation, or transaction processing.
19 ) Can object group have a block?
Yes , object group can have block as well as program units.
20) How many types of canvases are there.
There are 2 types of canvases called as Content and Stack Canvas. Content canvas is the default
and the one that is used mostly for giving the base effect. Its like a plate on which we add items
and stacked canvas is used for giving 3 dimensional effect.
The following questions might not be asked in an Average Interview and could be asked
when the Interviewer wants to trouble u and go deeppppppppppppp
He cannot go further..
1) What are user-exits?
It invokes 3GL programs.
2) Can you pass values to-and-fro from foreign function ? how ?
Yes . You obtain a return value from a foreign function by assigning the return value to an Oracle
Forms variable or item. Make sure that the Oracle Forms variable or item is the same data type as
the return value from the foreign function.
After assigning an Oracle Forms variable or item value to a PL/SQL variable, pass the PL/SQL
variable as a parameter value in the PL/SQL interface of the foreign function. The PL/SQL
variable that is passed as a parameter must be a valid PL/SQL data type; it must also be the
appropriate parameter type as defined in the PL/SQL interface.
3) What is IAPXTB structure ?
The entries of Pro * C and user exits and the form which simulate the proc or user_exit are stored
in IAPXTB table in d/b.
4) Can you call WIN-SDK thruo' user exits?
YES.

ORACLE Question Bank

Page 43 of 141

HCL Technologies Banking Center

Confidential

5) Does user exits supports DLL on MSWINDOWS ?


YES .
6) What is path setting for DLL?
Make sure you include the name of the DLL in the FORMS45_USEREXIT variable of the
ORACLE.INI file, or rename the DLL to F45XTB.DLL. If you rename the DLL to F45XTB.DLL,
replace the existing F45XTB.DLL in the \ORAWIN\BIN directory with the new F45XTB.DLL.
7) How is mapping of name of DLL and function done?
The dll can be created using the Visual C++ / Visual Basic Tools and then the dll is put in the
path that is defined the registery.
8) what is precompiler?
It is similar to C precompiler directives.
9) Can you connect to non - oracle datasource ? How?
Yes .
10 ) what are key-mode and locking mode properties? level ?
Key Mode : Specifies how oracle forms uniquely identifies rows in the database. This is property
includes for application that will run against NON-ORACLE datasources .
Key setting
unique (default.)
dateable
n-updateable.
Locking mode :
Specifies when Oracle Forms should attempt to obtain database locks on rows that correspond to
queried records in the form.
a) immediate b) delayed
11) What are savepoint mode and cursor mode properties ? level?
Specifies whether Oracle Forms should issue savepoints during a session. This property is included
primarily for applications that will run against non-ORACLE data sources. For applications that will
run against ORACLE, use the default setting.
Cursor mode - define cursur state across transaction
Open/close.
12) Can you replace default form processing ? How ?
13) What is transactional trigger property?
Identifies a block as transactional control block. i.e. non - database block that oracle forms should
manage as transactional block.(NON-ORACLE datasource) default - FALSE.
14) What is OLE automation ?

ORACLE Question Bank

Page 44 of 141

HCL Technologies Banking Center

Confidential

OLE automation allows an OLE server application to expose a set of commands and functions that
can be invoked from an OLE container application. OLE automation provides a way for an OLE
container application to use the features of an OLE server application to manipulate an OLE object
from the OLE container environment. (FORMS_OLE)
15) What does invoke built-in do?
This procedure invokes a method.
Syntax:
PROCEDURE OLE2.INVOKE
(object obj_type,
method VARCHAR2,
list list_type := 0);
Parameters:
object Is an OLE2 Automation Object.
method Is a method (procedure) of the OLE2 object.
list
Is the name of an argument list assigned to the OLE2.CREATE_ARGLIST function.
16) What are OPEN_FORM,CALL_FORM,NEW_FORM? diff?
CALL_FORM : It calls the other form. but parent remains active, when called form completes the
operation , it releases lock and control goes back to the calling form.
When you call a form, Oracle Forms issues a savepoint for the called form. If the CLEAR_FORM
function causes a rollback when the called form is current, Oracle Forms rolls back uncommitted
changes to this savepoint.
OPEN_FORM : When you call a form, Oracle Forms issues a savepoint for the called form. If the
CLEAR_FORM function causes a rollback when the called form is current, Oracle Forms rolls back
uncommitted changes to this savepoint.
NEW_FORM : Exits the current form and enters the indicated form. The calling form is
terminated as the parent form. If the calling form had been called by a higher form, Oracle Forms
keeps the higher call active and treats it as a call to the new form. Oracle Forms releases memory
(such as database cursors) that the terminated form was using.
Oracle Forms runs the new form with the same Runform options as the parent form. If the parent
form was a called form, Oracle Forms runs the new form with the same options as the parent form.
17 ) What is call form stack?
When successive forms are loaded via the CALL_FORM procedure, the resulting module hierarchy
is known as the call form stack.
18) Can u port applictions across the platforms? how?
Yes we can port applications across platforms.Consider the form developed in a windows system.The
form would be generated in unix system by using f45gen my_form.fmb scott/tiger

ORACLE Question Bank

Page 45 of 141

HCL Technologies Banking Center

Confidential

GUI
1) What is a visual attribute?
Visual attributes are the font, color, and pattern properties that you set for form and menu
objects that appear in your application's interface.
2) Diff. between VAT and Property Class? imp
Named visual attributes define only font, color, and pattern attributes; property classes can
contain these and any other properties.
You can change the appearance of objects at runtime by changing the named visual attribute
programmatically; property class assignment cannot be changed programmatically.
When an object is inheriting from both a property class and a named visual attribute, the named
visual attribute settings take precedence, and any visual attribute properties in the class are
ignored.
3 ) Which trigger related to mouse?
When-Mouse-Click
When-Mouse-DoubleClick
When-Mouse-Down
When-Mouse-Enter
When-Mouse-Leave
When-Mouse-Move
When-Mouse-Up
4) What is Current record attribute property?
Specifies the named visual attribute used when an item is part of the current record.
Current Record Attribute is frequently used at the block level to display the current row in a multirecord
If you define an item-level Current Record Attribute, you can display a pre-determined item in a
special color when it is part of the current record, but you cannot dynamically highlight the current
item, as the input focus changes.
5) Can u change VAT at run time?
Yes. You can programmatically change an object's named visual attribute setting to change the font,
color, and pattern of the object at runtime.
6) Can u set default font in forms?
Yes. Change windows registry(regedit). Set form45_font to the desired font.
7) Can u have OLE objects in forms?
Yes.
8) Can u have VBX and OCX controls in forms ?
Yes.
9) What r the types of windows (Window style)?

ORACLE Question Bank

Page 46 of 141

HCL Technologies Banking Center

Confidential

Specifies whether the window is a Document window or a Dialog window.


10) What is OLE Activation style property?
Specifies the event that will activate the OLE containing item.
11) Can u change the mouse pointer ? How?
Yes. Specifies the mouse cursor style. Use this property to dynamically change the shape of the
cursor.

ORACLE Question Bank

Page 47 of 141

HCL Technologies Banking Center

Confidential

Reports 2.5
1) How many types of columns are there and what are they
Formula columns :: For doing mathematical calculations and returning one value
Summary Columns :: For doing summary calculations such as summations etc.
Place holder Columns :: These columns are useful for storing the value in a variable
2)

Can u have more than one layout in report


It is possible to have more than one layout in a report by using the additional layout
option in the layout editor.

3) Can u run the report with out a parameter form


Yes it is possible to run the report without parameter form by setting the PARAM value
to Null
4) What is the lock option in reports layout
By using the lock option we cannot move the fields in the layout editor outside the
frame. This is useful for maintaining the fields .
5) What is Flex
Flex is the property of moving the related fields together by setting the flex property on
6) What are the minimum number of groups required for a matrix report
The minimum of groups required for a matrix report are 4

ORACLE Question Bank

Page 48 of 141

HCL Technologies Banking Center

Confidential

PL/SQL
What is PL/SQL and what is it used for?
PL/SQL is Oracle's Procedural Language extension to SQL. PL/SQL's language syntax,
structure and data types are similar to that of ADA. The PL/SQL language includes object
oriented programming techniques such as encapsulation, function overloading, information
hiding (all but inheritance). PL/SQL is commonly used to write data-centric programs to
manipulate data in an Oracle database.
Should one use PL/SQL or Java to code procedures and triggers?
Internally the Oracle database supports two procedural languages, namely PL/SQL and
Java. This leads to questions like "Which of the two is the best?" and "Will Oracle ever
desupport PL/SQL in favour of Java?".
Many Oracle applications are based on PL/SQL and it would be difficult of Oracle to ever
desupport PL/SQL. In fact, all indications are that PL/SQL still has a bright future ahead
of it. Many enhancements are still being made to PL/SQL. For example, Oracle 9iDB
supports native compilation of Pl/SQL code to binaries.
PL/SQL and Java appeal to different people in different job roles. The following table
briefly describes the difference between these two language environments:
PL/SQL:

Data centric and tightly integrated into the database


Proprietary to Oracle and difficult to port to other database systems
Data manipulation is slightly faster in PL/SQL than in Java
Easier to use than Java (depending on your background)

Java:

Open standard, not proprietary to Oracle


Incurs some data conversion overhead between the Database and Java type systems
Java is more difficult to use (depending on your background)

How can one see if somebody modified any code?


Code for stored procedures, functions and packages is stored in the Oracle Data Dictionary.
One can detect code changes by looking at the LAST_DDL_TIME column in the
USER_OBJECTS dictionary view. Example:
SELECT OBJECT_NAME,
TO_CHAR(CREATED,
'DD-Mon-RR HH24:MI') CREATE_TIME,
TO_CHAR(LAST_DDL_TIME, 'DD-Mon-RR HH24:MI') MOD_TIME,

ORACLE Question Bank

Page 49 of 141

HCL Technologies Banking Center

Confidential

STATUS
FROM USER_OBJECTS
WHERE LAST_DDL_TIME > '&CHECK_FROM_DATE';
How can one search PL/SQL code for a string/ key value?
The following query is handy if you want to know where a certain table, field or expression
is referenced in your PL/SQL source code.
SELECT TYPE, NAME, LINE
FROM USER_SOURCE
WHERE UPPER(TEXT) LIKE '%&KEYWORD%';
How can one keep a history of PL/SQL code changes?
One can build a history of PL/SQL code changes by setting up an AFTER CREATE schema
(or database) level trigger (available from Oracle 8.1.7). This way one can easily revert to
previous code should someone make any catastrophic changes. Look at this example:
CREATE TABLE SOURCE_HIST
-- Create history table
AS SELECT SYSDATE CHANGE_DATE, USER_SOURCE.*
FROM USER_SOURCE WHERE 1=2;

name

CREATE OR REPLACE TRIGGER change_hist


AFTER CREATE ON SCOTT.SCHEMA

-- Store code in hist table


-- Change SCOTT to your schema

DECLARE
BEGIN
if DICTIONARY_OBJ_TYPE in ('PROCEDURE', 'FUNCTION',
'PACKAGE', 'PACKAGE BODY', 'TYPE') then
-- Store old code in SOURCE_HIST table
INSERT INTO SOURCE_HIST
SELECT sysdate, user_source.* FROM USER_SOURCE
WHERE TYPE = DICTIONARY_OBJ_TYPE
AND NAME = DICTIONARY_OBJ_NAME;
end if;
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20000, SQLERRM);
END;
/
show errors
How can I protect my PL/SQL source code?
PL/SQL V2.2, available with Oracle7.2, implements a binary wrapper for PL/SQL programs
to protect the source code.

ORACLE Question Bank

Page 50 of 141

HCL Technologies Banking Center

Confidential

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.plb
Can one print to the screen from PL/SQL?
One can use the DBMS_OUTPUT package to write information to an output buffer. This
buffer can be displayed on the screen from SQL*Plus if you issue the SET
SERVEROUTPUT ON; command. For example:
set serveroutput on
begin
dbms_output.put_line('Look Ma, I can print from PL/SQL!!!');
end;
/
DBMS_OUTPUT is useful for debugging PL/SQL programs. However, if you print too much,
the output buffer will overflow. In that case, set the buffer size to a larger value, eg.: set
serveroutput on size 200000
If you forget to set serveroutput on type SET SERVEROUTPUT ON once you remember,
and then EXEC NULL;. If you haven't cleared the DBMS_OUTPUT buffer with the disable
or enable procedure, SQL*Plus will display the entire contents of the buffer when it
executes this dummy PL/SQL block.
Can one read/write files from PL/SQL?
Included in Oracle 7.3 is an UTL_FILE package that can read and write operating system
files. The directory you intend writing to has to be in your INIT.ORA file (see
UTL_FILE_DIR=... parameter). Before Oracle 7.3 the only means of writing a file was to use
DBMS_OUTPUT with the SQL*Plus SPOOL command.
Copy this example to get started:
DECLARE
fileHandler UTL_FILE.FILE_TYPE;
BEGIN
fileHandler := UTL_FILE.FOPEN('/tmp', 'myfile', 'w');
UTL_FILE.PUTF(fileHandler, 'Look ma, I''m writing to a file!!!\n');
UTL_FILE.FCLOSE(fileHandler);
EXCEPTION

ORACLE Question Bank

Page 51 of 141

HCL Technologies Banking Center

Confidential

WHEN utl_file.invalid_path THEN


raise_application_error(-20000, 'ERROR: Invalid path for file or path not in
INIT.ORA.');
END;
/
Can one call DDL statements from PL/SQL?
One can call DDL statements like CREATE, DROP, TRUNCATE, etc. from PL/SQL by using
the "EXECUTE IMMEDATE" statement. Users running Oracle versions below 8i can look at
the DBMS_SQL package (see FAQ about Dynamic SQL).
begin
EXECUTE IMMEDIATE 'CREATE TABLE X(A DATE)';
end;
NOTE: The DDL statement in quotes should not be terminated with a semicolon.
Can one use dynamic SQL statements from PL/SQL?
Starting from Oracle8i one can use the "EXECUTE IMMEDIATE" statement to execute
dynamic SQL and PL/SQL statements (statements created at run-time). Look at these
examples. Note that statements are NOT terminated by semicolons:
EXECUTE IMMEDIATE 'CREATE TABLE x (a NUMBER)';
-- Using bind variables...
sql_stmt := 'INSERT INTO dept VALUES (:1, :2, :3)';
EXECUTE IMMEDIATE sql_stmt USING dept_id, dept_name, location;
-- Returning a cursor...
sql_stmt := 'SELECT * FROM emp WHERE empno = :id';
EXECUTE IMMEDIATE sql_stmt INTO emp_rec USING emp_id;
One can also use the older DBMS_SQL package (V2.1 and above) to execute dynamic
statements. Look at these examples:
CREATE OR REPLACE PROCEDURE DYNSQL AS
cur integer;
rc integer;
BEGIN
cur := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(cur, 'CREATE TABLE X (Y DATE)', DBMS_SQL.NATIVE);
rc := DBMS_SQL.EXECUTE(cur);
DBMS_SQL.CLOSE_CURSOR(cur);
END;
/
More complex DBMS_SQL example using bind variables:
CREATE OR REPLACE PROCEDURE DEPARTMENTS(NO IN DEPT.DEPTNO
%TYPE) AS
v_cursor integer;

ORACLE Question Bank

Page 52 of 141

HCL Technologies Banking Center

Confidential

v_dname char(20);
v_rows integer;
BEGIN
v_cursor := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(v_cursor, 'select dname from dept where deptno > :x',
DBMS_SQL.V7);
DBMS_SQL.BIND_VARIABLE(v_cursor, ':x', no);
DBMS_SQL.DEFINE_COLUMN_CHAR(v_cursor, 1, v_dname, 20);
v_rows := DBMS_SQL.EXECUTE(v_cursor);
loop
if DBMS_SQL.FETCH_ROWS(v_cursor) = 0 then
exit;
end if;
DBMS_SQL.COLUMN_VALUE_CHAR(v_cursor, 1, v_dname);
DBMS_OUTPUT.PUT_LINE('Deptartment name: '||v_dname);
end loop;
DBMS_SQL.CLOSE_CURSOR(v_cursor);
EXCEPTION
when others then
DBMS_SQL.CLOSE_CURSOR(v_cursor);
raise_application_error(-20000, 'Unknown Exception Raised: '||sqlcode||' '||
sqlerrm);
END;
/
What is the difference between %TYPE and %ROWTYPE?
The %TYPE and %ROWTYPE constructs provide data independence, reduces maintenance
costs, and allows programs to adapt as the database changes to meet new business needs.
%ROWTYPE is used to declare a record with the same types as found in the specified
database table, view or cursor. Example:
DECLARE
v_EmpRecord emp%ROWTYPE;
%TYPE is used to declare a field with the same type as that of a specified table's column.
Example:
DECLARE
v_EmpNo emp.empno%TYPE;
What is the result of comparing NULL with NULL?
NULL is neither equal to NULL, nor it is not equal to NULL. Any comparison to NULL is
evaluated to NULL. Look at this code example to convince yourself.

ORACLE Question Bank

Page 53 of 141

HCL Technologies Banking Center

Confidential

declare
a number := NULL;
b number := NULL;
begin
if a=b then
dbms_output.put_line('True, NULL = NULL');
elsif ab then
dbms_output.put_line('False, NULL NULL');
else
dbms_output.put_line('Undefined NULL is neither = nor to NULL');
end if;
end;
How does one get the value of a sequence into a PL/SQL variable?
As you might know, one cannot use sequences directly from PL/SQL. Oracle (for some silly
reason) prohibits this:
i := sq_sequence.NEXTVAL;
However, one can use embedded SQL statements to obtain sequence values:
select sq_sequence.NEXTVAL into :i from dual;
Can one execute an operating system command from PL/SQL?
There is no direct way to execute operating system commands from PL/SQL in Oracle7.
However, one can write an external program (using one of the precompiler languages, OCI or
Perl with Oracle access modules) to act as a listener on a database pipe (SYS.DBMS_PIPE).
Your PL/SQL program then put requests to run commands in the pipe, the listener picks it
up and run the requests. Results are passed back on a different database pipe. For an Pro*C
example, see chapter 8 of the Oracle Application Developers Guide.
In Oracle8 one can call external 3GL code in a dynamically linked library (DLL or shared
object). One just write a library in C/ C++ to do whatever is required. Defining this C/C++
function to PL/SQL makes it executable. Look at this External Procedure example.
How does one loop through tables in PL/SQL?
Look at the following nested loop code example.
DECLARE
CURSOR dept_cur IS
SELECT deptno
FROM dept
ORDER BY deptno;
-- Employee cursor all employees for a dept number
CURSOR emp_cur (v_dept_no DEPT.DEPTNO%TYPE) IS
SELECT ename
FROM emp

ORACLE Question Bank

Page 54 of 141

HCL Technologies Banking Center

Confidential

WHERE deptno = v_dept_no;


BEGIN
FOR dept_rec IN dept_cur LOOP
dbms_output.put_line('Employees in Department '||
TO_CHAR(dept_rec.deptno));
FOR emp_rec in emp_cur(dept_rec.deptno) LOOP
dbms_output.put_line('...Employee is '||emp_rec.ename);
END LOOP;
END LOOP;
END;
/
How often should one COMMIT in a PL/SQL loop? / What is the best commit
strategy?
Contrary to popular believe, one should COMMIT less frequently within a PL/SQL loop to
prevent ORA-1555 (Snapshot too old) errors. The higher the frequency of commit, the
sooner the extents in the rollback segments will be cleared for new transactions, causing
ORA-1555 errors.
To fix this problem one can easily rewrite code like this:
FOR records IN my_cursor LOOP
...do some stuff...
COMMIT;
END LOOP;
... to ...

FOR records IN my_cursor LOOP


...do some stuff...
i := i+1;
IF mod(i, 10000) THEN -- Commit every 10000 records
COMMIT;
END IF;
END LOOP;
If you still get ORA-1555 errors, contact your DBA to increase the rollback segments.
NOTE: Although fetching across COMMITs work with Oracle, is not supported by the
ANSI standard.
I can SELECT from SQL*Plus but not from PL/SQL. What is wrong?
PL/SQL respect object privileges given directly to the user, but does not observe privileges
given through roles. The consequence is that a SQL statement can work in SQL*Plus, but
will give an error in PL/SQL. Choose one of the following solutions:
Grant direct access on the tables to your user. Do not use roles!

GRANT select ON scott.emp TO my_user;

ORACLE Question Bank

Page 55 of 141

HCL Technologies Banking Center

Confidential

Define your procedures with invoker rights (Oracle 8i and higher);


Move all the tables to one user/schema.

What is a mutating and constraining table?


"Mutating" means "changing". A mutating table is a table that is currently being modified by
an update, delete, or insert statement. When a trigger tries to reference a table that is in
state of flux (being changed), it is considered "mutating" and raises an error since Oracle
should not return data that has not yet reached its final state.
Another way this error can occur is if the trigger has statements to change the primary,
foreign or unique key columns of the table off which it fires. If you must have triggers on
tables that have referential constraints, the workaround is to enforce the referential
integrity through triggers as well.
There are several restrictions in Oracle regarding triggers:

A row-level trigger cannot query or modify a mutating table. (Of course, NEW and
OLD still can be accessed by the trigger) .
A statement-level trigger cannot query or modify a mutating table if the trigger is
fired as the result of a CASCADE delete.
Etc.

Can one pass an object/table as an argument to a remote procedure?


The only way the same object type can be referenced between two databases is via a
database link. Note that it is not enough to just use the same type definitions. Look at this
example:
-- Database A: receives a PL/SQL table from database B
CREATE OR REPLACE PROCEDURE pcalled(TabX DBMS_SQL.VARCHAR2S) IS
BEGIN
-- do something with TabX from database B
null;
END;
/
-- Database B: sends a PL/SQL table to database A
CREATE OR REPLACE PROCEDURE pcalling IS
TabX DBMS_SQL.VARCHAR2S@DBLINK2;
BEGIN
pcalled@DBLINK2(TabX);
END;
/
Is it better to put code in triggers or procedures? What is the difference?

ORACLE Question Bank

Page 56 of 141

HCL Technologies Banking Center

Confidential

In earlier releases of Oracle it was better to put as much code as possible in procedures
rather than triggers. At that stage procedures executed faster than triggers as triggers
had to be re-compiled every time before executed (unless cached). In more recent releases
both triggers and procedures are compiled when created (stored p-code) and one can add as
much code as one likes in either procedures or triggers.
Is there a PL/SQL Engine in SQL*Plus?
No. Unlike Oracle Forms, SQL*Plus does not have an embedded PL/SQL engine. Thus, all
your PL/SQL code is sent directly to the database engine for execution. This makes it much
more efficient as SQL statements are not stripped off and sent to the database
individually.
Is there a limit on the size of a PL/SQL block?
Yes, the max size is not an explicit byte limit, but related to the parse tree that is created
when you compile the code. 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';

ORACLE Question Bank

Page 57 of 141

HCL Technologies Banking Center

Confidential

PL/SQL QUESTIONS
1. Describe the difference between a procedure, function and anonymous pl/sql block.
Level: Low
Expected answer: Candidate should mention use of DECLARE statement, a function must
return a value while a procedure doesnt have to.
2. What is a mutating table error and how can you get around it?
Level: Intermediate
Expected answer: This happens with triggers. It occurs because the trigger is trying to
update a row it is currently using. The usual fix involves either use of views or temporary
tables so the database is selecting from one while updating the other.
3. Describe the use of %ROWTYPE and %TYPE in PL/SQL
Level: Low
Expected answer: %ROWTYPE allows you to associate a variable with an entire table row.
The %TYPE associates a variable with a single column type.
4. What packages (if any) has Oracle provided for use by developers?
Level: Intermediate to high
Expected answer: Oracle provides the DBMS_ series of packages. There are many which
developers should be aware of such as DBMS_SQL, DBMS_PIPE, DBMS_TRANSACTION,
DBMS_LOCK, DBMS_ALERT, DBMS_OUTPUT, DBMS_JOB, DBMS_UTILITY, DBMS_DDL,
UTL_FILE. If they can mention a few of these and describe how they used them, even
better. If they include the SQL routines provided by Oracle, great, but not really what was
asked.
5. Describe the use of PL/SQL tables
Level: Intermediate
Expected answer: PL/SQL tables are scalar arrays that can be referenced by a binary
integer. They can be used to hold values for use in later queries or calculations. In Oracle 8
they will be able to be of the %ROWTYPE designation, or RECORD.
6. When is a declare statement needed ?
Level: Low
The DECLARE statement is used in PL/SQL anonymous blocks such as with stand alone, nonstored PL/SQL procedures. It must come first in a PL/SQL stand alone file if it is used.
7. In what order should a open/fetch/loop set of commands in a PL/SQL block be
implemented if you use the %NOTFOUND cursor variable in the exit when statement?
Why?
Level: Intermediate

ORACLE Question Bank

Page 58 of 141

HCL Technologies Banking Center

Confidential

Expected answer: OPEN then FETCH then LOOP followed by the exit when. If not specified
in this order will result in the final return being done twice because of the way the
%NOTFOUND is handled by PL/SQL.
8. What are SQLCODE and SQLERRM and why are they important for PL/SQL
developers?
Level: Intermediate
Expected answer: SQLCODE returns the value of the error number for the last error
encountered. The SQLERRM returns the actual error message for the last error
encountered. They can be used in exception handling to report, or, store in an error log
table, the error that occurred in the code. These are especially useful for the WHEN
OTHERS exception.
9. How can you find within a PL/SQL block, if a cursor is open?
Level: Low
Expected answer: Use the %ISOPEN cursor status variable.
10. How can you generate debugging output from PL/SQL?
Level: Intermediate to high
Expected answer: Use the DBMS_OUTPUT package. Another possible method is to just use
the SHOW ERROR command, but this only shows errors. The DBMS_OUTPUT package can
be used to show intermediate results from loops and the status of variables as the
procedure is executed. The new package UTL_FILE can also be used.
11. What are the types of triggers?
Level: Intermediate to high
Expected Answer: There are 12 types of triggers in PL/SQL that consist of combinations of
the BEFORE, AFTER, ROW, TABLE, INSERT, UPDATE, DELETE and ALL key words:
BEFORE ALL ROW INSERT
AFTER ALL ROW INSERT
BEFORE INSERT
AFTER INSERT
etc.

ORACLE Question Bank

Page 59 of 141

HCL Technologies Banking Center

Confidential

DBA
1. Give one method for transferring a table from one schema to another:
Level: Intermediate
Expected Answer: There are several possible methods, export-import, CREATE TABLE... AS
SELECT, or COPY.
2. What is the purpose of the IMPORT option IGNORE? What is its default setting?
Level: Low
Expected Answer: The IMPORT IGNORE option tells import to ignore already exists
errors. If it is not specified the tables that already exist will be skipped. If it is specified,
the error is ignored and the tables data will be inserted. The default value is N.
3. You have a rollback segment in a version 7.2 database that has expanded beyond
optimal, how can it be restored to optimal?
Level: Low
Expected answer: Use the ALTER TABLESPACE ..... SHRINK command.
4. If the DEFAULT and TEMPORARY tablespace clauses are left out of a CREATE
USER command what happens? Is this bad or good? Why?
Level: Low
Expected answer: The user is assigned the SYSTEM tablespace as a default and temporary
tablespace. This is bad because it causes user objects and temporary segments to be placed
into the SYSTEM tablespace resulting in fragmentation and improper table placement (only
data dictionary objects and the system rollback segment should be in SYSTEM).
5. What are some of the Oracle provided packages that DBAs should be aware of?
Level: Intermediate to High
Expected answer: Oracle provides a number of packages in the form of the DBMS_
packages owned by the SYS user. The packages used by DBAs may include:
DBMS_SHARED_POOL, DBMS_UTILITY, DBMS_SQL, DBMS_DDL, DBMS_SESSION,
DBMS_OUTPUT and DBMS_SNAPSHOT. They may also try to answer with the UTL*.SQL
or CAT*.SQL series of SQL procedures. These can be viewed as extra credit but arent
part of the answer.
6. What happens if the constraint name is left out of a constraint clause?
Level: Low
Expected answer: The Oracle system will use the default name of SYS_Cxxxx where xxxx
is a system generated number. This is bad since it makes tracking which table the
constraint belongs to or what the constraint does harder.

ORACLE Question Bank

Page 60 of 141

HCL Technologies Banking Center

Confidential

7. What happens if a tablespace clause is left off of a primary key constraint clause?
Level: Low
Expected answer: This results in the index that is automatically generated being placed in
then users default tablespace. Since this will usually be the same tablespace as the table is
being created in, this can cause serious performance problems.
8. What is the proper method for disabling and re-enabling a primary key constraint?
Level: Intermediate
Expected answer: You use the ALTER TABLE command for both. However, for the enable
clause you must specify the USING INDEX and TABLESPACE clause for primary keys.
9. What happens if a primary key constraint is disabled and then enabled without fully
specifying the index clause?
Level: Intermediate
Expected answer: The index is created in the users default tablespace and all sizing
information is lost. Oracle doesnt store this information as a part of the constraint
definition, but only as part of the index definition, when the constraint was disabled the
index was dropped and the information is gone.
10. (On UNIX) When should more than one DB writer process be used? How many
should be used?
Level: High
Expected answer: If the UNIX system being used is capable of asynchronous IO then only
one is required, if the system is not capable of asynchronous IO then up to twice the
number of disks used by Oracle number of DB writers should be specified by use of the
db_writers initialization parameter.
11. You are using hot backup without being in archivelog mode, can you recover in the
event of a failure? Why or why not?
Level: High
Expected answer: You cant use hot backup without being in archivelog mode. So no, you
couldnt recover.
12. What causes the snapshot too old error? How can this be prevented or
mitigated?
Level: Intermediate
Expected answer: This is caused by large or long running transactions that have either
wrapped onto their own rollback space or have had another transaction write on part of
their rollback space. This can be prevented or mitigated by breaking the transaction into a
set of smaller transactions or increasing the size of the rollback segments and their
extents.

ORACLE Question Bank

Page 61 of 141

HCL Technologies Banking Center

Confidential

13. How can you tell if a database object is invalid?


Level: Low
Expected answer: By checking the status column of the DBA_, ALL_ or USER_OBJECTS
views, depending upon whether you own or only have permission on the view or are using a
DBA account.
14. A user is getting an ORA-00942 error yet you know you have granted them
permission on the table, what else should you check?
Level: Low
Expected answer: You need to check that the user has specified the full name of the object
(select empid from scott.emp; instead of select empid from emp;) or has a synonym that
points to the object (create synonym emp for scott.emp;)
15. A developer is trying to create a view and the database wont let him. He has the
DEVELOPER role which has the CREATE VIEW system privilege and SELECT grants
on the tables he is using, what is the problem?
Level: Intermediate
Expected answer: You need to verify the developer has direct grants on all tables used in
the view. You cant create a stored object with grants given through views.
16. If you have an example table, what is the best way to get sizing data for the
production table implementation?
Level: Intermediate
Expected answer: The best way is to analyze the table and then use the data provided in
the DBA_TABLES view to get the average row length and other pertinent data for the
calculation. The quick and dirty way is to look at the number of blocks the table is actually
using and ratio the number of rows in the table to its number of blocks against the number
of expected rows.
17. How can you find out how many users are currently logged into the database? How
can you find their operating system id?
Level: high
Expected answer: There are several ways. One is to look at the v$session or v$process
views. Another way is to check the current_logins parameter in the v$sysstat view. Another
if you are on UNIX is to do a ps -ef|grep oracle|wc -l command, but this only works against
a single instance installation.
18. A user selects from a sequence and gets back two values, his select is:
SELECT pk_seq.nextval FROM dual;
What is the problem?
Level: Intermediate
Expected answer: Somehow two values have been inserted into the dual table. This table is a
single row, single column table that should only have one value in it.
ORACLE Question Bank

Page 62 of 141

HCL Technologies Banking Center

Confidential

19. How can you determine if an index needs to be dropped and rebuilt?
Level: Intermediate
Expected answer: Run the ANALYZE INDEX command on the index to validate its structure
and then calculate the ratio of LF_BLK_LEN/LF_BLK_LEN+BR_BLK_LEN and if it isnt near
1.0 (i.e. greater than 0.7 or so) then the index should be rebuilt. Or if the ratio
BR_BLK_LEN/ LF_BLK_LEN+BR_BLK_LEN is nearing 0.3.

ORACLE Question Bank

Page 63 of 141

HCL Technologies Banking Center

Confidential

SQL/ SQLPLUS
1. How can variables be passed to a SQL routine?
Level: Low
Expected answer: By use of the & symbol. For passing in variables the numbers 1-8 can be
used (&1, &2,...,&8) to pass the values after the command into the SQLPLUS session. To be
prompted for a specific variable, place the ampersanded variable in the code itself:
select * from dba_tables where owner=&owner_name; . Use of double ampersands tells
SQLPLUS to resubstitute the value for each subsequent use of the variable, a single
ampersand will cause a reprompt for the value unless an ACCEPT statement is used to get
the value from the user.
2. You want to include a carriage return/linefeed in your output from a SQL script,
how can you do this?
Level: Intermediate to high
Expected answer: The best method is to use the CHR() function (CHR(10) is a
return/linefeed) and the concatenation function ||. Another method, although it is hard to
document and isnt always portable is to use the return/linefeed as a part of a quoted
string.
3. How can you call a PL/SQL procedure from SQL?
Level: Intermediate
Expected answer: By use of the EXECUTE (short form EXEC) command.
4. How do you execute a host operating system command from within SQL?
Level: Low
Expected answer: By use of the exclamation point ! (in UNIX and some other OS) or the
HOST (HO) command.
5. You want to use SQL to build SQL, what is this called and give an example
Level: Intermediate to high
Expected answer: This is called dynamic SQL. An example would be:
set lines 90 pages 0 termout off feedback off verify off
spool drop_all.sql
select drop user ||username|| cascade; from dba_users
where username not in (SYS,SYSTEM);
spool off
Essentially you are looking to see that they know to include a command (in this case DROP
USER...CASCADE;) and that you need to concatenate using the || the values selected from
the database.

ORACLE Question Bank

Page 64 of 141

HCL Technologies Banking Center

Confidential

6. What SQLPlus command is used to format output from a select?


Level: low
Expected answer: This is best done with the COLUMN command.
7. You want to group the following set of select returns, what can you group on?
Max(sum_of_cost), min(sum_of_cost), count(item_no), item_no
Level: Intermediate
Expected answer: The only column that can be grouped on is the item_no column, the rest
have aggregate functions associated with them.
8. What special Oracle feature allows you to specify how the cost based system treats
a SQL statement?
Level: Intermediate to high
Expected answer: The COST based system allows the use of HINTs to control the
optimizer path selection. If they can give some example hints such as FIRST ROWS, ALL
ROWS, USING INDEX, STAR, even better.
9. You want to determine the location of identical rows in a table before attempting to
place a unique index on the table, how can this be done?
Level: High
Expected answer: Oracle tables always have one guaranteed unique column, the rowid
column. If you use a min/max function against your rowid and then select against the
proposed primary key you can squeeze out the rowids of the duplicate rows pretty quick. For
example:
select rowid from emp e
where e.rowid > (select min(x.rowid)
from emp x
where x.emp_no = e.emp_no);
In the situation where multiple columns make up the proposed key, they must all be used in
the where clause.
10. What is a Cartesian product?
Level: Low
Expected answer: A Cartesian product is the result of an unrestricted join of two or more
tables. The result set of a three table Cartesian product will have x * y * z number of rows
where x, y, z correspond to the number of rows in each table involved in the join.

ORACLE Question Bank

Page 65 of 141

HCL Technologies Banking Center

Confidential

11. You are joining a local and a remote table, the network manager complains about
the traffic involved, how can you reduce the network traffic?
Level: High
Expected answer: Push the processing of the remote data to the remote instance by using a
view to pre-select the information for the join. This will result in only the data required for
the join being sent across.
12. What is the default ordering of an ORDER BY clause in a SELECT statement?
Level: Low
Expected answer: Ascending
13. What is tkprof and how is it used?
Level: Intermediate to high
Expected answer: The tkprof tool is a tuning tool used to determine cpu and execution times
for SQL statements. You use it by first setting timed_statistics to true in the initialization
file and then turning on tracing for either the entire database via the sql_trace parameter
or for the session using the ALTER SESSION command. Once the trace file is generated
you run the tkprof tool against the trace file and then look at the output from the tkprof
tool. This can also be used to generate explain plan output.
14. What is explain plan and how is it used?
Level: Intermediate to high
Expected answer: The EXPLAIN PLAN command is a tool to tune SQL statements. To use it
you must have an explain_table generated in the user you are running the explain plan for.
This is created using the utlxplan.sql script. Once the explain plan table exists you run the
explain plan command giving as its argument the SQL statement to be explained. The
explain_plan table is then queried to see the execution plan of the statement. Explain plans
can also be run using tkprof.
15. How do you set the number of lines on a page of output? The width?
Level: Low
Expected answer: The SET command in SQLPLUS is used to control the number of lines
generated per page and the width of those lines, for example SET PAGESIZE 60 LINESIZE
80 will generate reports that are 60 lines long with a line width of 80 characters. The
PAGESIZE and LINESIZE options can be shortened to PAGES and LINES.
16. How do you prevent output from coming to the screen?
Level: Low
Expected answer: The SET option TERMOUT controls output to the screen. Setting
TERMOUT OFF turns off screen output. This option can be shortened to TERM.

ORACLE Question Bank

Page 66 of 141

HCL Technologies Banking Center

Confidential

17. How do you prevent Oracle from giving you informational messages during and after
a SQL statement execution?
Level: Low
Expected answer: The SET options FEEDBACK and VERIFY can be set to OFF.
18. How do you generate file output from SQL?
Level: Low
Expected answer: By use of the SPOOL command

ORACLE Question Bank

Page 67 of 141

HCL Technologies Banking Center

Confidential

TUNING QUESTIONS
1. A tablespace has a table with 30 extents in it. Is this bad? Why or why not.
Level: Intermediate
Expected answer: Multiple extents in and of themselves arent bad. However if you also have
chained rows this can hurt performance.
2. How do you set up tablespaces during an Oracle installation?
Level: Low
Expected answer: You should always attempt to use the Oracle Flexible Architecture
standard or another partitioning scheme to ensure proper separation of SYSTEM,
ROLLBACK, REDO LOG, DATA, TEMPORARY and INDEX segments.
3. You see multiple fragments in the SYSTEM tablespace, what should you check first?
Level: Low
Expected answer: Ensure that users dont have the SYSTEM tablespace as their
TEMPORARY or DEFAULT tablespace assignment by checking the DBA_USERS view.
4. What are some indications that you need to increase the SHARED_POOL_SIZE
parameter?
Level: Intermediate
Expected answer: Poor data dictionary or library cache hit ratios, getting error ORA-04031.
Another indication is steadily decreasing performance with all other tuning parameters the
same.
5. What is the general guideline for sizing db_block_size and db_multi_block_read for
an application that does many full table scans?
Level: High
Expected answer: Oracle almost always reads in 64k chunks. The two should have a product
equal to 64 or a multiple of 64.
6. What is the fastest query method for a table?
Level: Intermediate
Expected answer: Fetch by rowid
7. Explain the use of TKPROF? What initialization parameter should be turned on to
get full TKPROF output?
Level: High
Expected answer: The tkprof tool is a tuning tool used to determine cpu and execution times
for SQL statements. You use it by first setting timed_statistics to true in the initialization
file and then turning on tracing for either the entire database via the sql_trace parameter

ORACLE Question Bank

Page 68 of 141

HCL Technologies Banking Center

Confidential

or for the session using the ALTER SESSION command. Once the trace file is generated
you run the tkprof tool against the trace file and then look at the output from the tkprof
tool. This can also be used to generate explain plan output.
8. When looking at v$sysstat you see that sorts (disk) is high. Is this bad or good? If
bad -How do you correct it?
Level: Intermediate
Expected answer: If you get excessive disk sorts this is bad. This indicates you need to
tune the sort area parameters in the initialization files. The major sort are parameter is
the SORT_AREA_SIZe parameter.
9. When should you increase copy latches? What parameters control copy latches?
Level: high
Expected answer: When you get excessive contention for the copy latches as shown by the
redo copy latch hit ratio. You can increase copy latches via the initialization parameter
LOG_SIMULTANEOUS_COPIES to twice the number of CPUs on your system.
10. Where can you get a list of all initialization parameters for your instance? How
about an indication if they are default settings or have been changed?
Level: Low
Expected answer: You can look in the init<sid>.ora file for an indication of manually set
parameters. For all parameters, their value and whether or not the current value is the
default value, look in the v$parameter view.
11. Describe hit ratio as it pertains to the database buffers. What is the difference
between instantaneous and cumulative hit ratio and which should be used for tuning?
Level: Intermediate
Expected answer: The hit ratio is a measure of how many times the database was able to
read a value from the buffers verses how many times it had to re-read a data value from
the disks. A value greater than 80-90% is good, less could indicate problems. If you simply
take the ratio of existing parameters this will be a cumulative value since the database
started. If you do a comparison between pairs of readings based on some arbitrary time
span, this is the instantaneous ratio for that time span. Generally speaking an instantaneous
reading gives more valuable data since it will tell you what your instance is doing for the
time it was generated over.
12. Discuss row chaining, how does it happen? How can you reduce it? How do you
correct it?
Level: high
Expected answer: Row chaining occurs when a VARCHAR2 value is updated and the length of
the new value is longer than the old value and wont fit in the remaining block space. This
results in the row chaining to another block. It can be reduced by setting the storage

ORACLE Question Bank

Page 69 of 141

HCL Technologies Banking Center

Confidential

parameters on the table to appropriate values. It can be corrected by export and import of
the effected table.
13. When looking at the estat events report you see that you are getting busy buffer
waits. Is this bad? How can you find what is causing it?
Level: high
Expected answer: Buffer busy waits could indicate contention in redo, rollback or data
blocks. You need to check the v$waitstat view to see what areas are causing the problem.
The value of the count column tells where the problem is, the class column tells you with
what. UNDO is rollback segments, DATA is data base buffers.
14. If you see contention for library caches how can you fix it?
Level: Intermediate
Expected answer: Increase the size of the shared pool.
15. If you see statistics that deal with undo what are they really talking about?
Level: Intermediate
Expected answer: Rollback segments and associated structures.
16. If a tablespace has a default pctincrease of zero what will this cause (in
relationship to the smon process)?
Level: High
Expected answer: The SMON process wont automatically coalesce its free space
fragments.
17. If a tablespace shows excessive fragmentation what are some methods to
defragment the tablespace? (7.1,7.2 and 7.3 only)
Level: High
Expected answer: In Oracle 7.0 to 7.2 The use of the 'alter session set events 'immediate
trace name coalesce level ts#'; command is the easiest way to defragment contiguous free
space fragmentation. The ts# parameter corresponds to the ts# value found in the ts$
SYS table. In version 7.3 the alter tablespace <name> coalesce; is best. If the free space
isnt contiguous then export, drop and import of the tablespace contents may be the only
way to reclaim non-contiguous free space.
18. How can you tell if a tablespace has excessive fragmentation?
Level: Intermediate
If a select against the dba_free_space table shows that the count of a tablespaces extents
is greater than the count of its data files, then it is fragmented.

ORACLE Question Bank

Page 70 of 141

HCL Technologies Banking Center

Confidential

19. You see the following on a status report:

redo log space requests


redo log space wait time

23
0

Is this something to worry about? What if redo log space wait time is high? How can
you fix this?
Level: Intermediate
Expected answer: Since the wait time is zero, no. If the wait time was high it might indicate
a need for more or larger redo logs.
20. What can cause a high value for recursive calls? How can this be fixed?
Level: High
Expected answer: A high value for recursive calls is cause by improper cursor usage,
excessive dynamic space management actions, and or excessive statement re-parses. You
need to determine the cause and correct it By either relinking applications to hold cursors,
use proper space management techniques (proper storage and sizing) or ensure repeat
queries are placed in packages for proper reuse.
21. If you see a pin hit ratio of less than 0.8 in the estat library cache report is this
a problem? If so, how do you fix it?
Level: Intermediate
Expected answer: This indicate that the shared pool may be too small. Increase the shared
pool size.
22. If you see the value for reloads is high in the estat library cache report is this a
matter for concern?
Level: Intermediate
Expected answer: Yes, you should strive for zero reloads if possible. If you see excessive
reloads then increase the size of the shared pool.
23. You look at the dba_rollback_segs view and see that there is a large number of
shrinks and they are of relatively small size, is this a problem? How can it be fixed if
it is a problem?
Level: High
Expected answer: A large number of small shrinks indicates a need to increase the size of
the rollback segment extents. Ideally you should have no shrinks or a small number of large
shrinks. To fix this just increase the size of the extents and adjust optimal accordingly.

ORACLE Question Bank

Page 71 of 141

HCL Technologies Banking Center

Confidential

24. You look at the dba_rollback_segs view and see that you have a large number of
wraps is this a problem?
Level: High
Expected answer: A large number of wraps indicates that your extent size for your rollback
segments are probably too small. Increase the size of your extents to reduce the number of
wraps. You can look at the average transaction size in the same view to get the information
on transaction size.
25. In a system with an average of 40 concurrent users you get the following from a
query on rollback extents:

ROLLBACK
---------------------

CUR EXTENTS
--------------------------

R01

11

R02

R03

12

R04

SYSTEM

You have room for each to grow by 20 more extents each. Is there a problem? Should
you take any action?
Level: Intermediate
Expected answer: No there is not a problem. You have 40 extents showing and an average of
40 concurrent users. Since there is plenty of room to grow no action is needed.
26. You see multiple extents in the temporary tablespace. Is this a problem?
Level: Intermediate
Expected answer: As long as they are all the same size this isnt a problem. In fact, it can
even improve performance since Oracle wont have to create a new extent when a user
needs one.

ORACLE Question Bank

Page 72 of 141

HCL Technologies Banking Center

Confidential

INSTALLATION/CONFIGURATION
1. Define OFA.
Level: Low
Expected answer: OFA stands for Optimal Flexible Architecture. It is a method of placing
directories and files in an Oracle system so that you get the maximum flexibility for future
tuning and file placement.
2. How do you set up your tablespace on installation?
Level: Low
Expected answer: The answer here should show an understanding of separation of redo and
rollback, data and indexes and isolation os SYSTEM tables from other tables. An example
would be to specify that at least 7 disks should be used for an Oracle installation so that
you can place SYSTEM tablespace on one, redo logs on two (mirrored redo logs) the
TEMPORARY tablespace on another, ROLLBACK tablespace on another and still have two for
DATA and INDEXES. They should indicate how they will handle archive logs and exports as
well. As long as they have a logical plan for combining or further separation more or less
disks can be specified.
3. What should be done prior to installing Oracle (for the OS and the disks)?
Level: Low
Expected Answer: adjust kernel parameters or OS tuning parameters in accordance with
installation guide. Be sure enough contiguous disk space is available.
4. You have installed Oracle and you are now setting up the actual instance. You have
been waiting an hour for the initialization script to finish, what should you check first
to determine if there is a problem?
Level: Intermediate to high
Expected Answer: Check to make sure that the archiver isnt stuck. If archive logging is
turned on during install a large number of logs will be created. This can fill up your archive
log destination causing Oracle to stop to wait for more space.
5. When configuring SQLNET on the server what files must be set up?
Level: Intermediate
Expected answer: INITIALIZATION file, TNSNAMES.ORA file, SQLNET.ORA file
6. When configuring SQLNET on the client what files need to be set up?
Level: Intermediate
Expected answer: SQLNET.ORA, TNSNAMES.ORA

ORACLE Question Bank

Page 73 of 141

HCL Technologies Banking Center

Confidential

7. What must be installed with ODBC on the client in order for it to work with
Oracle?
Level: Intermediate
Expected answer: SQLNET and PROTOCOL (for example: TCPIP adapter) layers of the
transport programs.
8. You have just started a new instance with a large SGA on a busy existing server.
Performance is terrible, what should you check for?
Level: Intermediate
Expected answer: The first thing to check with a large SGA is that it isnt being swapped
out.
9. What OS user should be used for the first part of an Oracle installation (on
UNIX)?
Level: low
Expected answer: You must use root first.
10. When should the default values for Oracle initialization parameters be used as is?
Level: Low
Expected answer: Never
11. How many control files should you have? Where should they be located?
Level: Low
Expected answer: At least 2 on separate disk spindles. Be sure they say on separate disks,
not just file systems.
12. How many redo logs should you have and how should they be configured for
maximum recoverability?
Level: Intermediate
Expected answer: You should have at least three groups of two redo logs with the two logs
each on a separate disk spindle (mirrored by Oracle). The redo logs should not be on raw
devices on UNIX if it can be avoided.
13. You have a simple application with no hot tables (i.e. uniform IO and access
requirements). How many disks should you have assuming standard layout for SYSTEM,
USER, TEMP and ROLLBACK tablespaces?
Expected answer: At least 7, see disk configuration answer above.

ORACLE Question Bank

Page 74 of 141

HCL Technologies Banking Center

Confidential

DATA MODELER
1. Describe third normal form?
Level: Low
Expected answer: Something like: In third normal form all attributes in an entity are
related to the primary key and only to the primary key
2. Is the following statement true or false:
All relational databases must be in third normal form
Why or why not?
Level: Intermediate
Expected answer: False. While 3NF is good for logical design most databases, if they have
more than just a few tables, will not perform well using full 3NF. Usually some entities will
be denormalized in the logical to physical transfer process.
3. What is an ERD?
Level: Low
Expected answer: An ERD is an Entity-Relationship-Diagram. It is used to show the entities
and relationships for a database logical model.
4. Why are recursive relationships bad? How do you resolve them?
Level: Intermediate
A recursive relationship (one where a table relates to itself) is bad when it is a hard
relationship (i.e. neither side is a may both are must) as this can result in it not being
possible to put in a top or perhaps a bottom of the table (for example in the EMPLOYEE
table you couldnt put in the PRESIDENT of the company because he has no boss, or the
junior janitor because he has no subordinates). These type of relationships are usually
resolved by adding a small intersection entity.
5. What does a hard one-to-one relationship mean (one where the relationship on both
ends is must)?
Level: Low to intermediate
Expected answer: This means the two entities should probably be made into one entity.
6. How should a many-to-many relationship be handled?
Level: Intermediate
Expected answer: By adding an intersection entity table
7. What is an artificial (derived) primary key? When should an artificial (or derived)
primary key be used?
Level: Intermediate

ORACLE Question Bank

Page 75 of 141

HCL Technologies Banking Center

Confidential

Expected answer: A derived key comes from a sequence. Usually it is used when a
concatenated key becomes too cumbersome to use as a foreign key.
8. When should you consider denormalization?
Level: Intermediate
Expected answer: Whenever performance analysis indicates it would be beneficial to do so
without compromising data integrity.

ORACLE Question Bank

Page 76 of 141

HCL Technologies Banking Center

Confidential

UNIX
1. How can you determine the space left in a file system?
Level: Low
Expected answer: There are several commands to do this: du, df, or bdf
2. How can you determine the number of SQLNET users logged in to the UNIX
system?
Level: Intermediate
Expected answer: SQLNET users will show up with a process unique name that begins with
oracle<SID>, if you do a ps -ef|grep oracle<SID>|wc -l you can get a count of the number of
users.
3. What command is used to type files to the screen?
Level: Low
Expected answer: cat, more, pg
4. What command is used to remove a file?
Level: Low
Expected answer: rm
5. Can you remove an open file under UNIX?
Level: Low
Expected answer: yes
6. How do you create a decision tree in a shell script?
Level: intermediate
Expected answer: depending on shell, usually a case-esac or an if-endif or fi structure
7. What is the purpose of the grep command?
Level: Low
Expected answer: grep is a string search command that parses the specified string from
the specified file or files
8. The system has a program that always includes the word nocomp in its name, how
can you determine the number of processes that are using this program?
Level: intermediate
Expected answer: ps -ef|grep *nocomp*|wc -l

ORACLE Question Bank

Page 77 of 141

HCL Technologies Banking Center

Confidential

9. What is an inode?
Level: Intermediate
Expected answer: an inode is a file status indicator. It is stored in both disk and memory
and tracts file status. There is one inode for each file on the system.
10. The system administrator tells you that the system hasnt been rebooted in 6
months, should he be proud of this?
Level: High
Expected answer: Maybe. Some UNIX systems dont clean up well after themselves. Inode
problems and dead user processes can accumulate causing possible performance and
corruption problems. Most UNIX systems should have a scheduled periodic reboot so file
systems can be checked and cleaned and dead or zombie processes cleared out.
11. What is redirection and how is it used?
Level: Intermediate
Expected answer: redirection is the process by which input or output to or from a process is
redirected to another process. This can be done using the pipe symbol |, the greater than
symbol > or the tee command. This is one of the strengths of UNIX allowing the output
from one command to be redirected directly into the input of another command.
12. How can you find dead processes?
Level: Intermediate
Expected answer: ps -ef|grep zombie -- or -- who -d depending on the system.
13. How can you find all the processes on your system?
Level: Low
Expected answer: Use the ps command
14. How can you find your id on a system?
Level: Low
Expected answer: Use the who am i command.
15. What is the finger command?
Level: Low
Expected answer: The finger command uses data in the passwd file to give information on
system users.

ORACLE Question Bank

Page 78 of 141

HCL Technologies Banking Center

Confidential

16. What is the easiest method to create a file on UNIX?


Level: Low
Expected answer: Use the touch command
17. What does >> do?
Level: Intermediate
Expected answer: The >> redirection symbol appends the output from the command
specified into the file specified. The file must already have been created.
18. If you arent sure what command does a particular UNIX function what is the best
way to determine the command?
Expected answer: The UNIX man -k <value> command will search the man pages for the
value specified. Review the results from the command to find the command of interest.

ORACLE Question Bank

Page 79 of 141

HCL Technologies Banking Center

Confidential

ORACLE TROUBLESHOOTING
1. How can you determine if an Oracle instance is up from the operating system level?
Level: Low
Expected answer: There are several base Oracle processes that will be running on multiuser operating systems, these will be smon, pmon, dbwr and lgwr. Any answer that has them
using their operating system process showing feature to check for these is acceptable. For
example, on UNIX a ps -ef|grep dbwr will show what instances are up.
2. Users from the PC clients are getting messages indicating :
Level: Low
ORA-06114: (Cnct err, can't get err txt. See Servr Msgs & Codes Manual)
What could the problem be?
Expected answer: The instance name is probably incorrect in their connection string.
3. Users from the PC clients are getting the following error stack:
Level: Low
ERROR: ORA-01034: ORACLE not available
ORA-07318: smsget: open error when opening sgadef.dbf file.
HP-UX Error: 2: No such file or directory
What is the probable cause?
Expected answer: The Oracle instance is shutdown that they are trying to access, restart
the instance.
4. How can you determine if the SQLNET process is running for SQLNET V1? How
about V2?
Level: Low
Expected answer: For SQLNET V1 check for the existence of the orasrv process. You can
use the command tcpctl status to get a full status of the V1 TCPIP server, other protocols
have similar command formats. For SQLNET V2 check for the presence of the LISTENER
process(s) or you can issue the command lsnrctl status.
5. What file will give you Oracle instance status information? Where is it located?
Level: Low
Expected answer: The alert<SID>.ora log. It is located in the directory specified by the
background_dump_dest parameter in the v$parameter table.

ORACLE Question Bank

Page 80 of 141

HCL Technologies Banking Center

Confidential

6. Users arent being allowed on the system. The following message is received:
Level: Intermediate
ORA-00257

archiver is stuck. Connect internal only, until freed

What is the problem?


Expected answer: The archive destination is probably full, backup the archive logs and
remove them and the archiver will re-start.
7. Where would you look to find out if a redo log was corrupted assuming you are using
Oracle mirrored redo logs?
Level: Intermediate
Expected answer: There is no message that comes to the SQLDBA or SRVMGR programs
during startup in this situation, you must check the alert<SID>.log file for this information.
8. You attempt to add a datafile and get:
Level: Intermediate
ORA-01118: cannot add anymore datafiles: limit of 40 exceeded
What is the problem and how can you fix it?
Expected answer: When the database was created the db_files parameter in the
initialization file was set to 40. You can shutdown and reset this to a higher value, up to the
value of MAX_DATAFILES as specified at database creation. If the MAX_DATAFILES is
set to low, you will have to rebuild the control file to increase it before proceeding.
9. You look at your fragmentation report and see that smon hasnt coalesced any of
you tablespaces, even though you know several have large chunks of contiguous free
extents. What is the problem?
Level: High
Expected answer: Check the dba_tablespaces view for the value of pct_increase for the
tablespaces. If pct_increase is zero, smon will not coalesce their free space.
10. Your users get the following error:
Level: Intermediate
ORA-00055

maximum number of DML locks exceeded

What is the problem and how do you fix it?


Expected answer: The number of DML Locks is set by the initialization parameter
DML_LOCKS. If this value is set to low (which it is by default) you will get this error.
Increase the value of DML_LOCKS. If you are sure that this is just a temporary problem,
you can have them wait and then try again later and the error should clear.

ORACLE Question Bank

Page 81 of 141

HCL Technologies Banking Center

Confidential

11. You get a call from you backup DBA while you are on vacation. He has corrupted
all of the control files while playing with the ALTER DATABASE BACKUP
CONTROLFILE command. What do you do?
Level: High
Expected answer: As long as all datafiles are safe and he was successful with the BACKUP
controlfile command you can do the following:
CONNECT INTERNAL
STARTUP MOUNT
(Take any read-only tablespaces offline before next step ALTER DATABASE DATAFILE ....
OFFLINE;)
RECOVER DATABASE USING BACKUP CONTROLFILE
ALTER DATABASE OPEN RESETLOGS;
(bring read-only tablespaces back online)
Shutdown and backup the system, then restart
If they have a recent output file from the ALTER DATABASE BACKUP CONTROL FILE TO
TRACE; command, they can use that to recover as well.
If no backup of the control file is available then the following will be required:
CONNECT INTERNAL
STARTUP NOMOUNT
CREATE CONTROL FILE .....;
However, they will need to know all of the datafiles, logfiles, and settings for
MAXLOGFILES, MAXLOGMEMBERS, MAXLOGHISTORY, MAXDATAFILES for the
database to use the command.

ORACLE Question Bank

Page 82 of 141

HCL Technologies Banking Center

Confidential

Tips, Those Can be Asked As Questions


1.

Unique identifie (UID) is represent with symbol: #


secondary Unique identifie (UID) is represent with symbol: (#)

2. DISTNCT keyword suppressed the duplicate rows in the result set, include
immediately after the SELECT keyword.
3. SQL*PLUS file commands:
a. GET filename.sql: write the contents of the previously saved file to
the SQL buffer.
b. START filename.sql: Runs a previosly saved command file.
c. @filename.sql: Same as START command.
d. SPOOL filename.sql: Stores query results in a file.
4. Rules of precedence of the operator:
1. All comparison operators
2. NOT
3. AND
4. OR
(you can override rules by using parentheses).
5. Null values are displayed last for the order by clause ascending sequences and first
for the descending sequences.
6. a. INSTR and LENGTH two single row character manipulation functions returns
NUMERIC value.
b. ROUND and TRUNC two functions used with Number as well as Date datatype.
c. NVL function convert a NULL value to an actual value can be used with any
datatype, but return values always the same as the datatype of the column used.
d. DECODE function decodes an expression as similar way as IF-THEN-ELSE
statements.
e. MIN and MAX two GROUP function can be used for any datatype.
f. All the GROUP functions accept COUNT(*) ignore NULL values.
7. A condition involving an outer join cannot use the IN operator or the OR operator in
the where clause.
8. You cannot use column alias in the GROUP BY clause. You can use GROUP BY clause
without using group function in the SELECT list.
9. Two classes of the Comparison Operators:
a. Single-row operators: (> , = , >= , < , <> , <=).
b. Multiple-row operator: (IN , ANY , ALL).
10. Sub-queries cannot contain an ORDER BY clause.
11. If one of the values returned by the inner query (sub-query) is a NULL, the entire
query returns no rows. The reason is that compare a null value result in a NULL.
12. SUBSTITUTION VARIABLE:
a. DEFINE creates a CHAR datatype user variable and assign a value to it.
b. ACCEPT reads user input and stores it in a variable, explicitly define a NUMBER
and DATE datatype variable.

ORACLE Question Bank

Page 83 of 141

HCL Technologies Banking Center

Confidential

13. Database Transactions:


COMMIT ISSUE when :a. user issue a COMMIT.
b. DDL or DCL statement executes.
c. User EXITS.
14. ROLLBACK ISSUE when :a. User issue a ROLLBACK.
b. System crashes.
c. Power failure occur.
15. Table names and column names must begin with letter, can be 1-30 character long,
can contain (A-Z, a-z, 0-9, _, $, #) only.
16. Create (GLOBAL TEMPORARY) TABLE ..... command specifies that the table is
temporary and visible to all the sessions. The data in a temporary table is visible
only to the session that inserts the data into the table.
17. Tables in the Oracle database is prefix with:
USER_ : These views contains information about all the objects owned by user.
ALL_ : These views contains information about all the TABLES accessible to the
user.
DBA_ : These views can be accessed by the people having DBA Role.
V$_ : These views contains information about Database server performance and
Locking.
18. Integer, Float, Int, BOOLEAN etc are not Oracle SQL invalid datatypes. In a table,
only one can have a datatype LONG.
19. NOT NULL constraint can be specified only at the column level, not at the Table
level.
20. The sub-query of the view cannot contain an ORDER BY clause.
21. Just after creation of a SEQUENCE, CURRVAL Pseudo-columns does not contain any
value, NEXTVAL must be issued first so that CURRVAL contains first value.
22. When you drop the TABLE, all the INDEXES on that table dropped.
23. If the user has forgot his password, either USER(if he is running his session) or
DBA can change his password.
24. In the declare section of the PL/SQL block, declare anly one identifier per line.
Initialize CONSTANT and NOT NULL variables.
25. CHR is the SQL function that converts an ASCII code to its corresponding
character: 10 is the code for a LINE FEED.
26. When a variable is defined in outer block, it can be referred in inner block. But when
a variable is defined in inner block, it cannot be reffered in outer block.
27. An Implicit Cursor is fired by default for every SELECT (querying one and only one
row) and DML statements.
28. When a variable is not initialized, the value is passed to executable section is NULL
for that varaible.
29. Using CURSOR, before first fetch , %FOUNDFOUND evaluates to NULL, but after
the first fetch has taken place, %NOTFOUND evaluates to FALSE.
30. For cursors declared using the FOR UPDATE clause, the OPEN statement also locks
those rows.

ORACLE Question Bank

Page 84 of 141

HCL Technologies Banking Center

Confidential

UPDATE and DELETE statements may include the WHERE CURRENT OF clause if
the cursor was declared with the FOR UPDATE clause.

ORACLE Question Bank

Page 85 of 141

HCL Technologies Banking Center

Confidential

Tips, Those Can be Asked As Questions Continued


1. Components of Procedure Builder PL/SQL Interpreper are:
a) Source Pane: Displays the PL/SQL code of program.
b) Navigator Pane: Displays the same information as the Object Navigator of the D2K, but
within the PL/SQL interpreter.
c) Interpreter Pane: Allows user to execute subprograms, Procedure Builder commands, and
SQL statements.
2. If user is using Procedure Builder, CREATE keyword is not required to create
subprogram.
3. User can transfer values to and from the calling environment through parameters to the
subprogram. Select one of the three modes for each parameter: IN, OUT, and IN OUT.
Datatype can only be the %TYPE, %ROWTYPE definition, or an explicit datatype with no
size specification.
4. IN parameters are passed as constants from calling environment into the procedure. if
user attempts to change the value of an IN parameter, it will result an error.
5. If user want to view the values from a procedure, use PUT_LINE procedure of the
DBMS_OUTPUT package at the SQL prompts a4nd PUT_LINE procedure of the TEXT_IO
package in the Procedure Builder. TEXT_IO package is only available in Procedure Builder.
6. Followings are the Methods for Passing Parameters in the subprograms:
a) Positional: Lists value in the order in which the parameters are declared.
b) Named Association: Lists values in arbitrary order by associating each one with its
parameter name using special syntax (=>).
c) Combination: Lists the first values positionally, and the remainder using the special
syntax of the named method.
7. RETURN datatype must not include size specification in the declaration section. There
must be atleast one RETURN (variable) statement in the executable section.
8. For the subprograms like Procedure, Function, Package etc., the source code is compile in
to p-code and p-code is get executed and result the user. This p-code is stored in the data
dictionary in the compiled form.
9. In SQL*Plus, use SHOW ERRORS (in short: SHO ERR) to see compilation errors for the
subprograms.
10. A function may accept one or many IN parameters, but return only a single value.
Generally OUT and IN OUT parameter is not used with Functions.

ORACLE Question Bank

Page 86 of 141

HCL Technologies Banking Center

Confidential

11. PL/SQL user defined functions can be called from:


a) Select list of a SELECT command
b) Condition of the WHERE and HAVING clauses
c) CONNECT BY, START WITH, ORDER BY, and GROUP BY clauses
d) VALUES clauses of the INSERT command
e) SET clause of the UPDATE command.
12. Oracle server stores the specification and body seperately in the database. This allows
user to change the definition of a program construct in the package body without causing
Oracle to invalidate other schema objects that call or reference the program construct.
13. Define the package specification before the body.
14. Overloading is the feature that allows user to define different subprograms with the
same name in a package.
15. PL/SQL does not allow forward references. User must declare an identifier before using
it.
16. Use PRAGMA RESTRICT_REFERENCES to check for voilations of the rules, if user is
using packaged function.
17. In the Oracle database, all packages are installed by running CATPROC.SQL script.
18. Dynamic SQL allows DDL statements to be written and executed from PL/SQL.
19. Using EXECUTE IMMEDIATE statement in the Dynamic SQL, User can user INTO
clause for a single row subquery, but must use OPEN-FOR, FETCH, and CLOSE for a
multirow query.
20. DBMS_UTILITY package analyzes objects in a perticular schema, checks whether the
server is running in parallel mode, and returns the time.
21. Database triggers can be defined on tables and on views only.
22. When the database trigger fails, the triggering statement is automatically rolled back
by the Oracle Server.
23. The OLD and NEW qualifiers are only available in ROW triggers. Prefix these qualifiers
with a colon (:) in every SQL and PL/SQL statement.
24. MUTATING table is a table that is been currently being modified by an UPDATE,
DELETE, or INSERT statement, or a table that might need to be updated by the effects of
a declarative DELETE CASCADE referential integrity constraint.

ORACLE Question Bank

Page 87 of 141

HCL Technologies Banking Center

Confidential

25. To obtain the names of all PL/SQL stored objects within a schema, query the
USER_OBJECTS data dictionary view.
26. To obtain the text (source code) of a stored procedure or function, use the TEXT
column of USER_SOURCE data dictionary view.
27. To display a procedure or function and its parameter list, use the DESCRIBE SQL*Plus
command followed by the name of procedure or function.
28. Using procedure builder, use STEP INTO/STEP OVER/STEP OUT to temporarily
resume execution of an interrupted subprogram.
29. Run the script @UTLDTREE that creates the objects to allow user to desplay the direct
and indirect dependencies.
30. To set the remote dependencies mode, set the value of
REMOTE_DEPENDENCIES_MODE parameter in the INIT.ORA parameter file.

ORACLE Question Bank

Page 88 of 141

HCL Technologies Banking Center

Confidential

Tips, Those Can be Asked As Questions Continued


1) Flushing of the dirty buffers to the datafile is performed independently by DBWR and
can take place either before or after commit.
2) OEM Architecture consists of the following:
a) OEM Console - The OEM Console is an application that permits a DBA to manage several
databases from one machine.
b) Intellegent Agent - the Intellegent Agent is a process that runs on remote nodes in a
network to executes jobs and events sent by the console and communication results back to
the console using Net 8.
c) OEM Repository - The OEM Repository, a set of database tables that holds information
used by OEM. A seperate
repository exists for each OEM users.
3) If user is using Oracle Parallel Server, the database can be opened in shared mode by
specifying STARTUP PARALLEL. The parameter PARALLEL_SERVERS must be set to TRUE.
By default (exclusive mode) the database can be mounted and used by only one instance.
4) CORE_DUMP_DEST parameter provides location to write core dumps files, generally
used on UNIX plateforms. Core Dumps are normally produces when the session or the
instance terminates abnormally with errors. This parameter is not available on MS-Windows
plateforms.
5) By defaulty, users with SELECT ANY TABLE privilege can query the dictionary views. If
DBA wish to protect the dictionary from non-DBA userd, set the initialization parameter
O7_DICTIONARY_ACCESSIBILITY to FALSE.
6) The dictionary view DICTIONARY contains names and descriptions of all the data
dictionary views in the database. DICT is a synonym for DICTIONARY view.
7) The control file size is determined by the MAX clause when create the databaseMAXLOGFILES, MAXDATAFILES, MAXLOGMEMBERS, MAXLOGHISTORY, and
MAXINSTANCES. Oracle pre-allocates space for these maximums in the control file.
8) The LGWR process writes to only one redo log file group at a time. The file that is
actively being written to is known as the CURRENT log file. The log files that are required
for instance recovery are known as ACTIVE log files. The other log files are known as
INACTIVE.
9) ALERT file has all Internal errors(ORA - 00600)
Block compution errors (ORA - 01578)
Operatons that affect database structure and parameters, as well as

ORACLE Question Bank

Page 89 of 141

HCL Technologies Banking Center

Confidential

commands, such as START UP, SHUTDOWN, RECOVER etc. The value of all non default
initialisation parameters at the time the instance starts.
10) The parameter file initoid .era is a text file. It can be maintained using a standard
operating system editor.

11) 'ACTIVE' in 'STATUS' of the query result from V$ log indicates that the online redo
log group is active but is not the current online redo log group.
12) To manage sort operations more efficiently, tempopary tablespaces are designated
exclusively for sort segements. No permanent schema objects can reside in a temporary
tablespace.
13) DAta dictionary objects (except for audit tables), are never dropped or min cated, and
therefore are not likely fragment the tablespace.
14) When a transaction begins, a roll back segment needs to be assigned using:
SET TRANSACTON .USE .ROLLBACK SEGMENT rollback_segment.
15) A row header is used to store the numbers of columns in the row, the chaining
information, and the row lock status.
16) DBMS_ROWID is a packege which is used to convert between ROWID formats and to
translate between ROWID and its individual components.
17) Tablespaces quotes are modified in these situations:
When the objects are reorganised and placed in different tablespaces
When tables owned by a used exihibit unanticipated growth
When an application is enhanced and requires addtional tables or indexes
18) There are approximately 126 systems privileges.
19) SELECT ANY TABLE privilege enables access to views and tables in other schemas, but
it does not enable you to select dictionary objects.
20) A NOAUDIT statement reverses the effect of a previous AUDIt statements,but it
should have the same syntax as the previous AUDIT statement and that it only reverses the
effects of that particular statement
21) A LOB segment can only be imported into the same tablespace from which it was
exported.
22)ALTER USER command can be used to change the password and control account locking.

ORACLE Question Bank

Page 90 of 141

HCL Technologies Banking Center

Confidential

23)If there are users in the database who are authenticated by the operating system,
changing OS_AUTHENT_PREFIX may prevent these users from logging onto the database.
24)Once a quota of zero is assigned, the objects owned by the user remain in the revoked
tablespace, but they cannot be allocated any new space.
25)CREATE TABLE includes the CREATE INDEX and the ANALYZE commands. The user
must have a quota for the tablespace or must have been granted.
26)Access to dictionary objects is restricted to the users with the system privileges
SYSDBA and SYSOPER.
27)There are no cascading effects when a system privilege is revoked, regardless of
whether it was given using WITH ADMIN OPTION.
28)The generation and insertion of an audit trail record is independent of a user's
transaction, hence if the transaction is rolled back the audit trail remains intact.
29)By default, all the roles assigned to a user are enabled at logon.The default roles for a
user can be limited with the ALTER USER command.
30)Whenever a ROLE is dropped, the Oracle Server revokes it from all the users and roles
to whom it had been granted and removes it from the database.

ORACLE Question Bank

Page 91 of 141

HCL Technologies Banking Center

Confidential

Oracle Basic Database Concepts


1. Which statement about declaring arguments is true?
A. Datatype and maximum length are required
B. Only datatype is required
C. Only maximum length is required for the VARCHAR2 fields
D. Datatype and Maximum length are not required.
Choice B is correct. When user is declaring an argument(parameter), the minimum
requirement of declaring is only datatype. It returns an error if length is given with the
datatype.
2. Which data dictionary view can you query to examine all the dependencies between
the objects that you own?
A. USER_DEPENDENCIES
B. USER_RELATIONS
C. USER_RELATIONSHIPS
D. USER_OBJECTS
Choice A is Correct. USER_DEPENDENCIES data dictionary view is displaying direct
dependencies between the objects user own.USER_OBJECTS data dictionary view is
displaying the information of the objects user created.
3. When created, which two of the following views are queried to display indirect
dependencies? (Choose two.)
A. USER_DEPENDENCIES
B. DEPTREE
C. USER_IDTREE
D. IDEPTREE
Choice B and D are correct. DBA has to run the script '@UTLDTREE' that creates the
objects to allow user to display the direct and indirect dependencies. Display direct and
indirect dependencies from additional user views called DEPTREE and IDEPTREE.
USER_DEPENDENCIES data dictionary view is displaying direct dependencies.

ORACLE Question Bank

Page 92 of 141

HCL Technologies Banking Center

Confidential

4. To help minimize dependency failures, which attribute should you use when creating
constructs in PL/SQL?
A. SQL%ROWCOUNT
B. %ROWTYPE
C. SQL%FOUND
D. %CHECK
Choice B is correct. To minimize dependency failures by declaring records using the
%ROWTYPE attribute, Declaring variable with the %TYPE attribute, Querying with the
SELECT * notation and including the column list with INSERT statements. SQL
%ROWCOUNT and SQL%FOUND are the cursor attributes to find out the status of the
cursor.
You have disabled certain database triggers on the SAL_GRADE table. Which two
data dictionary views can you query to determine the status of all database triggers on
this table? (Choose two.)

Choice A and F are correct. TO determine the status of the database trigger, use the
datadictionary view USER_OBJECTS and USER_TRIGGERS. Both the views has a common
column name STATUS provide information whether trigger is VALID or INVALID.
USER_SOURCE data dictionary view gives the source code of the objects.

ORACLE Question Bank

Page 93 of 141

HCL Technologies Banking Center

Confidential

Oracle Basic Database Concepts Continued

1. Which statement about declaring arguments is true?


A.
B.
C.
D.

Datatype and maximum length are required.


Only datatype is required.
Only maximum length is required for the VARCHAR2 datatype.
Datatype and maximum length are not required.

Choice B is correct. When user is declaring an argument(parameter), the minimum


requirement of declaring is only datatype. It returns an error if length is given with the
datatype.
2. Using the debugger in Procedure Builder, which action must you take to temporarily
halt the execution of a procedure?
A.
B.
C.
D.

Click on the STEP OVER icon.


Click on the STEP INTO icon.
Insert a break point
Raise an exception explicitly

Choice C is correct. Procedure Builder is a tool to create, execute, and debug PL/SQL
program units used in the application, such as a form or report or any other graphical
interface. User has to insert a BREAK POINT to temporarily halt the execution of a
procedure. STEP OVER or STEP INTO is used to temporarily resume execution of an
interrupted program.
3. Which type(s) of objects does Oracle keep track of?
A.
B.
C.
D.

packages, procedures, and functions only


database triggers only
tables, procedures, and functions only
all object types

Choice D is correct. Oracle keep track of the all object type including procedures,
functions, packages, triggers, all object type datatype etc.

ORACLE Question Bank

Page 94 of 141

HCL Technologies Banking Center

Confidential

4. The PROCESS_EMPS, RAISE_SAL and QUERY_EMP procedures are executed


frequently together from different applications. What steps should be performed
to logically group these procedures together to increase performance?
A. Create a SQL*Plus script file that contains each procedure's CREATE statement.
B. Create a package specification and body with the source code of each procedure.
Drop the old stand alone procedures.
C. Create a package specification and body with the source code of each procedure.
Keep the stand alone procedures for the specification to reference.
D. Create a package specification. Place the name of each procedure in the new
specification.
Choice B is correct. Packages bundle related PL/SQL types, items, and subprogram into one
container. When user logically group these procedures together to increase performance,
use has to create a package with the specification and body with the source code for each
procedures. The advantage of creating a package is that the whole package is loaded into
the memory at once, thus later calls to related constructs require no disk I/O.

5. Given the following.


CREATE OR REPLACE PROCEDURE calculate_sal
IS
v_tot_sal dept.totsal%TYPE;
v_dept_rec dept%ROWTYPE;
BEGIN
SELECT *
INTO v_dept_rec
FROM dept
WHERE NAME = 'SALES';
v_tot_sal := get_sal (v_dept_rec.id);
IF v_tot_sal < 75000 THEN
set_sal (20, 100000);
END IF;
END calculate_sal;
Which effect could you expect if a new column were added to the dept table?
A. The CALCULATE_SAL procedure would be marked invalid and would automatically
compile successfully upon the next execution.
B. The CALCULATE_SAL procedure would be marked invalid and would automatically
compile unsuccessfully upon the next execution.
C. Since the code references %ROWTYPE, no affect will be noticed.
D. The CALCULATE_SAL procedure would be marked valid and would automatically
compile successfully upon the next execution.

ORACLE Question Bank

Page 95 of 141

HCL Technologies Banking Center

Confidential

Choice A is correct. This is the case of the local dependency. Objects are on the same node
in the same database. The Oracle server automatically manages all local dependencies using
the database's internal 'Depends-on' table. When referenced object is modified, the
dependent objects are invalidated. The next time an invalidated object is called, the Oracle
Server automatically recompile it.
6. Given the following.
CREATE OR REPLACE PROCEDURE calculate_sal
IS
v_tot_sal dept.totsal%TYPE;
v_dept_rec dept%ROWTYPE;
BEGIN
SELECT *
INTO v_dept_rec
FROM dept
WHERE NAME = 'SALES';
v_tot_sal := get_sal@proddb(v_dept_rec.id);
IF v_tot_sal < 75000 THEN
set_sal@proddb (20, 100000);
END IF;
END calculate_sal;
The local procedure, CALCULATE_SAL, was last compiled at 8:30 am yesterday. The
remote procedure, GET_SAL, was last compiled today at 4:30 pm. Which action
should you take to avoid relying upon the automatic remote dependency mechanism?
A. Reference the PRAGMA RESTRICT_REFERENCES compiler directive in the
CALCULATE_SAL procedure to prevent referenced remote procedure compilation.
B. Reference the PRAGMA RESTRICT_REFERENCES compiler directive in the
GET_SAL function to prevent referenced remote procedure compilation.
C. Manually recompile the CALCULATE_SAL procedure before the recompilation of
GET_SAL.
D. Manually recompile the CALCULATE_SAL procedure after the recompilation of
GET_SAL.
Choice D is correct. To avoid relying upon the automatic remote dependency mechanism,
manually recompile the CALCULATE_SAL procedure after the recompilation of GET_SAL.
PRAGMA RESTRICT_REFERENCES is used to specify the purity level of a packaged
function.

ORACLE Question Bank

Page 96 of 141

HCL Technologies Banking Center

Confidential

7. The UPDATE_EMPLOYEE procedure contains an algorithm that calculates an


employee's comm multiple times throughout the program. If a change is made to
the algorithm, the change must be made multiple times. How can this procedure be
modified to simplify the code and reduce duplicated code?
A.
B.
C.
D.

Add an algorithm exception handler.


Create multiple anonymous blocks containing the algorithm.
Create a library containing the algorithm.
Add a local subprogram containing the algorithm.

Choice D is correct. User has to add a local subprogram to the procedure, that subprogram
has executed in that procedure only and can not be executed from outside. Any time this
procedure is executed, the subprogram local to that procedure will also be executed and
hence reducing duplicate coding.
8. User is created a procedure LOGON_TRIG contains many SQL statements and will
be executed from multiple client applications. Where should this procedure be
stored?
A.
B.
C.
D.

server only
client applications only
server and client applications
system global area

Choice A is correct. Procedure stored in the server promote reusability and maintainability
of the database. Once validated, can be used by any number of applications.
9. Which code successfully calculates commission returning it to the calling
environment?
A. CREATE OR REPLACE FUNCTION tot_comm
(v_empno NUMBER)
IS
v_tot NUMBER;
BEGIN
SELECT SUM(order.total)
INTO
v_tot
FROM order, cust
WHERE order_cust_no = cust.cust_no
AND cust_repid = v_empno;
RETURN (v_tot * .20);
END tot_comm;

ORACLE Question Bank

Page 97 of 141

HCL Technologies Banking Center

Confidential

B. CREATE OR REPLACE FUNCTION tot_comm


(v_empno NUMBER)
RETURN number
IS
v_tot NUMBER;
BEGIN
SELECT SUM(order.total)
INTO
v_tot
FROM order, cust
WHERE order_cust_no = cust.cust_no
AND cust_repid = v_empno;
RETURN (v_tot * .20);
END tot_comm;
C. CREATE OR REPLACE FUNCTION tot_comm
(v_empno NUMBER)
RETURN number
IS
v_tot NUMBER;
BEGIN
SELECT SUM(order.total)
INTO
v_tot
FROM order, cust
WHERE order_cust_no = cust.cust_no
AND cust_repid = v_empno;
END tot_comm;
D. CREATE OR REPLACE FUNCTION tot_comm
(v_empno NUMBER)
IS
RETURN number
v_tot NUMBER;
BEGIN
SELECT SUM(order.total)
INTO
v_tot
FROM order, cust
WHERE order_cust_no = cust.cust_no
AND cust_repid = v_empno;
RETURN (v_tot * .20);
END tot_comm;
Choice B is correct. A stored function must return a value to the calling environment. A
function must have a RETURN clause in the header, and atleast one RETURN clause in the
executable section. RETURN clause in the header comes before keyword IS/AS. Function
promote reusability and maintainability.

ORACLE Question Bank

Page 98 of 141

HCL Technologies Banking Center

Confidential

10. Given the following :CREATE OR REPLACE PACKAGE pack_emp


IS
PROCEDURE proc_emp
(p_emp_id IN NUMBER DEFAULT 50, p_deptno IN NUMBER);
END pack_emp;
CREATE OR REPLACE PACKAGE BODY pack_emp
IS
v_cost NUMBER;
PROCEDURE proc_emp
(p_emp_id IN NUMBER DEFAULT 50, p_deptno IN NUMBER);
IS
v_sal
emp.sal%TYPE;
v_job
emp.job%TYPE;
BEGIN
SELECT sal
INTO
v_sal
FROM
emp
WHERE emp_id = p_emp_id
AND _deptno = p_deptno
END proc_emp;
FUNCTION func_tot_sal
(p_deptno IN NUMBER)
RETURN number
IS
v_tot_sal emp.sal%TYPE;
BEGIN
SELECT sum(sal)
INTO
v_tot_sal
FROM
emp
WHERE deptno = p_deptno;
RETURN v_tot_sal;
END func_tot_sal;
END pack_emp;
Which code will successfully assign a value to the V_COST variable within SQL*Plus?
A. BEGIN
pack_emp.v_cost := 6.75;
END;

ORACLE Question Bank

Page 99 of 141

HCL Technologies Banking Center

Confidential

B. BEGIN
SELECT AVG(sal )
INTO v_cost
FROM gross_receipt;
END;
C. BEGIN
v_cost := 6.75;
END;
D. This variable is private to the package and cannot be directly assigned a value within
SQL*Plus.
Choice D is correct. The variable declares in the package body can anly be accessed by
other objects in the same package only. They are not visible to any subprograms or objects
outside of the package and can not assign any value within SQL*Plus.
11. Given the following :CREATE OR REPLACE PACKAGE pack_emp
IS
PROCEDURE proc_emp
(p_emp_id IN NUMBER DEFAULT 50, p_deptno IN NUMBER);
END pack_emp;
CREATE OR REPLACE PACKAGE BODY pack_emp
IS
v_cost NUMBER;
PROCEDURE proc_emp
(p_emp_id IN NUMBER DEFAULT 50, p_deptno IN NUMBER);
IS
v_sal
emp.sal%TYPE;
v_job
emp.job%TYPE;
BEGIN
SELECT sal
INTO
v_sal
FROM
emp
WHERE emp_id = p_emp_id
AND _deptno = p_deptno
END proc_emp;
FUNCTION func_tot_sal
(p_deptno IN NUMBER)
RETURN number
IS
v_tot_sal emp.sal%TYPE;
BEGIN

ORACLE Question Bank

Page 100 of 141

HCL Technologies Banking Center

Confidential

SELECT sum(sal)
INTO
v_tot_sal
FROM
emp
WHERE deptno = p_deptno;
RETURN v_tot_sal;
END func_tot_sal;
END pack_emp;
Which code will successfully invoke the func_tot_sal function within SQL*Plus?
A. VARIABLE g_tot_sal NUMBER
EXECUTE :g_tot_sal := func_tot_sal(11);
B. VARIABLE g_tot_sal NUMBER
EXECUTE g_tot_sal := pack_emp.func_tot_sal(11);
C. VARIABLE g_tot_sal NUMBER
EXECUTE pack_emp.func_tot_sal(g_tot_sal, 11);
D. This function cannot be referenced from outside the package.
Choice D is correct. The cursors, variables, and subprograms like 'Procedures and Functions'
declared within the package specification can be referenced in any Oracle server
envionment. The cursors, variables, and subprograms declared within the package body can
be referenced by other constructs which are part of the same package. Function
func_tot_sal is declared in the package body is local to that package only and can not be
called outside the package.

12. Given the following.


CREATE OR REPLACE PACKAGE pack_cur
IS
CURSOR C1 is
SELECT *
FROM emp;
PROCEDURE proc_order
(p1 IN NUMBER);
END pack_cur;
CREATE OR REPLACE PACKAGE BODY pack_cur
IS
PROCEDURE proc_order
(p1 IN NUMBER)
IS
CURSOR C2 IS

ORACLE Question Bank

Page 101 of 141

HCL Technologies Banking Center

Confidential

SELECT *
FROM ord;
BEGIN
OPEN C2;
...
END;
END pack_cur;
After being opened, which cursor or cursors, persist for the entire user session?
A.
B.
C.
D.

C1 only
C2 only
Both C1 and C2
Neither C1 nor C2

Choice A is correct. The cursors, variables, and subprograms declared within the package
specification can be referenced in any Oracle server environment. The cursors, variables,
and subprograms declared within the package body can be referenced by other constructs
which are part of the same package. A variables, cursors defined within subprogram can be
accessed by that subprogram only. They are not visible to any other subprograms, even in
the same package.
13. You have lost the script file that contains the source code for the pack_emp
package. Which command will produce the source code stored in the database?
A. SELECT text
FROM user_objects
WHERE name = 'PACK_EMP';
B. SELECT text
FROM user_programs
WHERE name = 'PACK_EMP';
C. SELECT text
FROM user_source
WHERE name = 'PACK_EMP';
D. SELECT text
FROM user_packages
WHERE name = 'PACK_EMP';
Choice C is correct. If user have lost the source file, use SQL*Plus to regenerate it from
USER_SOURCE data dictionary view. THis view has four columns: NAME, TYPE, LINE, and
TEXT. To obtain the text of a stored procedure, function, or package, use text column of
the to obtain source code of the object.

ORACLE Question Bank

Page 102 of 141

HCL Technologies Banking Center

Confidential

14. You have created a package that contains two procedures that reference each
other. Which package method could you use to alleviate possible compilation errors?
A.
B.
C.
D.

purity restriction
forward declaration
one-time only code
stand-alone package body

Choice B is correct. PL/SQL allows a subprograms declaration called a forward declaration.


It consists of the subprogram specification declared before it is been in any of the
subprogram in the package body. Forward declaration can be done in the following cases:
1) Define subprogram in logical or alphabatical order
2) Define mutually recursive subprograms
3) Group subprograms in a package
4) The formal parameter list must appear in both the forward declaration and the
subprogram body.
5) The subprogram body can appear anywhere after the forward declaration, but they must
appear in the same program unit.
One-time-only code executed one time only, when the package is first invoked within the
user session.
For the purity restriction in the package, user use PRAGMA RESTRICT_REFERENCES to
check the violations of the rules.

15. User has created a package. Which of the following two statements about
PACKAGE OVERLOADING are TRUE? (Choose two)
A.
B.
C.
D.
E.

It allows you to exceed the maximum number of subprograms.


The subprograms can be local or remote.
Two subprograms with the same name must differ only in return type.
The subprograms must be local.
Two subprograms if their formal parameters differ only in the name or parameter
mode.

Choice D and E are correct.


Ristrictions of Overloading of a package:
1) Two subprograms if their formal parameters differ only in the name or parameter mode.
2) Two subprograms if their formal parameters differ only in datatypes and different
datatypes are in the same family.
3) Two subprograms if their formal parameters differ only in subtype and the different
subtypes are based on types in the same family (VARCHAR and STRING are subtypes of
VARCHAR2).
4) Two functions that differ only in return type, even if the types are in different families.

ORACLE Question Bank

Page 103 of 141

HCL Technologies Banking Center

Confidential

16. The DBMS_SQL package allows developers to create dynamic SQL and to issue DDL
commands from within a construct. Which construct of this package must always
be executed regardless of the type of use?
A.
B.
C.
D.

BIND_VARIABLE
OPEN_CURSOR
FETCH_ROWS
All constructs must be executed.

Choice B is correct. OPEN_CURSOR procedure of the DBMS_SQL package establishes an


area in memory to process a SQL statement must always be executed regardless of the
type of use. BIND_VARIABLE binds the given value to the variable indentified by its name
in the parsed statement in the given cursor. FETCH_ROWS retrieves a row for the
specified cursor.
17. Which procedure of the DBMS_OUTPUT supplied package allows you to place
messages in a buffer to be displayed at a later time?
A.
B.
C.
D.
E.

PUT
PLACE_LINE
NEW_LINE
GET_LINES
OUTPUT_LINE

Choice A is correct. PUT procedure of the DBMS_OUTPUT supplied package appends text
from the procedure to the current line of the line output buffer.NEW_LINE places an
end_of_line markerin the output buffer. GET_LINES procedure retrieves an array of lines
from the output buffer into the procedure.
18. After modifying the EMP table to add a new column, you must now recompile all
dependent PL/SQL constructs. Which package/procedure can you invoke?
A.
B.
C.
D.

DBMS_DDL.ALTER_COMPILE
DBMS_RECOMPILE.INVALID
DBMS_COMPILE.MODIFIED
DBMS_SQL.ALTER_COMPILE

Choice A is correct. User can recompile modified procedures, functions, and packages using
BMS_DDL.ALTER_COMPILE packaged procedure.

ORACLE Question Bank

Page 104 of 141

HCL Technologies Banking Center

Confidential

19. Which Oracle supplied package allows you to send a message to another user of the
same session?
A.
B.
C.
D.
E.

DBMS_OUTPUT
DBMS_JOB
DBMS_PIPE
DBMS_MESSAGE
DBMS_SQL

Choice C is Correct. The DBMS_PIPE package sends messages from one session to another
in the same instance. PACK_MESSAGE procedure of this package packs an item into local
message buffer, SEND_MESSAGE function sends a message contained in the local message
buffer to the named pipe, RECEIVE_MESSAGE function retrieves a message from the
named pipe and put it into the local message to be unpacked by the UNPACK procedure and
atlast UNPACK_MESSAGE procedure unpacks an item from local message buffer.
DBMS_OUTPUT package outputs values and messages from any PL/SQL block.DBMS_JOB
package enables user to schedule tasks, execute procedures, and alter the jobs that have
been scheduled.Using DBMS_SQL package, user can issue data definition language
statements in PL/SQL.
20. Given the following.
CREATE OR REPLACE TRIGGER update_comm_gross
{trigger information}
BEGIN
{additional code}
END;

This trigger should execute for each row when the SEATS_SOLD or COST_PER_TICKET
columns are updated and when a row is inserted into the GROSS_COMM table. Which
trigger information must you add?
A. BEFORE INSERT OR UPDATE OF seats_sold, cost_per_ticket ON gross_receipt
B. BEFORE INSERT OR UPDATE(seats_sold, cost_per_ticket) ON gross_receipt
FOR EVERY ROW
C. BEFORE (gross_receipt, seats_sold, cost_per_ticket) INSERT, UPDATE
FOR EACH ROW
D. BEFORE INSERT OR UPDATE OF seats_sold, cost_per_ticket ON gross_receipt
FOR EACH ROW
Choice D is correct. When user is creating a trigger, user has to know when should the
trigger fire, what DML statement will cause the trigger to execute and how many times
should the trigger body execute when the triggering event takes place. A row trigger fires
each time the table is affected by the triggering event. If the triggering event affects no
rows, a row trigger is not executed.

ORACLE Question Bank

Page 105 of 141

HCL Technologies Banking Center

Confidential

21. Given the following.


CREATE OR REPLACE TRIGGER secure_emp
AFTER DELETE OR UPDATE OF sal, job ON emp
BEGIN
...
END;
How many times will the trigger body execute upon invocation?
A.
B.
C.
D.

once
twice
for every row deleted or updated
for every row deleted or sal, job updated

Choice A is correct. This is an example of statement level trigger. A statement level trigger
is fired once on behalf of the triggering event, even no rows are affected at all.
22. User has created the CASCADE_UPDATES trigger on the DEPT table. Which
command will enable SCOTT the privilege to execute this trigger?
A.
B.
C.
D.
E.

GRANT SELECT ON cascade_updates TO scott;


GRANT SELECT, INSERT, UPDATE, DELETE ON dept TO scott;
GRANT SELECT, INSERT, UPDATE, DELETE ON cascade_updates TO scott;
GRANT SELECT, EXECUTE ON dept TO scott;
GRANT EXECUTE ON cascade_updates TO scott;

Choice B is correct. Database Triggers execute implicitely when an INSERT, UPDATE, or


DELETE statement is issued against the associated table. So user needs DML privileges
against the database table. When a perticular event met with the condition written in the
trigger body, trigger will fire.
23. For which type of trigger is table mutation a problem?
A.
B.
C.
D.

statement only
row only
statement and row
neither statement nor row

Choice B is correct. Reading and writing data using triggers is subjected to certain rules.
The restrictions apply only to row triggers, unless a statement trigger is fired as a result of
ON DELETE CASCADE.A mutating table is a table that is currently being modified by an
UPDATE, DELETE, or INSERT statement, or a table that might be updated by the effect
of a declarative DELETE CASCADE referential integrity action. A table is not considered

ORACLE Question Bank

Page 106 of 141

HCL Technologies Banking Center

Confidential

mutating for STATEMENT triggers so convert this trigger to a statement level database
trigger by removing FOR EACH ROW.
24. Given the following.
CREATE OR REPLACE TRIGGER trig_total_sal
AFTER INSERT ON total_yearly_sal
FOR EACH ROW
DECLARE
v_total NUMBER;
BEGIN
SELECT sum(yearly_sal)
INTO
v_total
FROM
total_yearly_sal;
UPDATE company_budget
SET overall_sal_budget = v_total;
END;
You insert a row into the TOTAL_YEARLY_SAL table and receive this message:
ORA-04091: table SCOTT.TOTAL_YEARLY_SAL is mutating, trigger/function may
not see it
How do you correct this error?
A.
B.
C.
D.

Remove the SUM function; it is not allowed in database triggers.


Convert it to a statement level database trigger by removing FOR EACH ROW.
Remove the AFTER INSERT ON clause.
Change the timing to BEFORE.

Choice B is Correct. A mutating table is a table that is currently being modified by an


UPDATE, DELETE, or INSERT statement, or a table that might be updated by the effect
of a declarative DELETE CASCADE referential integrity action. A table is not considered
mutating for STATEMENT triggers so convert this trigger to a statement level database
trigger by removing FOR EACH ROW.
25. The PRODUCT_CHECK trigger of the PRODUCT table has been disabled. Which
command can you issue to enable this trigger?
A.
B.
C.
D.

ENABLE TRIGGER product_check;


ENABLE product_check;
ALTER TABLE product ENABLE TRIGGER product_check;
ALTER TRIGGER product_check ENABLE;

ORACLE Question Bank

Page 107 of 141

HCL Technologies Banking Center

Confidential

Choice D is correct. User can disable a trigger by using ALTER TRIGGER syntax, or disable
all triggers on a table by using ALTER TRIGGER syntax.For enabled a trigger the Oracle
Server checks integrity and guarantees that triggers cannot compromise them. The syntax
is:
ALTER TRIGGER product_check ENABLE;
When a trigger is first created, it is enabled automatically.
26. You have disabled certain database triggers on the SAL_GRADE table. Which two
data dictionary views can you query to determine the status of all database
triggers on this table? (Choose two.)
A.
B.
C.
D.
E.
F.

USER_OBJECTS
USER_SOURCES
USER_SOURCE
USER_OBJECT
USER_TRIGGER
USER_TRIGGERS

Choice A and F are correct. TO determine the status of the database trigger, use the
datadictionary view USER_OBJECTS and USER_TRIGGERS. Both the views has a common
column name STATUS provide information whether trigger is VALID or INVALID.
USER_SOURCE data dictionary view gives the source code of the objects.
27. To help minimize dependency failures, which attribute should you use when creating
constructs in PL/SQL?
A.
B.
C.
D.

SQL%ROWCOUNT
%ROWTYPE
SQL%FOUND
%CHECK

Choice B is correct. To minimize dependency failures by declaring records using the


%ROWTYPE attribute, Declaring variable with the %TYPE attribute, Quering with the
SELECT * notation and including the column list with INSERT statements. SQL
%ROWCOUNT and SQL%FOUND are the cursor attributes to find out the status of the
cursor.
28. When created, which two of the following views are queried to display indirect
dependencies? (Choose two.)

USER_DEPENDENCIES
DEPTREE
USER_IDTREE
IDEPTREE

ORACLE Question Bank

Page 108 of 141

HCL Technologies Banking Center

Confidential

Choice B and D are correct. DBA has to run the script '@UTLDTREE' that creates the
objects to allow user to display the direct and indirect dependencies. Display direct and
indirect dependencies from additional user views called DEPTREE and IDEPTREE.
USER_DEPENDENCIES data dictionary view is displaying direct dependencies.
29. Which data dictionary view can you query to examine all the dependencies between
the objects that you own?

USER_DEPENDENCIES
USER_RELATIONS
USER_RELATIONSHIPS
USER_OBJECTS

Choice A is Correct. USER_DEPENDENCIES data dictionary view is displaying direct


dependencies between the objects user own.USER_OBJECTS data dictionary view is
displaying the information of the objects user created.
30. To easily determine indirect dependencies between specified objects, additional
views can be created. Which script file, provided by Oracle, will create these
views when executed?
A.
B.
C.
D.

utldtree.sql
deptree.sql
dbms_tree.sql
catalog.sql

Choice A is Correct. DBA has to run the script '@UTLDTREE' that creates the objects to
allow user to display the direct and indirect dependencies. Display direct and indirect
dependencies from additional user views called DEPTREE and IDEPTREE. CATALOG.sql has
to be run at time of creation of the database to create all the data dictionaries in the
database.

ORACLE Question Bank

Page 109 of 141

HCL Technologies Banking Center

Confidential

DBA-Oracle 9i
1. You want to add new columns to the TABLE1 table. Which two statements must be
true to redefine this table online? (Choose two.)
A.
B.
C.
D.

TABLE1 must have a primary key.


TABLE1 must NOT be a partitioned table.
TABLE1 must NOT be in either the SYS or SYSTEM schema.
The new columns being added to TABLE1 must NOT have NOT NULL constraints.

Answer:
(A) TABLE1 must have a primary key.
(C) TABLE1 must NOT be in either the SYS or SYSTEM schema.

2. You want to modify your initialization parameters so that if an instance crashes,


you can have the database operational within approximately 30 minutes.
Which initialization parameter would accomplish this with the least amount of
administrative effort?
A.
B.
C.
D.
E.

FAST_START_IO_TARGET
FAST_START_MTTR_TARGET
LOG_CHECKPOINT_TIMEOUT
LOG_CHECKPOINT_INTERVAL
DB_BLOCK_MAX_DIRTY_TARGET

Answer:
(B) FAST_START_MTTR_TARGET
3. You want to implement Automatic Consumer Group Switching so that sessions running
long jobs will be automatically switched to a consumer group with a lower priority.
Which resource directive would you include to identify the lower priority consumer
group?
A.
B.
C.
D.
E.

SWITCH_TIME
QUEUEING_P1
SWITCH_GROUP
SWITCH_ESTIMATE
MAX_EST_EXEC_TIME

Answer:
(C) SWITCH_GROUP

ORACLE Question Bank

Page 110 of 141

HCL Technologies Banking Center

Confidential

4. You want to retain all backups for at least 12 days.


Which RMAN persistent configuration command should you execute?
A.
B.
C.
D.

CONFIGURE RETENTION
CONFIGURE RETENTION
CONFIGURE RETENTION
CONFIGURE RETENTION

POLICY
POLICY
POLICY
POLICY

FOR 12 DAYS;
TO REDUNDANCY 12;
RECOVERY WINDOW = 12;
TO RECOVERY WINDOW OF 12 DAYS;

Answer:
(D) CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 12 DAYS;
5. Examine these initialization parameters:
db_create_file_dest = '/u01/oradata/'
db_create_online_log_dest_1 = '/u02/oradata/'
db_create_online_log_dest_2 = '/u03/oradata/'
db_create_online_log_dest_3 = '/u04/oradata/'
You issue this statement:
CREATE DATABASE;
In which location will your data files be created?
A.
B.
C.
D.

/u01/oradata/
/u02/oradata/
/u03/oradata/
/u01/oradata and /u02/oradata/

Answer:
(A) /u01/oradata/
6. Which statement represents a characteristic of Oracle9i's new Dynamic SGA
feature?
A.
B.
C.
D.

Only the buffer cache can be resized dynamically.


Only the shared pool and large pool can be resized dynamically.
Only the shared pool and buffer cache can be resized dynamically.
The shared pool, buffer cache, and large pool can be resized dynamically.

Answer:
(C) Only the shared pool and buffer cache can be resized dynamically.

ORACLE Question Bank

Page 111 of 141

HCL Technologies Banking Center

Confidential

7. You are using automatic space-managed segments. You execute the


DBMS_SPACE.SPACE_USAGE procedure.
Which output parameter indicates the blocks below the HWM with 50 to 75 percent
free space?
A.
B.
C.
D.
E.

FS1_BLOCKS
FS2_BLOCKS
FS3_BLOCKS
FS4_BLOCKS
FULL_BLOCKS

Answer:
(C) FS3_BLOCKS
8. Two instances in your Real Application Clusters environment share a server-side
parameter file. You want to modify the value of a parameter using the ALTER
SYSTEM statement, but only have the parameter changed for one of the instances.
What could you do?
A.
B.
C.
D.

Include the SCOPE option of the ALTER SYSTEM statement.


Include the SCOPE and SID options of the ALTER SYSTEM statement.
Manually edit the IFILE associated with the instance you wish to change.
Manually edit the SPFILE, and include the parameter prefixed by the instance.

Answer:
(B) Include the SCOPE and SID options of the ALTER SYSTEM statement.
9. You want to monitor the usage of the ORDER_CAT_IDX index.
Which statement should you execute?
A.
B.
C.
D.

ALTER INDEX
ALTER INDEX
ALTER INDEX
ALTER INDEX

order_cat_idx MONITORING;
order_cat_idx MONITORING ON;
order_cat_idx MONITORING USAGE;
order_cat_idx MONITORING USAGE ON;

Answer:
(C) ALTER INDEX order_cat_idx MONITORING USAGE;

ORACLE Question Bank

Page 112 of 141

HCL Technologies Banking Center

Confidential

10. The WORKORDER table contains these columns:


WO_ID
NUMBER
DESCRIPTION
VARCHAR2(30)
RECEIVED_ON
TIMESTAMP
RECEIVED_AT
NUMBER
PROCESSED_ON TIMESTAMP
PROC_INT
INTERVAL DAY TO SECOND
Which of these expressions will result in an error?
A.
B.
C.
D.

PROC_INT * 2502
(PROCESSED_ON - PROC_INT)
(PROCESSED_ON - RECEIVED_ON) / 7
(RECEIVED_ON + PROCESSED_ON) / 7

Answer:
(D) (RECEIVED_ON + PROCESSED_ON) / 7
11. Click the Exhibit button to examine an audit policy definition for the ORDER table.
Which SQL statement will be audited?
A.
B.
C.
D.

SELECT orderno, orderdt, cost FROM oe.order;


SELECT orderno, orderdt FROM oe.order WHERE cost = 1000;
SELECT orderno, orderdt FROM oe.order WHERE cost <= 1000;
UPDATE oe.order SET cost = cost * 1.10 WHERE cost > 1000;

Answer:
(A) SELECT orderno, orderdt, cost FROM

oe.order;

12. Which statement about databases with multiple block sizes is true?
A.
B.
C.
D.

A tablespace can consist of files with different block sizes.


An Oracle database can have up to five (5) different block sizes.
A non-standard block size can be the same size as the standard block size.
All standard and non-standard block sizes must be defined when a database is
created.

Answer:
(B) An Oracle database can have up to five (5) different block sizes.

ORACLE Question Bank

Page 113 of 141

HCL Technologies Banking Center

Confidential

13. You want to use LogMiner, but you suspect that you have a corrupt redo log file.
Which parameter should you include when calling the DBMS_LOGMNR.START_LOGMNR
procedure?
A.
B.
C.
D.

VERIFY
FIX_CORRUPTION
SKIP_CORRUPTION
BYPASS_CORRUPTION

(C) SKIP_CORRUPTION

14. Which condition must be true to create user-defined events?


A. Only Oracle Management Server must be running.
B. Oracle Management Server must be running with Oracle9i Agent on the monitored
node.
C. Oracle Enterprise Manager must be running in standalone mode with a standalone
repository.
D. Oracle Enterprise Manager must be running in standalone mode without a standalone
repository.
Answer:
(B) Oracle Management Server must be running with Oracle9i Agent on the monitored node.

15. You maintain a primary and a standby database. Because of the critical nature of
your data, you want to configure your system for no-data-loss. No data divergence
is acceptable.
Which data availability mode should you use?
A.
B.
C.
D.

Rapid protection
Instant protection
Delayed protection
Guaranteed protection

Answer:
(D) Guaranteed protection

ORACLE Question Bank

Page 114 of 141

HCL Technologies Banking Center

Confidential

16. In Oracle9i's Multithreaded HS Agent architecture, which thread processes


requests from the request queue?
A.
B.
C.
D.
E.

task thread
agent thread
monitor thread
dispatcher thread
shared server thread

Answer:
(A) task thread
17. Which two statements about using external tables are true? (Choose two.)
A.
B.
C.
D.

External tables are always read-only.


External tables are always updatable.
Indexes can be created on external tables.
Creating an external table allocates NO extents, but simply updates the data
dictionary.
E. External tables are updatable assuming you have appropriate permissions to the
directory in which the external table is located.
Answer:
(A) External tables are always read-only.
(D) Creating an external table allocates NO extents, but simply updates the data dictionary.
18. In which situation would you use the CROSS JOIN keywords in a SELECT
statement?
A. The tables being joined do NOT have primary and foreign keys defined.
B. The tables being joined have matching columns with different names but compatible
data types.
C. The tables being joined have NO common columns, and you want to produce an
intentional Cartesian product.
D. The tables being joined have two columns with the same name and compatible data
types, and you want to join on one of the columns.
E. The tables being joined have two columns with the same name and compatible data
types, and you want to join on both of the columns.
F. The tables being joined have two columns with the same name and incompatible data
types, and you want to join on both of the columns.
Answer:
(C) The tables being joined have NO common columns, and you want to produce an intentional
Cartesian product.

ORACLE Question Bank

Page 115 of 141

HCL Technologies Banking Center

Confidential

19. You want to apply all changes made in a workspace to the LIVE workspace. Which
two privileges would allow you to perform this task? (Choose two.)
A.
B.
C.
D.
E.

CREATE_ANY_WORKSPACE
ACCESS_ANY_WORKSPACE
MERGE_ANY_WORKSPACE
COMMIT_ANY_WORKSPACE
REMOVE_ANY_WORKSPACE

Answer:
(B) ACCESS_ANY_WORKSPACE
(C) MERGE_ANY_WORKSPACE

20. You are adding a new master site to your replication environment. You want to add
the new site without quiescing the existing master sites.
Which two methods could you use to perform this task? (Choose two.)
A.
B.
C.
D.
E.

Flashback
Trial Recovery
full export/import
change-based recovery
complete recovery using backup media

Answer:
(C) full export/import
(D) change-based recovery

ORACLE Question Bank

Page 116 of 141

HCL Technologies Banking Center

Confidential

Oracle SQL Quiz


1. How many columns are presented after executing this query:
SELECT address1||','||address2||','||address2 "Adress" FROM employee;
A) 1
B) 2
C) 3
D) 0
E) 4
The correct answer is A.
TIP: Only one column. || is the concatenation operator.
2. Which Oracle access method is the fastest way for Oracle to retrieve a single
row?
A) Primary key access
B) Access via unique index
C) Table access by ROWID
D) Full table scan
The correct answer is C.
TIP: Table Access by ROWID is the fastest access path
3. Which of the following can be a valid column name?
A) Column
B) 1966_Invoices
C) Catch_#22
D) #Invoices
E) None of the above
The correct answer is C.
TIP: Column name cannot start with a number; "Column" is a reserved word.

ORACLE Question Bank

Page 117 of 141

HCL Technologies Banking Center

Confidential

4. Which command will delete all data from a table and will not write to the rollback
segment?
A) DROP
B) DELETE
C) CASCADE
D) TRUNCATE
The correct answer is D.
TIP: The TRUNCATE command doesn't write user data to rollback segments.
5. Which character function can be used to return a specified portion of a character
string?
A) INSTR
B) SUBSTRING
C) SUBSTR
D) POS
The correct answer is C.
TIP: The SUBSTR function will return a specified portion of a string
6. The primary key on table EMP is the EMPNO column. Which of the following
statements will not use the associated index on EMPNO?
A) select * from EMP where nvl(EMPNO, '00000') = '59384';
B) select * from EMP where EMPNO = '59384';
C) select EMPNO, LASTNAME from EMP where EMPNO = '59384';
D) select 1 from EMP where EMPNO = '59834';
The correct answer is A.
TIP: Any function, including nvl() will cause the index to be ignored.
7. When a user creates an object without a TABLESPACE clause, where will Oracle
store the segment?
A) System tablespace
B) Users tablespace
C) Default tablespace for the user
D) Oracle will give an error

ORACLE Question Bank

Page 118 of 141

HCL Technologies Banking Center

Confidential

E) Undefined
The correct answer is C.
TIP: DEFAULT TABLESPACE will be used to store segments without TABLESPACE clause
8. Which character is used to continue a statement in SQL*Plus?
A) *
B) /
C)
D) @
E) =
The correct answer is C.
TIP: One can use "-" to continue statements in SQL*Plus
9. Assuming today is Monday, 10 July 2000, what is returned by this statement:
SELECT to_char(NEXT_DAY(sysdate, 'MONDAY'), 'DD-MON-RR') FROM dual;
A) 03-JUL-00
B) 10-JUL-00
C) 12-JUL-00
D) 11-JUL-00
E) 17-JUL-00
F) 09-JUL-00
The correct answer is E.
TIP: NEXT_DAY returns the date of the next weekday specified in the 2nd argument.
10. To produce a meaningful result set without any cartesian products, what is the
minimum number of conditions that should appear in the WHERE clause of a fourtable join?
A) 8
B) 2
C) 3
D) 4
E) 5
F) There is no such criteria

ORACLE Question Bank

Page 119 of 141

HCL Technologies Banking Center

Confidential

The correct answer is C.


TIP: You must have at least (N-1) join conditions to prevent a cartesion product
11. Which of the following SQL functions can operate on any datatype?
A) TO_CHAR
B) LOWER
C) LPAD
D) MAX
E) CEIL
The correct answer is D.
TIP: Functions like MIN, MAX and NVL can operate on any datatype

ORACLE Question Bank

Page 120 of 141

HCL Technologies Banking Center

Confidential

Oracle PL/SQL Quiz


1. In this PL/SQL statement, which of the following lines will produce an error?
A) cursor CAPITALS is
B) select CITY, STATE
C) into my_city, my_state
D) from CITIES
E) where CAPITAL = 'Y';
F) There are no errors in these statements
The correct answer is C.
TIP: Data can only be fetched after a cursor was defined. The INTO clause is invalid in
CURSOR definition.
2. In a PL/SQL block, a variable is declared as NUMBER without an initial value.
What will its value be when it is first used in the executable section of the
PL/SQL block?
A) NULL
B) 0
C) Results in a compilation error
D) An exception will be raised
The correct answer is A.
TIP: Uninitialized PL/SQL variables are set to NULL.
3. PL/SQL raises an exception, in which TWO of the following cases:
A) When a SELECT statement returns no rows
B) When a SELECT statement returns more than one row
C) When the datatypes of SELECT clause and INTO clause do not match
D) When INTO statement is missing in the SELECT statement
The correct answer is AB.
TIP: Runtime exceptions are A) NO_DATA_FOUND and B) TOO_MANY_ROWS. Options C
and D result in compilation errors.

ORACLE Question Bank

Page 121 of 141

HCL Technologies Banking Center

Confidential

4. What is the result if two NULL values are compared to each other?
A) TRUE
B) FALSE
C) Undefined
D) NULL
The correct answer is D.
TIP: NULL is neither EQUAL nor NOT EQUAL to NULL. Any comparison to NULL is
avaluated to NULL.
5. Functions for error trapping are contained in which section of a PL/SQL block?
A) Header
B) Declarative
C) Executable
D) Exception
The correct answer is D.
TIP: Error trapping code are contained in the EXCEPTION section

6. Which section of a PL/SQL block would most likely contain a RAISE statement?
A) Header
B) Declarative
C) Executable
D) Exception
The correct answer is C.
TIP: RAISE statements can be coded in the EXECUTABLE section
7. Select the VALID trigger type(s)?
A) AFTER statement trigger
B) INSERT row trigger
C) DELETE row trigger
D) UPDATE row trigger
E) All of the above
F) None of the above

ORACLE Question Bank

Page 122 of 141

HCL Technologies Banking Center

Confidential

The correct answer is A.


TIP: AFTER statement trigger is a valid trigger type

8. In this SQL statement, which of the following lines will produce an error?
A) CREATE OR REPLACE TRIGGER check_age
B) BEFORE INSERT OR UPDATE ON employee FOR EACH ROW
C) IS
D) years_old NUMBER;
E) BEGIN
F) null; END;
The correct answer is C.
TIP: Incorrect syntax on line 3: 'IS' should be 'DECLARE'
9. In this PL/SQL statement, which of the following lines will produce an error?
A) create or replace function vat (vat_rate IN NUMBER, price IN NUMBER)
B) declare
C) l_vat NUMBER;
D) begin
E) l_vat := (vat_rate/100) * price; return l_vat;
F) end;
The correct answer is B.
TIP: Incorrect syntax on line 2: 'DECLARE' should be 'RETURN ... IS'
10. What output will the following statement produce? Select NVL2(NULL,'NOT
NULL', NULL) from dual;
A) NULL
B) NOT NULL
C) Function NVL2 is not defined
D) None of the above
The correct answer is A.
TIP: NVL() accepts 2 arguments, NVL2 (new SQL function) accepts 3.

ORACLE Question Bank

Page 123 of 141

HCL Technologies Banking Center

Confidential

11. Which three definitions are associated with implicit cursors?


A) %rowtype, %toomanyrows, %found
B) %found, %notfound, %rowcount
C) %rowtype, %rowcount, %notfound
D) None of the above
E) All of the above
The correct answer is B.
TIP: Cursor attributes %found, %notfound, %rowcount and %isopen are associated with
implicit cursors.

ORACLE Question Bank

Page 124 of 141

HCL Technologies Banking Center

Confidential

Oracle DBA Quiz


1. Which command will cause an automatic commit to occur?
A) CONNECT
B) RENAME
C) SELECT
D) INSERT
E) DELETE
The correct answer is B.
TIP: Any DDL statement (like RENAME) will cause an implicit commit. CONNECT does a
COMMIT in SQL*Plus, but not in Precompiler programs.
2. Which component of an instance holds session variables and arrays when you are
NOT running in MTS mode?
A) SGA
B) SQL Area
C) Library Cache
D) PGA
E) Shared Pool
The correct answer is D.
TIP: The PGA holds session variables and arrays
3. Which Oracle background process is responsible for coalescing free space?
A) PMON
B) SMON
C) ARCH
D) LGWR
The correct answer is B.
TIP: SMON coalesces free space (extents) into larger, contiguous extents.

ORACLE Question Bank

Page 125 of 141

HCL Technologies Banking Center

Confidential

4. The CKPT process is optional; which process assumes these duties if CKPT is not
active?
A) PMON
B) SMON
C) ARCH
D) LGWR
The correct answer is D.
TIP: LGWR perform checkpoints when CKPT is not active.
5. The DBWR process is NOT responsible for:
A) Defers writes for I/O optimization
B) Uses a LRU algorithm to keep most recently used blocks in memory
C) Writes to database redo log files as people COMMIT data
D) Writes all changed (i.e. dirty) buffers to datafiles
The correct answer is C.
TIP : LGWR writes to database redo log files as people COMMIT data
6. Which statement about the LGWR is false?
A) There is only one redo log writer per instance
B) A commit confirmation may be issued before a transaction has been recorded in
the redo log file
C) During long transactions Oracle can flush data to the redo logs before it is
committed.
D) An Oracle instance cannot survive without a redo log writer
The correct answer is B.
TIP: A commit can only be confirmed after the transaction has been recorded in tin redo
log file.

ORACLE Question Bank

Page 126 of 141

HCL Technologies Banking Center

Confidential

7. The storage parmeters for a given table are: INITIAL=100, NEXT=100,


MINEXTENTS=2, MAXEXTENTS=10, PCTINCREASE=20. If the first 3 extents
are filled, what will the size of the FOURTH extent be?
A) 120
B) 140
C) 144
D) 240
E) 400
The correct answer is C.
TIP: We've got 3 extents: 100; 100; 120 (100+20%). Fourth one will be 144 (120+20%).
8. Assume the database administrator wanted to limit the amount of idle time that
any one user could have during a given session. Which of the following would be
used to enforce such a limit?
A) audit
B) quota
C) limit
D) profile
The correct answer is D.
TIP: Profiles can be used to limit session idle time.
9. Discarding redo logs is done with which of the following statements?
A) alter database archivelog;
B) alter database open resetlogs;
C) alter database mount exclusive;
D) alter system archive log all;
The correct answer is B.
TIP: ALTER DATABASE OPEN RESETLOGS will discard data in online redo logs and reset
the log sequence number to 0.
10. The DBA is creating a new user. Which of the following is NOT defined at user
creation?
A) default tablespace
B) profile
C) idle_time

ORACLE Question Bank

Page 127 of 141

HCL Technologies Banking Center

Confidential

D) default role
The correct answer is C.
TIP: Idle time is defined as part of user-profile creation and is not part user creation.
11. What is the minimum number of extents for a Rollback segment?
A) 0
B) 1
C) 2
D) 3
E) 5
F) 20
The correct answer is C.
TIP: Rollback segments must have at least two extents
12. What is the best PCTINCREASE value for a Temporary tablespace?
A) 0
B) 10
C) 50
D) 80
E) 100
The correct answer is A.
TIP: PCTINCREASE=0 is best for a temprary tablespace
13. The Program Global Area (PGA) contains ALL of the following except:
A) Sort Area
B) System Change Number (SCN)
C) Session Information
D) Cursor state
The correct answer is B.
TIP: The PGA doesn't cache SCN information

ORACLE Question Bank

Page 128 of 141

HCL Technologies Banking Center

Confidential

14. Which of the following actions is required to prevent row migration on a table?
A) Decrease PCTUSED
B) Increase PCTUSED
C) Decrease PCTFREE
D) Increase PCTFREE
E) Increase database block size
The correct answer is D.
TIP: Increasing PCTFREE will allocate more space for rows to grow within the block

ORACLE Question Bank

Page 129 of 141

HCL Technologies Banking Center

Confidential

Oracle Backup and Recovery Quiz

1. When should one back up a read-only tablespace?


A) During regular backup window
B) Prior to placing the tablespace into read-only mode
C) Immediately after placing the tablespace into read-only mode
D) Prior to creating a new tablespace
E) Prior to altering the database structure
. The correct answer is C.
TIP: One should backup a tablespace immediately after it has been placed in read-only
mode.
2. An export that backs up tables that have changed since the last cumulative or
complete export is known as?
A) An incremental export
B) A cumulative export
C) A complete export
D) A full export
The correct answer is B.
TIP: Export after a cumulative export is also cumulative export.
3. Which is the order that objects are imported?
A) table defs, integrity constraints, table data, table indexes
B) table defs, table data, table indexes, integrity constraints
C) table defs, table indexes, table data, integrity constraints
D) integrity constraints, table defs, table data, table indexes
The correct answer is B.
TIP: Import order is: table defs, table data, table indexes, integrity constraints.
4. Which of the following contains the records of all transactions that occur in the
database and plays an essential part in database recovery?
A) Control files
B) Datafiles
C) Parameter file

ORACLE Question Bank

Page 130 of 141

HCL Technologies Banking Center

Confidential

D) Redo log files


The correct answer is D.
TIP: All transactions are recorded in the REDO LOG files.
5. Several months ago, a user was created called bkup_admin for use with backups. A
new backup program was purchased which needs all the rights of bkup_admin but
needs to be called bkup_mgr. How would you go about removing bkup_admin and
adding bkup_mgr?
A) Simply use the RENAME command.
B) Use the ALTER command.
C) Export user bkup_admin, DROP with cascade user bkup_admin, Import using user
to user.
D) Export user bkup_admin, DROP user bkup_admin, Import using user to user.
The correct answer is C.
TIP: You can export the old user, drop the old user cascade, and import into new user.
6. The longest row in table DEPT is 8096 bytes long. What is the minimum buffer size
that should be set in an import of DEPT?
A) 4096
B) 8096
C) 8192
D) 17210
The correct answer is B.
TIP: Import buffer must at least be as big as the largest row.
7. The DBA is about to initiate incomplete recovery on database TOOLS. The system
change number to which she would like to recover is 3982398484. Which of the
following statements is appropriate for database recovery?
A) alter database TOOLS recover database until '3982398484';
B) alter database TOOLS recover tablespace 3982398484;
C) alter database TOOLS recover database until cancel;
D) alter database TOOLS recover database until change 3982398484;
The correct answer is D.
TIP: Syntax for change-base incomplete recovery is: RECOVER DATABASE UNTIL
CHANGE ...

ORACLE Question Bank

Page 131 of 141

HCL Technologies Banking Center

Confidential

8. How do you connect to RMAN without a recovery catalog?


A) rman target system/manager nocatalog
B) rman system/manager catalog=no
C) rman system/manager without catalog
D) rman target system/manager rcvcat no
The correct answer is A.
TIP: Connect without a catalog with: rman target system/manager nocatalog
9. How do you create a SQL version of the control file, when there are read-only
tablespaces in your database?
A) ALTER DATABASE BACKUP CONTROLFILE READ ONLY;
B) ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
C) ALTER DATABASE BACKUP CONTROLFILE TABLESPACE READ ONLY;
D) ALTER DATABASE BACKUP CONTROLFILE TO TRACE INCLUDING READ
ONLY;
The correct answer is B.
TIP: use "ALTER DATABASE BACKUP CONTROLFILE TO TRACE;" to create a SQL version
of the control file.
10. You have noticed that you are left with some old backups which are no longer
required. You have been using RMAN and now you want to have a list of these
files. Which Recovery Manager task will accomplish this?
A) LIST NEED BACKUP;
B) REPORT EXPIRED BACKUPS;
C) REPORT OBSOLETE;
D) LIST OBSOLETE BACKUPS;
The correct answer is C.
TIP: REPORT OBSOLETE; will list backups that are no longer required.

ORACLE Question Bank

Page 132 of 141

HCL Technologies Banking Center

Confidential

11. Which physical file contains the name and location of datafiles?
A) Redo log file
B) Paramerter File
C) Password File
D) Control File
The correct answer is D.
TIP: The Control File contains the name and location of datafiles
12. The first level of logical database space is called:
A) SEGMENTS
B) EXTENTS
C) DATA BLOCKS
D) TABLESPACE
The correct answer is C.
TIP: Data Blocks are the Finest Level of Granularity

ORACLE Question Bank

Page 133 of 141

HCL Technologies Banking Center

Confidential

Oracle Performance Tuning Quiz

1. Can the performance of a database be tuned by adjusting init.ora parameters?


A) Yes
B) No
The correct answer is A.
TIP: True, database performance can be tuned by adjusting init.ora parameters

2. When is the best time to tune a database application?


A) At design time
B) At development time
C) Before going live
D) When problems are experienced
The correct answer is A.
TIP: Poor system performance usually results from a poor database design.

3. You plan to execute UTLBSTAT and UTLESTAT twice. What do you need to do
between the first and second run to prevent the output from being overwritten?
A) Rename the output file after the first run
B) ALTER SYSTEM SET NUMBER_STATISTICS=2
C) Set the initialisation parameter NUMBER_STATISTICS 2
D) Used two different names for the output files
The correct answer is A.
TIP: utlbstat/ utlestat writes out (or overwrite) the "report.txt" file.

4. Which of the following approaches can the DBA take to improve hit statistics for
the library cache? (Choose two)
A) Increase DB_BLOCK_BUFFERS
B) Increase SHARED_POOL_SIZE
C) Use as many identical SQL statements in the application as possible
D) Issue long-running SQL statements first

ORACLE Question Bank

Page 134 of 141

HCL Technologies Banking Center

Confidential

The correct answer is BC.


TIP: The library cache is a part of the shared pool. Increasing it will help. Identical SQL
statement will also increase library cache hits.
5. How does one calculate the database hit ratio?
A) physical_reads / logical_reads
B) 1 - (logical_reads / physical_reads)
C) logical_reads / physical_reads
D) (logical_reads - physical_reads) / logical_reads
The correct answer is D.
TIP: Buffer Hit Ratio = (logical_reads - physical_reads) / logical_reads, where logical_reads
= db block gets + consistent gets

ORACLE Question Bank

Page 135 of 141

HCL Technologies Banking Center

Confidential

Oracle Net8 (SQL*Net) Quiz

1. The default directory location for the sqlnet.ora file is:


A) %ORACLE_HOME%\BIN
B) %ORACLE_HOME%\
C) %ORACLE_HOME%\NETWORK\ADMIN
D) %ORACLE_HOME%\RDBMS\ADMIN
The correct answer is C.
TIP: Net8 configuration files are stored in the %ORACLE_HOME%\NETWORK\ADMIN
directory
2. Which SQL*Net/ Net8 component routes incomming connections to a destination?
A) SERVER
B) PORT
C) IP Address
D) DISPATCHER
E) LISTENER
The correct answer is E.
TIP: The LISTENER routes incomming connections to a destination
3. Can one listener process listen for more than one database?
A) Yes
B) No
The correct answer is A.
TIP: One listener can listen for multiple databases
4. Can one listener process listen for more than one protocol?
A) Yes
B) No
The correct answer is A.
TIP: One listener can listen for multiple protocols (eg. TCPIP and IPC)

ORACLE Question Bank

Page 136 of 141

HCL Technologies Banking Center

Confidential

5. Which connection method requires the configuration of the TNSNAMES.ORA file?


A) Host naming
B) Local Naming
C) Centralized Naming
The correct answer is B.
TIP: One must have a local TNSNAMES.ORA file for local naming.
6. Which Oracle Names initialization script must be executed to create a new region
database?
A) NAMES.SQL
B) REGDBINIT.SQL
C) TNSNAMES.SQL
D) NAMESINI.SQL
E) ORANAMES.SQL
The correct answer is D.
TIP: Run the NAMESINI.SQL script to create a new domain database.
7. When configuring MTS on Windows NT, what protocol must be used for the
dispatchers?
A) IPC
B) Names Pipes
C) TCP/IP
D) SPX/IPX
E) EXTPROC
The correct answer is C.
TIP: If configuring MTS on Windows NT, dispatchers can only use teh TCP/IP protocol
8. When using MTS, the following will be shared among user processes:
A) Server processes
B) Client processes
C) Server sessions
D) Client sessions
E) Nothing

ORACLE Question Bank

Page 137 of 141

HCL Technologies Banking Center

Confidential

The correct answer is A.


TIP: When using MTS, server processes are shared among user processes
9. List two parameters that should be configured for MTS to work:
A) MTS_DISPATCHERS
B) MTS_SERVICE
C) MTS_SERVERS
D) MTS_SERVICES
E) MTS_SERVER
The correct answer is AC.
TIP: The only parameters that should be configured are MTS_SERVERS and
MTS_DISPATCHERS

ORACLE Question Bank

Page 138 of 141

HCL Technologies Banking Center

Confidential

Oracle Advanced Replication Quiz


1. Which of the following database objects cannot be replicated between databases?
A) Table
B) Sequence
C) Procedure
D) Index
E) Function
The correct answer is B.
TIP: Sequences cannot be replicated between databases

2. How many failed executions does it take for a database job to get BROKEN?
A) 1
B) 15
C) 16
D) 3
E) 7
The correct answer is C.
TIP: After 16 failed executions a job will be marked as BROKEN. Fix it by calling
DBMS_JOB.BROKEN()

3. Replication uses several administrative accounts. Which of the following is not valid
account types?
A) Administrator
B) Propagator
C) Alligator
D) Receiver
E) Deceiver
The correct answer is CE.
TIP: Valid admin account types are: administrator, propagator and receiver. Typically one
user acts as all three.

ORACLE Question Bank

Page 139 of 141

HCL Technologies Banking Center

Confidential

4. When a replication site pulls changes from another site, what type of replication is
used?
A) Master site
B) Snapshot site
C) Either a snapshot or master site
The correct answer is B.
TIP: Snapshot sites pull information from master sites

5. When a replication site pushes changes to all participating sites, what type of
replication is used?
A) Master site
B) Snapshot site
C) Either a snapshot or master site
The correct answer is A.
TIP: Master sites push changes to all participating sites

6. When a replication site contains subsets of another site's data, what type of
replication is used?
A) Master site
B) Snapshot site
C) Either a snapshot or master site
The correct answer is B.
TIP: Master sites replicate COMPLETE copies of tables, only snapshot sites can replicate
subsets

7. What replication functions are implemented with database jobs (DBMS_JOB)?


(select three)
A) Storing deferred transactions
B) Periodic pushes
C) Firing internal triggers
D) Periodic purges
E) Execute administrative requests

ORACLE Question Bank

Page 140 of 141

HCL Technologies Banking Center

Confidential

The correct answer is BDE.


TIP: Jobs are created to handle admin requests, pushes and purges.

8. You want to change a replicated table's structure, how will you proceed?
A) Open Oracle Enterprise manager and change the table's structure
B) Make the change by calling DBMS_REPCAT.ALTER_MASTER_REPOBJECT()
C) Get any popular third party GUI tool to make the change
D) Open SQL*Plus and make the change at each of the replicated sites
The correct answer is B.
TIP: Execute DDL on all sites with the DBMS_REPCAT.ALTER_MASTER_REPOBJECT (or
EXECUTE_DLL) API call

9. What is a feature of procedural replication?


A) Useful in performing batch processing at multiple sites
B) Includes automatic conflict detection
C) Does not need conflict resolution techniques
D) Automatically disables row-level replication when called at each site
The correct answer is A.
TIP: Procedural replication is used to perform batch processing at multiple sites
10. After adding a new object to a replication group, what do you need to do before it
can be replicated to other master sites?
A) Create a snapshot log for the object
B) Enter the object into the deferred transaction queue
C) Generate replication support for the object
The correct answer is C.
TIP: Before a object can be replicated one needs to generate replication support
(DBMS_REPCAT.GENERATE_REPLICATION_SUPPORT)

ORACLE Question Bank

Page 141 of 141

You might also like