Beruflich Dokumente
Kultur Dokumente
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.
Page 1 of 141
Confidential
Page 2 of 141
Confidential
Page 3 of 141
Confidential
Page 4 of 141
Confidential
Piecewise Operation on LONG fields (All LONG field problems are solved)
You cannot control the Pro*C precompiler to provide better and more compilable Ccode.
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.
Disconnect from the databases: use ologoff to close an open connection to oracle.
Page 5 of 141
Confidential
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;
Page 6 of 141
Confidential
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
Page 7 of 141
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
*.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
7.2
7.3
2.2
Page 8 of 141
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
Page 9 of 141
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;
Page 10 of 141
Confidential
Page 11 of 141
Confidential
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.
Page 12 of 141
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();
}
Page 13 of 141
Confidential
}
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();
}
Page 14 of 141
Confidential
Page 15 of 141
Confidential
Page 16 of 141
Confidential
SQL*Plus: drop java class .../ drop package ... (drop the wrapper)
dropjava utility: dropjava -u scott/tiger myPackage.myClass
Page 17 of 141
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.
Page 18 of 141
Confidential
Page 19 of 141
Confidential
OraServer
OraDatabase
OraConnection
OraDynaset
OraField
OraClient
OraParameter
OraParamArray
OraSQLStmt
OraMetaData
Page 20 of 141
Confidential
names. Similar to the SQL Server DMO object library. See the meta
data example below.
OraAQ
Page 21 of 141
Confidential
Page 22 of 141
Confidential
Page 23 of 141
Confidential
Page 24 of 141
Confidential
Page 25 of 141
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");
Page 26 of 141
Confidential
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
Page 27 of 141
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.
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.
Page 28 of 141
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.
Page 29 of 141
Confidential
Page 30 of 141
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
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.
Page 31 of 141
Confidential
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.
Page 32 of 141
Confidential
Page 33 of 141
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');
Page 34 of 141
Confidential
Page 35 of 141
Confidential
Page 36 of 141
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.
Page 37 of 141
Confidential
Page 38 of 141
Confidential
Page 39 of 141
Confidential
Page 40 of 141
Confidential
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
Page 41 of 141
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.
Page 42 of 141
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.
Page 43 of 141
Confidential
Page 44 of 141
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
Page 45 of 141
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)?
Page 46 of 141
Confidential
Page 47 of 141
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)
Page 48 of 141
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:
Java:
Page 49 of 141
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
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.
Page 50 of 141
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
Page 51 of 141
Confidential
Page 52 of 141
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.
Page 53 of 141
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
Page 54 of 141
Confidential
Page 55 of 141
Confidential
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.
Page 56 of 141
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';
Page 57 of 141
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
Page 58 of 141
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.
Page 59 of 141
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.
Page 60 of 141
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.
Page 61 of 141
Confidential
Page 62 of 141
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.
Page 63 of 141
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.
Page 64 of 141
Confidential
Page 65 of 141
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.
Page 66 of 141
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
Page 67 of 141
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
Page 68 of 141
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
Page 69 of 141
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.
Page 70 of 141
Confidential
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.
Page 71 of 141
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.
Page 72 of 141
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
Page 73 of 141
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.
Page 74 of 141
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
Page 75 of 141
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.
Page 76 of 141
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
Page 77 of 141
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.
Page 78 of 141
Confidential
Page 79 of 141
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.
Page 80 of 141
Confidential
6. Users arent being allowed on the system. The following message is received:
Level: Intermediate
ORA-00257
Page 81 of 141
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.
Page 82 of 141
Confidential
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.
Page 83 of 141
Confidential
Page 84 of 141
Confidential
UPDATE and DELETE statements may include the WHERE CURRENT OF clause if
the cursor was declared with the FOR UPDATE clause.
Page 85 of 141
Confidential
Page 86 of 141
Confidential
Page 87 of 141
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.
Page 88 of 141
Confidential
Page 89 of 141
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.
Page 90 of 141
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.
Page 91 of 141
Confidential
Page 92 of 141
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.
Page 93 of 141
Confidential
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.
Choice D is correct. Oracle keep track of the all object type including procedures,
functions, packages, triggers, all object type datatype etc.
Page 94 of 141
Confidential
Page 95 of 141
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.
Page 96 of 141
Confidential
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;
Page 97 of 141
Confidential
Page 98 of 141
Confidential
Page 99 of 141
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
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.
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.
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
15. User has created a package. Which of the following two statements about
PACKAGE OVERLOADING are TRUE? (Choose two)
A.
B.
C.
D.
E.
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.
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.
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.
Confidential
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.
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
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.
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
USER_DEPENDENCIES
DEPTREE
USER_IDTREE
IDEPTREE
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
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.
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.
Answer:
(A) TABLE1 must have a primary key.
(C) TABLE1 must NOT be in either the SYS or SYSTEM schema.
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
Confidential
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.
Answer:
(C) Only the shared pool and buffer cache can be resized dynamically.
Confidential
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.
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;
Confidential
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.
Answer:
(A) SELECT orderno, orderdt, cost FROM
oe.order;
12. Which statement about databases with multiple block sizes is true?
A.
B.
C.
D.
Answer:
(B) An Oracle database can have up to five (5) different block sizes.
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
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
Confidential
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.
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
Confidential
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
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
Confidential
Confidential
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
Confidential
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.
Confidential
Confidential
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.
Confidential
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
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
Confidential
Confidential
Confidential
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
Confidential
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
Confidential
Confidential
Confidential
Confidential
Confidential
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.
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
Confidential
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