Oracle Database Questions & Answers 3
Oracle Database Questions & Answers 3
About us
Sitemap
Contact Us
other instance that have failed SMON also cleans up temporary segments that are no longer in
use and
recovers dead transactions skipped during crash and instance recovery because of file-read or
off-line errors. These transactions are eventually recovered by SMON when the tablespace or file
is
brought back on-line SMON also coalesces free extents within the database to make free space
contiguous and easier to allocate.
83. What are functions of PMON ?
Process Monitor (PMON) performs process recovery when a user process fails PMON is
responsible for
cleaning up the cache and Freeing resources that the process was using PMON also checks on
dispatcher and server processes and restarts them if they have failed.
84. What is the function of ARCH ?
Archiver (ARCH) copies the on-line redo log files to archival storage when they are full. ARCH
is
active only when a databases redo log is used in ARCHIVELOG mode.
85. What is function of RECO ?
RECOver (RECO) is used to resolve distributed transactions that are pending due to a network or
system failure in a distributed database. At timed intervals,the local RECO attempts to connect to
remote databases and automatically complete the commit or rollback of the local portion of any
pending distributed transactions.
86. What is the function of Dispatcher (Dnnn) ?
Dispatcher (Dnnn) process is responsible for routing requests from connected user processes to
available shared server processes and returning the responses back to the appropriate user
processes.
87. How many Dispatcher Processes are created ?
Atleast one Dispatcher process is created for every communication protocol in use.
statistics for atleast one of the tables accessed by the SQL statement exist in the data dictionary.
Otherwise the OPTIMIZER chooses RULE_based approach.
105. What is the effect of setting the value ALL_ROWS for OPTIMIZER_GOAL parameter of
the ALTER
SESSION command ?
This value causes the optimizer to the cost-based approach for all SQL statements in the session
regardless of the presence of statistics and to optimize with a goal of best throughput.
106. What is the effect of setting the value FIRST_ROWS for OPTIMIZER_GOAL parameter
of the ALTER
SESSION command ?
This value causes the optimizer to use the cost-based approach for all SQL statements in the
session
regardless of the presence of statistics and to optimize with a goal of best response time.
107. What is the effect of setting the RULE for OPTIMIER_GOAL parameter of the ALTER
SESSION
Command ?
This value causes the optimizer to choose the rule-based approach for all SQL statements in a
session regardless of the presence of statistics.
108. What is RULE-based approach to optimization ?
Choosing an executing planbased on the access paths available and the ranks of these access
paths.
109. What is COST-based approach to optimization ?
Considering available access paths and determining the most efficient execution plan based on
statistics in the data dictionary for the tables accessed by the statement and their associated
clusters and indexes.
PROGRAMMATIC CONSTRUCTS
110. What are the different types of PL/SQL program units that can be defined and stored in
ORACLE
database ?
Procedures and Functions,Packages and Database Triggers.
111. What is a Procedure ?
A Procedure consist of a set of SQL and PL/SQL statements that are grouped together as a unit to
solve a specific problem or perform a set of related tasks.
112. What is difference between Procedures and Functions ?
A Function returns a value to the caller where as a Procedure does not.
113. What is a Package ?
A Package is a collection of related procedures, functions, variables and other package constructs
together as a unit in the database.
114. What are the advantages of having a Package ?
Increased functionality (for example,global package variables can be declared and used by any
proecdure in the package) and performance (for example all objects of the package are parsed
compiled, and loaded into memory once)
115. What is Database Trigger ?
A Database Trigger is procedure (set of SQL and PL/SQL statements) that is automatically
executed as
a result of an insert in,update to, or delete from a table.
116. What are the uses of Database Trigger ?
Database triggers can be used to automatic data generation, audit data modifications, enforce
complex Integrity constraints, and customize complex security authorizations.
117. What are the differences between Database Trigger and Integrity constraints ?
A declarative integrity constraint is a statement about the database that is always true. A
constraint applies to existing data in the table and any statement that manipulates the table.
A trigger does not apply to data loaded before the definition of the trigger, therefore, it does not
guarantee all data in a table conforms to the rules established by an associated trigger.
A trigger can be used to enforce transitional constraints where as a declarative integrity
constraint cannot be used.
DATABASE SECURITY
users session the CPU processing time available to a single call to ORACLE made by a SQL
statement
the amount of logical I/O available to the users session the amout of logical I/O available to a
single call to ORACLE made by a SQL statement the allowed amount of idle time for the users
session
the allowed amount of connect time for the users session.
125. What is Auditing ?
Monitoring of user access to aid in the investigation of database use.
126. What are the different Levels of Auditing ?
Statement Auditing, Privilege Auditing and Object Auditing.
127. What is Statement Auditing ?
Statement auditing is the auditing of the powerful system privileges without regard to specifically
named objects.
128. What is Privilege Auditing ?
Privilege auditing is the auditing of the use of powerful system privileges without regard to
specifically named objects.
129. What is Object Auditing ?
Object auditing is the auditing of accesses to specific schema objects without regard to user.
DISTRIBUTED PROCESSING AND DISTRIBUTED DATABASES
130. What is Distributed database ?
A distributed database is a network of databases managed by multiple database servers that
appears
to a user as single logical database. The data of all databases in the distributed database can be
simultaneously accessed and modified.
131. What is Two-Phase Commit ?
Two-phase commit is mechanism that guarantees a distributed transaction either commits on all
involved nodes or rolls back on all involved nodes to maintain data consistency across the global
distributed database. It has two phase, a Prepare Phase and a Commit Phase.
is open connections are limited only to those whose user accounts have been granted the
RESTRICTED
SESSION system privilege.
140. What are the different modes of mounting a Database with the Parallel Server ?
Exclusive Mode If the first instance that mounts a database does so in exclusive mode, only that
Instance can mount the database.
Parallel Mode If the first instance that mounts a database is started in parallel mode, other
instances that are started in parallel mode can also mount the database.
141. What is Full Backup ?
A full backup is an operating system backup of all data files, on-line redo log files and control
file that constitute ORACLE database and the parameter.
142. Can Full Backup be performed when the database is open ?
No.
143. What is Partial Backup ?
A Partial Backup is any operating system backup short of a full backup, taken while the database
is
open or shut down.
144.WhatisOn-lineRedoLog?
The On-line Redo Log is a set of tow or more on-line redo files that record all committed changes
made to the database. Whenever a transaction is committed, the corresponding redo entries
temporarily stores in redo log buffers of the SGA are written to an on-line redo log file by the
background process LGWR. The on-line redo log files are used in cyclical fashion.
145. What is Mirrored on-line Redo Log ?
A mirrored on-line redo log consists of copies of on-line redo log files physically located on
separate disks, changes made to one member of the group are made to all members.
146. What is Archived Redo Log ?
Archived Redo Log consists of Redo Log files that have archived before being reused.
147. What are the advantages of operating a database in ARCHIVELOG mode over operating it
in NO
ARCHIVELOG mode ?
Complete database recovery from disk failure is possible only in ARCHIVELOG mode.
Online database backup is possible only in ARCHIVELOG mode.
148. What is Log Switch ?
The point at which ORACLE ends writing to one online redo log file and begins writing to
another is
called a log switch.
149. What are the steps involved in Instance Recovery ?
R_olling forward to recover data that has not been recorded in data files, yet has been recorded in
the on-line redo log, including the contents of rollback segments.
Rolling back transactions that have been explicitly rolled back or have not been committed as
indicated by the rollback segments regenerated in step a.
Releasing any resources (locks) held by transactions in process at the time of the failure.
Resolving any pending distributed transactions undergoing a two-phase commit at the time of the
instance failure.
1. What is a Database instance ? Explain
A database instance (Server) is a set of memory structure and background processes that access a
set
of database files.
The process can be shared by all users.
The memory structure that are used to store most queried data from database. This helps up to
improve database performance by decreasing the amount of I/O performed against data file.
2. What is Parallel Server ?
Multiple instances accessing the same database (Only In Multi-CPU environments)
3. What is a Schema ?
The set of objects owned by user account is called the schema.
4. What is an Index ? How it is implemented in Oracle Database ?
An index is a database structure used by the server to have direct access of a row in a table.
An index is automatically created when a unique of primary key constraint clause is specified in
create table comman (Ver 7.0)
5. What is clusters ?
Group of tables physically stored together because they share common columns and are often
used
together is called Cluster.
6. What is a cluster Key ?
The related columns of the tables are called the cluster key. The cluster key is indexed using a
cluster index and its value is stored only once for multiple tables in the cluster.
7. What are the basic element of Base configuration of an oracle Database ?
It consists of
one or more data files.
one or more control files.
two or more redo log files.
The Database contains
multiple users/schemas
one or more rollback segments
one or more tablespaces
Data dictionary tables
User objects (table,indexes,views etc.,)
The server that access the database consists of
SGA (Database buffer, Dictionary Cache Buffers, Redo log buffers, Shared SQL pool)
SMON (System MONito)
PMON (Process MONitor)
LGWR (LoG Write)
DBWR (Data Base Write)
ARCH (ARCHiver)
CKPT (Check Point)
RECO
Dispatcher
User Process with associated PGS
8. What is a deadlock ? Explain.
Two processes wating to update the rows of a table which are locked by the other process then
deadlock arises.
In a database environment this will often happen because of not issuing proper row lock
commands.
Poor design of front-end application may cause this situation and the performance of server will
reduce drastically.
These locks will be released automatically when a commit/rollback operation performed or any
one of
20. How will you force database to use particular rollback segment ?
SET TRANSACTION USE ROLLBACK SEGMENT rbs_name.
21. What is meant by free extent ?
A free extent is a collection of continuous free blocks in tablespace. When a segment is dropped
its
extents are reallocated and are marked as free.
22. How free extents are managed in Ver 6.0 and Ver 7.0 ?
Free extents cannot be merged together in Ver 6.0.
Free extents are periodically coalesces with the neighboring free extent in
Ver 7.0
23.Which parameter in Storage clause will reduce no. of rows per block?
PCTFREE parameter
Row size also reduces no of rows per block.
24. What is the significance of having storage clause ?
We can plan the storage for a table as how much initial extents are required, how much can be
extended next, how much % should leave free for managing row updations etc.,
25. How does Space allocation table place within a block ?
Each block contains entries as follows
Fixied block header
Variable block header
Row Header,row date (multiple rows may exists)
PCTEREE (% of free space for row updation in future)
26. What is the role of PCTFREE parameter is Storage clause ?
This is used to reserve certain amount of space in a block for expansion of rows.
27. What is the OPTIMAL parameter ?
It is used to set the optimal length of a rollback segment.
28. What is the functionality of SYSTEM table space ?
To manage the database level transactions such as modifications of the data dictionary table that
record information about the free space usage.
29. How will you create multiple rollback segments in a database ?
Create a database which implicitly creates a SYSTEM Rollback Segment in a SYSTEM
tablespace.
Create a Second Rollback Segment name R0 in the SYSTEM tablespace.
Make new rollback segment available (After shutdown, modify init.ora file and Start database)
users.
58. What are the steps to switch a databases archiving mode between NO ARCHIVELOG and
ARCHIVELOG
mode ?
1. Shutdown the database instance.
2. Backup the database
3. Perform any operating system specific steps (optional)
4. Start up a new instance and mount but do not open the database.
5. Switch the databases archiving mode.
59. How can you enable automatic archiving ?
Shut the database
Backup the database
Modify/Include LOG_ARCHIVE_START_TRUE in init.ora file.
Start up the database.
60. How can we specify the Archived log file name format and destination ?
By setting the following values in init.ora file.
LOG_ARCHIVE_FORMAT = arch %S/s/T/tarc (%S Log sequence number and is zero left
paded, %s Log
sequence number not padded. %T Thread number lef-zero-paded and %t Thread number not
padded).
The file name created is arch 0001 are if %S is used.
LOG_ARCHIVE_DEST = path.
61. What is the use of ANALYZE command ?
To perform one of these function on an index, table, or cluster:
to collect statistics about object used by the optimizer and store them in the data dictionary.
to delete statistics about the object used by object from the data dictionary.
to validate the structure of the object.
to identify migrated and chained rows of the table or cluster.
MANAGING DISTRIBUTED DATABASES
62. How can we reduce the network traffic ?
Replication of data in distributed environment.
Using snapshots to replicate data.
Using remote procedure calls.
63. What is snapshots ?
Snapshot is an object used to dynamically replicate data between distribute database at specified
replication
Ans : D
2. We can create SNAPSHOTLOG for
[DBA] a] Simple snapshots, b] Complex snapshots, c] Both A & B, d]
Neither A nor B
Ans : A
3. Transactions per rollback segment is derived from
[DBA] a] Db_Block_Buffers, b] Processes, c] Shared_Pool_Size, d] None
of the above
Ans : B
4. ENQUEUE resources parameter information is derived from
[DBA] a] Processes or DDL_LOCKS and DML_LOCKS, b] LOG_BUFFER,
c] DB__BLOCK_SIZE..
Ans : A
5. LGWR process writes information into
a] Database files, b] Control files, c] Redolog files, d] All the
above.
Ans : C
6. SET TRANSACTION USE ROLLBACK SEGMENT is used to create user
objects
in a particular Tablespace
a] True, b] False
Ans : False
7. Databases overall structure is maintained in a file called
a] Redolog file, b] Data file, c] Control file, d] All of the
above.
Ans : C
8. These following parameters are optional in init.ora parameter file
DB_BLOCK_SIZE,
PROCESSES
a] True, b] False
Ans : False
9. Constraints cannot be exported through EXPORT command
a] True, b] False
Ans : False
10. It is very difficult to grant and manage common privileges needed by
different groups of
Ans
16. What is the difference between a LIST BOX and a COMBO BOX ?
a] In the list box, the user is restricted to selecting a value from a
list but in a combo box
the user can type in a value which is not in the list
b] A list box is a data entry area while a combo box can be used only
for control purposes
c] In a combo box, the user is restricted to selecting a value from a
list but in a list box the
user can type in a value which is not in the list
d] None of the above
Ans : A
17. In a CLIENT/SERVER environment , which of the following would not be
done at the client ?
a] User interface part, b] Data validation at entry line, c]
Responding to user events,
d] None of the above
Ans : D
18. Why is it better to use an INTEGRITY CONSTRAINT to validate data in a
table than to use a
STORED PROCEDURE ?
a] Because an integrity constraint is automatically checked while data
is inserted into or
updated in a table while a stored procedure has to be
specifically invoked
b] Because the stored procedure occupies more space in the database
than a integrity
constraint definition
c] Because a stored procedure creates more network traffic than a
integrity constraint
definition
Ans : A
19. Which of the following is not an advantage of a client/server model ?
a] A client/server model allows centralised control of data and
centralised implementation
of business rules.
b] A client/server model increases developer;s productivity