You are on page 1of 16

Friday, April 25, 2008

Database Resource Manager Interview Questions

What is a database resource manager?


Database resource manager allows us to create resource plans,which specify how much of our
resources should go to various consumer groups.We can group users based on their resource
requirement and we can have the database resource manager allocate a preset amount of resources to
these groups.We can easily prioritize our users and jobs.
What are the uses of a database resource manager?
1) The database resource manager enables us to limit the length of time a user session can stay idle
and to automatically terminate long-running SQL statements and user sessions.
2) Using the database resource manager we can set initial login priorities for various consumer groups
3) By using the concept of active session pool,we can specify the maximum number of concurrent
active sessions for a consumer group-the Database resource manager will automatically queue all the
subsequent requests until the currently running sessions complete.
Can we switch users between resource consumer groups/consumer groups?
DBA's can automatically switch users from one resource group to another ,based on preset resource
usage criteria,and can limit the amount of undo space a resource group can use.
What are the four elements of a Database resource Manager?
Database resource manager is composed of the following four elements : Resource consumer group,
resource plan,resource allocation method,resource plan directive.
What is a resource consumer group?
A resource consumer group is used to group together similar users based on their resource needs.
What is a resource plan?
The resource plan lays o how resource consumer groups are allocated resources. Each resource plan
contains a set of resource consumer groups that belong to this plan, together with instructions as to
how resources are to be allocated among these groups.
For instance,a resource plan may dictate CPU resources be allocated among three resource consumer
groups so that the first group gets 60 percent and the remaining two groups get 20 percent each of the
total CPU time.
What is a subplan?
A subplan is a part of the resource plan that enables the allocation of resources in greater detailamong
the resource consumer groups.
What is a resource allocation method?
The resource allocation method dictates the specific method we choose to use to allocate resources
like the CPU.The available methods of allocating the database resources are CPU method, Idle time,
Execution time limit,Undo pool,Active session pool,automatic consumer group switching,canelling SQL
and terminating sessions,parallel degree limit.
What is a CPU method?
Oracle uses multiple levels of CPU allocation to prioritize and allocate CPU usage among the competing
user sessions.It is a type of resource allocation method.
What is an idle time?
It is a type of resource allocation method.We can direct that a user's session be terminated after it has
been idle for a specified period of time.We can also specify that only idle sessions blocking other
sessions be terminated.
What is an execution time limit?
It is a type of resource allocation method.We can control resource usageby setting a limit on the
maximum execution time of an opration.
What is an undo pool?
It is a type of resource allocation method.By setting an undo pool directive,we can limit the total
amount of undos that can be generated by a consumer resource group.
What is an active session pool?
It is a type of resource allcation method. We can set a maximum allowable number of concurrent
sessions within any consumer resource group.All sessions that are beyond the maximum limit are
queued for execution after the freeing up of current active sessions.
What is an Automatic consumer group switching?
It is a type of resource allocation method.Using this method,we can specify that a user session be
automatically switched to a different group after it runs more than a specified number of seconds.The
group that the session should switch to is called as switch group,and the time limit is the switch
time.The session can revert to its original consumer group after e end of the top call,whih is defined as
an entire PL/SQL block or a seperate SQL statement.
What is cancelling SQL and terminating sessions?
It is a type of resource allocation method.By using CANCEL_SQL or KILL_SESSION as the switch
group,we can direct a long-running SQL sement or even an entire session to be cancelled or
terminated.
What is a Parallel Degree Limit?
It is a type of resource allocation method.We can use this method to specify the limit of the degree of
parallelism for an operation.
What is a resource plan directive?
It is an element of database resource manager.It links a resource plan to a specific resource consumer
group.

Tuesday, May 6, 2008


Oracle Database Vault

What is Oracle Database Vault?


Oracle Database Vault is a security solution from oracle corporation. It restricts access to certain areas
of the database.Even users with administrative privileges have restricted access.This fine-grained
access control protects the database from super-privileged users.
Where can we use Oracle Database Vault?
Oracle Database Vault can be used to protect standalone database instance,Oracle Real Application
Cluster(RAC).
What are the components of Oracle Database Vault?
Oracle Database Vault has the following components:
1) Oracle Database Vault Access Control Components
2) Oracle Database Vault Administrator (DVA)
3) Oracle Database Vault Configuration Assistant (DVCA)
4) Oracle Database Vault DVSYS and DVF Schemas
5) Oracle Database Vault PL/SQL Interfaces and Packages
6) Oracle Database Vault and Oracle Label Security PL/SQL APIs
7) Oracle Database Vault Reporting and Monitoring Tools
What is Oracle Database Vault Access Control Components made of ?
It is formed of the following components that helps us manage security for the database instance.They
are:
1)Realms
2)Command Rules
3) Factors
4) Rule sets
5) Security Application roles
What is a realm?
A realm is a functional grouping of database schemas,objects and roles that must be secured.After
grouping we can use realms to control the use of system privileges to specific accounts or roles. This
provides fine-grained access control.
What is a command rule?
A command rule is a special rule created to control how users can execute almost any SQL
statement.This includes SELECT,ALTER SYSTEM,DDL and DML statements.
Do command rules work alone?
No.They work with rule sets to determine whether or not a statement is allowed.
What is a factor?
A factor is a named variable or a attribute such as user location,database IP address,or session
user,which oracle database vault can recognize and secure.
What is the use of a factor?
We can use factors for activities such as authorizing database accounts to connect to the database or
creating filter logic to restrict the visibility and manageability of data.
What is an identity?
Each factor can have one or more identities.An identitiy is the actual value of a factor. A factor can
have several identities depending on the factor retrieval method or its identity mapping logic.
What is a rule set?
A rule set is a collection of one or more rules that we can associate with a realm authorization,
command rule, factor assignment, or secure application role.
What are the possible evaluations of a rule set?
The rule set evaluates to true or false based on the evaluation of each rule it contains and the
evaluation type (All True or Any True).
What is a rule within a rule set?
The rule within a rule set is a PL/SQL expression that evaluates to true or false.
Can rules be reused?
We can have the same rule in multiple rule sets.
What are secure application roles?
A secure application role is a special Oracle Database role that can be enabled based on the evaluation
of an Oracle Database Vault rule set.
What are the steps taken to secure database using Oracle database avult access control
component?
1) Create a realm composed of the database schemas or database objects that we want to secure. 2)
We can further secure the realm by creating rules, command rules, factors, identities, rule sets, and
secure application roles.
3) We can run reports on the activities these components monitor and protect.
What is a Oracle database vault administrator(DVA)?
Oracle Database Vault Administrator(DVA) is a Java application that is built on top of the Oracle
Database Vault PL/SQL application programming interfaces (API).
What is the use of DVA?
1) DVA allows security managers who may not be proficient in PL/SQL to configure the access control
policy through a user-friendly interface.
2) Oracle Database Vault Administrator provides an extensive collection of security-related reports that
assist in understanding the baseline security configuration.
3) These reports help to point out deviations from this baseline.
What is Oracle Database Vault Configuration Assistant (DVCA)?
It is a command-line utility that is used to perform maintenance tasks on Oracle Database Vault
Installation.
What are the Oracle Database Vault schemas?
Two major schemas of oracle database vault are DVSYS and DVF
Give details on DVSYS schema:-
DVSYS schema stores objects needed to process Oracle data for Oracle database vault.This schema
contains the roles,views,accounts,functions, and other database objects that the Oracle Database Vault
uses.
Give details on DVF schema:-
The DVF schema contains public functions to retrieve (at run time) the factor values set in the Oracle
Database Vault access control configuration.
Give details on Oracle Database Vault PL/SQL Interfaces and Packages :-
Oracle Database Vault PL/SQL Interfaces and Packages are collections that allow security
managers,application developers to configure security policy.The PL/SQL procedures and functions
allow general database accounts to operate within the boundaries of the access control policy in the
context of a given database session.

Thursday, June 12, 2008


Oracle Ultra Search

What is an Oracle Ultra Search?


Oracle Ultra Search is built on the Oracle Database and Oracle Text technology that provides uniform
search-and-location capabilities over multiple repositories such as,Oracle databases, other ODBC
compliant databases, IMAP mail servers, HTML documents served up by a Web server, files on disk, and
more.
What components constitute Oracle ultra search?
Oracle ultra search is made of the following components:
1) Oracle Ultra search crawler
2) Oracle Ultrasearch backend
3) Oracle Ultra search middle tier
What is an oracle ultrasearch crawler/give details on oracle ultra search crawler?
The Oracle Ultra Search crawler is a Java process activated by the Oracle server
based on a a set schedule.
When activated, the crawler spawns a configurable number of processor threads that fetch documents
from various data sources and index them using Oracle Text.
This index is used for querying.
Data sources can be Web sites,database tables, files, mailing lists, Oracle Application Server Portal
page groups, or user-defined data sources.
What is oracle ultra search backend?
The Oracle Ultra Search back end consists of an Oracle Ultra Search repository and Oracle Text. Oracle
Text provides text indexing and search capabilities required to index and query data retrieved from the
data sources. The back end indexes information from the crawler and serves up the query results.
What is oracle ultra search middle tier?
The Oracle Ultra Search middle tier components are Web applications. The middle tier includes the
Oracle Ultra Search administration tool, the APIs and the query applications.
How is middle tier deployed in various Oracle products?
In the Oracle Database release, the Oracle Ultra Search middle tier and back end can reside in the
same Oracle Home. However, in the OracleAS and Oracle Collaboration Suite releases, the middle tier
is located in a different Oracle Home.
What is oracle ultrasearch administration tool?
The administration tool is a J2EE-compliant Web application. We can use it to manage Oracle Ultra
Search instances and access it from the intranet.
What is a query reporting tool?
Oracle Ultra Search includes highly functional query applications to query and display search results.
The query applications are based on JSP and work with any JSP1.1 compliant engine.
Is query application same as Oracle administration tool?
The administration tool is independent from the Oracle Ultra Search query application. Therefore, the
administration tool and query application can be hosted on different computers to enhance security
and scalability.
What is an oracle ultra search APIs?
Oracle Ultra Search provides the following APIs:
1) The query API works with indexed data. The Java API does not impose any
HTML rendering elements. The application can completely customize the HTML interface.
2) The crawler agent API crawls and indexes proprietary document repositories.The e-mail Java API
accesses archived e-mails and is used by the query application to display e-mails. It can also be used to
build our own custom query application.
3) The URL rewriter API is used by the crawler to filter and rewrite extracted URL links before they are
inserted into the URL queue.
4) The Document Service crawler agent API enables generation of attribute data based on the
document contents. It accepts robot metatag instructions from the agent for the target document, and
it transforms the original document contents for indexing control.
What is an oracle ultrasearch instance?
An Ultra Search instance can be created to provide isolation for the data collections that have been
crawled.We can create a read-only snapshot of a master Oracle Ultra Search instance. This is useful for
query processing or for backup.We can also make a snapshot instance updatable. This is useful when
the master instance is corrupted and we want to use a snapshot as a new master instance.

Saturday, June 7, 2008


Oracle Warehouse Builder (OWB)

What is OWB?
Oracle Warehouse Builder (OWB) is an information integration tool that leverages the Oracle Database
to transform data into high-quality information. The Oracle Database is a central component in the
Warehouse Builder architecture because the Database hosts the Warehouse Builder repository and the
code generated by Warehouse Builder.
What are the major components of warehouse builder?
Oracle Warehouse Builder(OWB) is composed of Design centre,Control center manager,target
schema,Warehouse builder repository,Repository browser,control center service.
What is OMB Plus?
OMB plus is a flexible, high-level command line metadata access tool for Oracle
Warehouse Builder. We use OMB Plus to create, modify, delete, and retrieve object metadata in
Warehouse Builder design and runtime repositories.
What is the Scriping language used to manipulate OWB?
OMB Plus is a scripting language used to manipulate object and runtime repositories of OWB.OMB Plus
is an extension TCL Programming language and hence has variable constructs,looping and control
structures.
Where are the SQL scripts located in OWB?
OWB scripts are installed at \owb\rtp\sql and are used for managing deployment jobs,execution
jobs,control centers from SQL*PLUS.
How do you launch OMBPlus at Unix Prompt?
We can alunch OMB plus at the unix prompt using
OWB_HOME/owb/bin/unix/OMBPlus.sh
How do you connect to a OWB repository from OMB Plus?
From OMB Plus console enter the following :
OMBCONNECT repos/password@host:port:service_name USE WORKSPACE
wokspace_name

Friday, June 6, 2008


Oracle VM Interview Questions

What is Oracle VM?


Oracle VM is the latest virtualization technology from oracle. It is built upon the open source project
Xen.
What are the components that constitute Oracle VM?
Oracle VM is composed of Oracle VM Server ,the software component that is used for virtualization
provisioning and Oracle VM Manager a GUI tool used to control VM Server.
What is an Oracle VM Agent?
VM agent is a component of Oracle VM Server.It is the communication medium between the Oracle VM
manager and the Oracle VM Server.
What is dom0?
Dom0 refers to the Domain0 which is the refernce given to Oracle VM Server.
What is domu?
Domu refers to unprivileged domains.
What are the types of server pools?
There are three major types of server pools namely Master Server,Utility Server,Virtual Servers.

Friday, May 2, 2008


ASM (Automatic Storage Management/Manager) Interview Questions

What is ASM?
ASM is a Volume Manager and a file system for Oracle Database Files that supports single instance
Oracle Database and Oracle Real Application cluster (RAC) configuration.
What is the recommended storage management solution from Oracle?Why?
ASM is the recommended storage management solution from oracle as it provides an alternative to
conventional volume managers,file systems and raw devices.
How is datafile stored in ASM?
ASM uses disk groups to store data files.
What is an ASM disk group?
An ASM disk group is a group of disks that ASM manages as an unit.Within the diskgroups an file
system interface maintains the Oracle database files. ASM simplifies database storage by consolidating
disks into disk groups.This reduces I/O overhead.
How is the performance of disk group comparable to raw disks?/Are disk groups a good
alternative to raw disks?
The files distributed across the set of disks in a disk group are striped or distributed across the disks to
eliminate hot spots and improve performance.Thus they perform equally well as raw disks.
How does ASM eliminate downtime?
Disks can be added and removed from the disk groups online,(i.e)during the operation of the database
without any downtime. When disks are added or removed ASM automatically redistributes the contents
without any downtime.Thus ASM eliminates downtime.
Give details on server-based mirroring:-
This is a flexible option provided by ASM. The normal and redundant options of ASM provides two and
three way mirroring. We can use external option to enable RAID(Redundant Array Of Independent
Disks).
How does an ASM manage files?/How is the file management simplified using ASM?
ASM uses the Oracle Managed Files(OMF) feature which simplifies file management.Files are created at
specified location,renames files,deletes files when operations at tablespace level happens(say
tablespace deletion).
Give some interfaces used to manage ASM:-
Oracle Enterprise Manager(OEM),SQL*PLUS,ASMCMD command-line interface are some interfaces that
can be used with ASM.
Can ASM co-exist with non-ASM system:-
Yes,ASM can co-exist with non-ASM third-party file systems and thus can be integrated into pre-existing
environments.OEM has an interface for migrating non-ASM files to ASM.
What is an ASM instance?
An ASM instance is the instance that manages ASM disk groups. It composes of System Global
Area(SGA) and background processes. ASM instance mounts a disk group that is made available to the
database instance. An ASM instance manages the metadata of a disk group and provides file layout
information to the database instances.
Will the SGA(System Global Area) of ASM is comparable in size to an Oracle database
instance?
No.The SGA size of an ASM is smaller than that of an Oracle database instance,as an ASM performs
fewer tasks than a database.
Can ASM instance mount a database?
No.An ASM instance can mount a disk group that can be used by a database instance.
What is ASM metadata and where is it present?
ASM metadata is the information that ASM uses to control the disk group.It is present within a disk
group.
What is an ASM metadata composed of?
An ASM metadata includes the following:
1) The disks that belong to a disk group
2) Amount of space available within a disk group
3) The filenames of the files within a disk group
4) The location of disk group datafile data extents
5) A redo log that records information about automatically changing data blocks
What are the possible ASM configurations?
ASM and database instances share access to disks in a disk group.
1) There can be one ASM instance and one database instance serving single database in a node
2) There can be one ASM instance,multiple database instances serving many database in a node. If the
ASM instance fails,all the databases fails.The advantage is that this doesn't demand a Server
reboot(Operating system restart)
3) There can be clustered ASM instances that are clustered using Oracle Clusterware.(i.e)One ASM
instance on each node that are integrated using Oracle clusterware.
How does an ASM instance communicate with a database instance?
The ASM instance manages the metadata and provides space allocation for the ASM
files.When a database instance creates or opens an ASM file,it communicates those
requests to the ASM instance.In response the ASM instance provides the file extent map
information to the database instance

Friday, April 25, 2008


User Management and Database Security Interview Questions

What is database security?


The goal of database security is to prevent unauthorized use of database or its components.Database
security depends on system and network security.
What are the main aspects of Oracle database security management?
1) Controlling access to data(authorization)
2) Restricting access to legitimate users (authentication)
3) Ensuring accountability on part of the users(auditing)
4) Safeguarding key data in the database(encryption)
5) Managing the security of the entire organizational information structure (enterprise security)
What is a temporary tablespace?
All users need a temporary tablespace where they can perform operations such as sorting data during
SQL execution.
What is a default tablspace?
Users need to have a default tablespace, where their objects will be created if they don't explicitly
assign a different tablespace during object creation.
What are the two tablespaces created at database creation time in Oracle 10g database?
In Oracle database 10g at the time of database creation default temporary tablespace and default
permanent tablespace for all users will be created during database-creation process.Once these two
tablespaces are created,we don't have to specify them again during the database creation process.
What if we dont assign a specific tablespace as a default tablespace?
If we don't assign a default tablespace,the System tablespace becomes the default tablespace.
Why is it needed to create a default tablespace for every user?
If we dont assign a default tablespace System tablespace becomes the default tablespace. If a user
creates a very large object in the System tablespace,they might take up all the space in it and make it
impossible for the SYS superuser to create any new objects in it,causing the database to come to a
grinding halt.This is the main reason why we should always create a default tablespace for every user.
Give the statement to create a usr:-
SQL>CREATE USER (username) IDENTIFIED BY (password);
In case of Oracle database 11g use the following sattement:
SQL>CREATE USER (username) identified by "(password)";
The above query creates a user and password for the user. It is good practice to assign default
temporary and permanent tablespace to the users. It is a good practice to ass them at the time of
database creation.
How do we get the default tablespaces of a user?
The following query gives the default temporary and permanent tablespace for a user:
SQL>SELECT default_tablespace,temporary_tablespace from dba_users where
username='(username)';
Can a user created new connect to the database?
A new user can't connect directly to database,because the user doesn't have any privileges to do
so.When a user tries to connect he gets the following error at the SQL prompt:
ERROR:
Ora-01045: user lacks CREATE SESSION privilege; logon denied
How do we rectify the bove error/ORA:01045 error?
In order for a user to connect and start communicating with the database ,he must be granted CREATE
SESSION system privilege.The following statement is used:
SQL>GRANT CREATE SESSION to (username);
How to create a user with CONNECT system privilege?
SQL>GRANT CONNECT to (username) identified by (password);
Can a newly created user create database
objects(tables,indexes,views,synonyms,sequences etc) in a database?
No,a newly created user won't be able to create database objects directly.Even if the user is assigned
default temporary and permanent tablespace at the creation time,it is mandatory to allocate quota on
a tablespace to users.
How do you allocate quota on a tablespace to users?
The following command is used to allocate quota on a tablespace:
SQL>ALTER USER (username) QUOTA ON (tablespacename);
What is fine-grained access control?
It is a new security mechanism from Oracle that provides low-level data security.
What is the advantage of fine-grained access control?
Traditional access control techniques like granting roles,privileges,views are broad-based that resulted
in unnecessarily restricting users.As a solution Oracle came up with fine-grained access control where
control on data access is at low-level.
What are the mechanisms used in fine-grained access control?
Oracle uses two related mechanisms to enforce fine-grained security within the database.They are:
1) Application context
2) Fine-grained access control Policy
What is Virtual Private Database(VPD)?
This term is used to refer to the implementation of fine-grained-access-control policies using
application contexts.This offers security at row-level rather than table level.Each user of the application
can be limited to seeing only a part of the table's data by using VPD concept.This row-level security is
enforced by attaching a security policy directly to a database object such as,table,view or a synonym.It
provides a much stronger security than application level security.No matter whatever tool is
used(SQL*PLUS,adhoc query tool,report writer),the user can't elude this row-level security enforced by
the database server.
What are the uses of fine-grained access control?
We can use the fine-grained access control for the following purposes:
1) Enforce row-level access control through SELECT,INSERT,UPDATE and DELETE statements 2) Create a
security policy that controls access based on a certain value of a column
3) Create Policies that are applied the same way always as well as policies that dynamically change
during the execution of the query
4) Create sets of scurity policies,called policy groups
How does VPD enforce security?
VPD uses a type of query rewrite to restrict users to certain rows of tables and views. a security policy
is attached to the table or tables to which we want to control access,and stored procedures are written
to modify any relevant SQL statements made against the tables in the question.
For example,when a user issues an UPDATE statement against the table with such a security
policy,Oracle will dynamically append a predicate(a WHERE clause)to the user's statement to modify it
and limit the user's access to that table.
This will prevent users belonging to say SALES department from accessing and modifying FINANCE
department records.
UPDATE emp set salary=salary*10 will be modified as UPDATE emp set salary=salary*10
where dept='SALES';
What is needed to create a VPD?
To create a VPD,we have to create what is known as an application context and then implement fine-
grained access control to enforce the row-level security for database tables and views.The application
context helps us create security policiesthat draw upon certain aspects of a user's session
information.For example when an user logs into the database,the user ID identifies the user,and based
on that piece of information,the application's security policy sets limits on what the user can do within
the database.
VPD is simple an implementation of the application context with fine-grained access control.
To what statements can we apply VPD Policy?
VPD policy can be applied to SELECT,INSERT,UPDATE,INDEX and DELETE statements.
Give details on Application context:-
An application context allows us to define a set of application attributes,usually a set of session
environmental variables,that we can use to control an application's access to the database.Using
application attributes we can supply relevant predicate values for fine-grained access control policy.

Thursday, April 24, 2008


Performance Tuning Interview Questions

What are the major focuses of Performance tuning?


Performance tuning focuses primarily on writing efficient SQL, allocating appropriate computing
resources, and analyzing wait events and contention in a system.
How does Oracle aid performance tuning?
Oracle provides several options to aid performance tuning, such as partitoning lar tables, using
materialized views, storing plan outlines, using tools like Automatic Optimizer statistics collection
feature, ckages like DBMS_STATS, SQL Tuning Advisor to tune SQL statements,etc.
Why is performance tuning a menancing area for DBA's?
Like many other features of Oracle like exp/imp,backu recovery this field can't be automated. This is
one area that requires a lot of detective work on the part of application programmers and DBA's to see
w some process is running slower than expected, why can't we scale applications to a larger number of
users without problems like performance degradation etc.This is a area where our technical knowledge
must be used along with constant experimentation and observation.
What are the approaches towards performance tuning?
We can follow either a systematic approach or a reactive approach for performance tuning.
What is a systematic approach to performance tuning?
It is mandatory to design the database properly at initial stages to avoid potential problems. It is
mandatory to know the nature of application that a database is going to support. With a clear idea on
the application's nature database can be optimally created by allocating appropriate resources to avoid
problems when the application is moved to production. Most production moves cause problem because
of the scalability problems with the applications.So, oracle recommends to tune database at inception
stage. this is systematic approach to performance tuning.
What are the Oracle's suggestions towards systematic tuning?
Oracle suggests a specific design approach with the following steps.This is a top down approach:
1) Design the application correctly
2) Tune the application SQL code
3) Tune memory
4) Tune I/O
5) Tune contention and other issues
What are the effects of poor database design?
A poor database design results in poor application performance. We have to tune the application code
and some database resources such as memory,CPU,I/O owing to performance degradation. An
applications performs well in development and testing. Will there be any performance
problem when it is moved to production?
Production moves may cause problems due to scalability.We can't simulate the original load in test and
development. So problems may crop up at times as the application may be performing poor due to
scalability problems.
What is reactive performace tuning?
Performance tuning is an iterative process. We as a DBA may have to tune applications which is
designed and implemented in production.The performance tuning at htis stage is referred to as reactive
performance tuning.
Which is useful - systematic or reactive tuning?
The performance tuning steps to improve the performance of a database depends on the stage at
which we get the input and on the nature of the application. DBA's can assist the developers to write
optimal code that is scalable based on systematic approach. Mostly the real life problems that are
encountered after production moves have to be solved by reactive performance tuning.
We have an application whose code can't be changed.Can we improve its performance?
We can improve the application performance without changing base SQL code by optimizing the SQL
performance. Oracle has come up with SQL Advisor tool that helps SQL performance. We can make use
of SQL Advisor tools' SQL Profiles to improve performance,though we can't touch the
underlying SQL.
What is the use of SQL over procedural languages?
SQL isn't a procedural language in which we have to specify the steps to be followed to achieve the
statement goal.We don't have to specify how to accomplish a task(say data retrival) using SQL,rather
we can specify as to what needs to be done.
What is query processing?
When a user starts a data retrieval operation, the user's SQL statement goes through several
sequential steps that together constitute query processing.Query processing is the transformation of
the SQL statement into efficient execution plan to return the requested data from the database.
What is query optimization?
Query optimization is the process of choosing the most efficient execution plan.The goal is to achieve
the result with least cost in terms of resource usage.Resources include I/O and CPU usage on the server
where the database is running.This is a means to reduce the execution times of the query,which is the
sum of the execution times of the all component operations of the query.
What are the techniques used for query optimization?
Cost-based optimization, heuristic strategy are used for query optimization.
What are the phases of a SQL statement processing?
An user's SQL statement goes through the parsing,optimizing, and execution stages.If the SQL
statement is a query(SELECT),data has to be retrived so there's an additional fetch stage before
the SQL processing is complete.
What is Parsing?
Parsing primarily consists of checking the syntax and semantics of the SQL statements. The end
product of the parse stage of query compilation is the creation of a parse tree,which represents the
query structure.The parse tree is then sent to the logical query plan generation stage.
Mention the steps in the creation of a parse tree:-
1) The SQL statement is decomposed into relational algebra query that 's analyzed to see whether it's
syntactically correct.
2) The query then undergoes semantic checking.
3) The data dictionary is consulted to ensure that the tables and the individual columns that are
referenced in the query do exist,as well as all the object privileges.
4) The column types are checked to ensure that the data matches the column definition.
5) The statement is normalized so that it can be processed more efficiently
6) The query is rejected if it is incorrectly formulated
7) Once the parse tree passes all the syntactic and semantic checks,it is considered a valid parse
tree,and it's sent to the logical query plan generation stage.
Where does the parse tree generation take place?
The parse tree generation takes place in the library cahce portion of the SGA(system global Area).
What is Optimization/what happens during optimization phase?
During the optimization phase,Oracle uses its optimizer(CBO(cost-based optimizer)) to choose the best
access method for retriving data for the tables and indexes referred to in the query.
How does a CBO generate an optimal execution plan for the SQL statement?
Using the statistics we provide and the hints specified in the SQL queries, the CBO produces an optimal
execution plan for the SQL statement.
What are the parts of an optimizer phase?
An optimizer phase can be divided into two distinct parts: the query rewrite phase and the physical
execution plan generation phase.
What is query rewrite phase?
In this phase ,the parse tree is converted into an abstract logical query plan. This is an initial
pass at an actual query plan, and it contains only a general algebraic reformulation of the initial query.
The various nodes and branches of the parse tree are replaced by operators of relational algebra.
What is execution plan generation phase/physical execution plan execution plan generation
phase?
During this phase,Oracle transforms the logical query plan into a physical query plan.
The optimizer may be faced with a choice of several algorithms to solve a query. It needs to choose the
most efficient algorithm to answer a query,and it needs to determine the most efficient way to
implement the operations.The optimizer determines the order in which it will perform the steps.
What are the factors considered by a physical query/execution plan?
Following factors are considered by a physical query or an execution plan:
1) The various operations(eg:joins) to be performed during the query
2) The order in which the operations are performed
3) The algorithm to be used for performing each operation
4) The best way to retrieve data from disk or memory
5) The best way to pass data from one operation to another during the query
Which generates the query plan/what is generated by optimizer?
The optimizer generates several valid physical query plans.All the physical query plans are potential
execution plans.
How does the optimizer choose the query plan/what is cost-based query optimization?
The optimizer generates several physical query plans that are potential execution plans. The optimizer
then chooses among them by estimating the cost of each possible physical plan based on the table and
index statistics available to it,and selecting the plan with the lowest estimated cost. This evaluation of
the possible physical query plans is called cost-based query optimization.
What are the factors affecting the cost of a execution plan?
The cost of executing a plan is directly proportional to the amount of resources such as I/O,memory and
CPU necessary to execute the proposed plan.
What happens after choosing the low-cost physical query plan?
The optimizer passes the low-cost physical query plan to the Oracle's query execution engine.
What is a heuristic strategy?
The database uses a less systematic query optimiation technique known as the heuristic strategy.
What are unary and binary operations?
A join operation is called a binary operation, an operation like selection is called a unary operation.
What is an optimal operation processing strategy?
In general an optimal strategy is to perform unary operations first so the more complex and time-
consuming binary operations use smaller operands. Performing as many of the possible unary
operations first reduces the row sources of the join operations.
What are the heuristic-processing strategies?
1) Perform selection operation early so that we can eliminate a majority of the candidate rows early in
the operation. If we leave most rows in until the end, we're going to do needless comparisons with the
rows we're going to get rid of later
2) Perform projection operations early so that we limit the number of columns we have to deal with
3) If we need to perform consecutive join operation,perform the operations that produce the smaller
join first
4) Compute common expressions once and save the results
What is query execution?
During the final stage of a query processing, the optimized query(the physical query plan that has been
selected) is executed. If it's a SELECT statement the rows are returned to the user.If it's an
INSERT,UPDATE or DELETE statement ,the rows are modified. The SQL execution engine takes the
execution plan provided by the optimization phase and executes it.
What is the crucial step in SQL statement processing?
Of the three steps involved in the SQL statement processing, the optimization process is the crucial one
because it determines the all important question of how fast our data will be retrived.
What is the job of an optimizer?
The job of an optimizer is to find the optimal/best plan to execute our DML statements such as
SELECT,INSERT,UPDATE and DELETE.Oracle uses CBO to help determine efficient methods to execute
queries.
What is an index?
An index is a data structure that takes the value of one or more columns of a table(the key) and returns
all rows/requested-columns in a row quickly.
Why is an index efficient?
The efficiency of an index comes from the fact that it lets us find necessary rows without having to
scan all the rows of a table.They need a fewer disk I/O's than if we had to scan the table and hence are
efficient.
When do we need to index tables?
We need to index tables only when the queries will be selecting a small portion of the table.If our query
is retriving rows that are greater than 10 or 15 percent of the total rows in the table,we may not need
an index.
Why does an index traverses a table's row faster?
Indexes prevent a full table scan,so it is inherently a faster means to traverse a table's row.

Wednesday, April 23, 2008


RAC DBA Interview Questions

What is RAC?
RAC stands for Real Application cluster. It is a clustering solution from Oracle Corporation that ensures
high availability of databases by providing instance failover, media failover features.
Mention the Oracle RAC software components:-
Oracle RAC is composed of two or more database instances. They are composed of Memory structures
and background processes same as the single instance database.Oracle RAC instances use two
processes GES(Global Enqueue Service), GCS(Global Cache Service) that enable cache fusion.Oracle
RAC instances are composed of following background processes:
ACMS—Atomic Controlfile to Memory Service (ACMS)
GTX0-j—Global Transaction Process
LMON—Global Enqueue Service Monitor
LMD—Global Enqueue Service Daemon
LMS—Global Cache Service Process
LCK0—Instance Enqueue Process
RMSn—Oracle RAC Management Processes (RMSn)
RSMN—Remote Slave Monitor
What is GRD?
GRD stands for Global Resource Directory. The GES and GCS maintains records of the statuses of each
datafile and each cahed block using global resource directory.This process is referred to as cache fusion
and helps in data integrity.
Give Details on Cache Fusion:-
Oracle RAC is composed of two or more instances. When a block of data is read from datafile by an
instance within the cluster and another instance is in need of the same block,it is easy to get the block
image from the insatnce which has the block in its SGA rather than reading from the disk. To enable
inter instance communication Oracle RAC makes use of interconnects. The Global Enqueue
Service(GES) monitors and Instance enqueue process manages the cahce fusion. Give Details on
ACMS:-
ACMS stands for Atomic Controlfile Memory Service.In an Oracle RAC environment ACMS is an agent
that ensures a distributed SGA memory update(ie)SGA updates are globally committed on success or
globally aborted in event of a failure.
Give details on GTX0-j :-
The process provides transparent support for XA global transactions in a RAC environment.The
database autotunes the number of these processes based on the workload of XA global transactions.
Give details on LMON:-
This process monitors global enques and resources across the cluster and performs global enqueue
recovery operations.This is called as Global Enqueue Service Monitor.
Give details on LMD:-
This process is called as global enqueue service daemon. This process manages incoming remote
resource requests within each instance.
Give details on LMS:-
This process is called as Global Cache service process.This process maintains statuses of datafiles and
each cahed block by recording information in a Global Resource Dectory(GRD).This process also
controls the flow of messages to remote instances and manages global data block access and
transmits block images between the buffer caches of different instances.This processing is a part of
cache fusion feature.
Give details on LCK0:-
This process is called as Instance enqueue process.This process manages non-cache fusion resource
requests such as libry and row cache requests.
Give details on RMSn:-
This process is called as Oracle RAC management process.These pocesses perform managability tasks
for Oracle RAC.Tasks include creation of resources related Oracle RAC when new instances are added to
the cluster.
Give details on RSMN:-
This process is called as Remote Slave Monitor.This process manages background slave process
creation andd communication on remote instances. This is a background slave process.This process
performs tasks on behalf of a co-ordinating process running in another instance.
What components in RAC must reside in shared storage?
All datafiles, controlfiles, SPFIles, redo log files must reside on cluster-aware shred storage.
What is the significance of using cluster-aware shared storage in an Oracle RAC
environment?
All instances of an Oracle RAC can access all the datafiles,control files, SPFILE's, redolog files when
these files are hosted out of cluster-aware shared storage which are group of shared disks.
Give few examples for solutions that support cluster storage:-
ASM(automatic storage management),raw disk devices,network file system(NFS), OCFS2 and
OCFS(Oracle Cluster Fie systems).
What is an interconnect network?
an interconnect network is a private network that connects all of the servers in a cluster. The
interconnect network uses a switch/multiple switches that only the nodes in the cluster can access.
How can we configure the cluster interconnect?
Configure User Datagram Protocol(UDP) on Gigabit ethernet for cluster interconnect.On unia and linux
systems we use UDP and RDS(Reliable data socket) protocols to be used by Oracle
Clusterware.Windows clusters use the TCP protocol.
Can we use crossover cables with Oracle Clusterware interconnects?
No, crossover cables are not supported with Oracle Clusterware intercnects.
What is the use of cluster interconnect?
Cluster interconnect is used by the Cache fusion for inter instance communication.
How do users connect to database in an Oracle RAC environment?
Users can access a RAC database using a client/server configuration or through one or more middle
tiers ,with or without connection pooling.Users can use oracle services feature to connect to database.
What is the use of a service in Oracle RAC environemnt?
Applications should use the services feature to connect to the Oracle database.Services enable us to
define rules and characteristics to control how users and applications connect to database instances.
What are the characteriscs controlled by Oracle services feature?
The charateristics include a unique name, workload balancing and failover options,and high availability
characteristics.
Which enable the load balancing of applications in RAC?
Oracle Net Services enable the load balancing of application connections across all of the instances in
an Oracle RAC database.
What is a virtual IP address or VIP?
A virtl IP address or VIP is an alternate IP address that the client connectins use instead of the standard
public IP address. To configureVIP address, we need to reserve a spare IP address for each node, and
the IP addresses must use the same subnet as the public network.
What is the use of VIP?
If a node fails, then the node's VIP address fails over to another node on which the VIP address can
accept TCP connections but it cannot accept Oracle connections.
Give situations under which VIP address failover happens:-
VIP addresses failover happens when the node on which the VIP address runs fails, all interfaces for
the VIP address fails, all interfaces for the VIP address are disconnected from the network.
What is the significance of VIP address failover?
When a VIP address failover happens, Clients that attempt to connect to the VIP address receive a
rapid connection refused error .They don't have to wait for TCP connection timeout messages.
What are the administrative tools used for Oracle RAC environments?
Oracle RAC cluster can be administered as a single image using OEM(Enterprise
Manager),SQL*PLUS,Servercontrol(SRVCTL),clusterverificationutility(cvu),DBCA,NETCA
How do we verify that RAC instances are running?
Issue the following query from any one node connecting through SQL*PLUS.
$connect sys/sys as sysdba
SQL>select * from V$ACTIVE_INSTANCES;
The query gives the instance number under INST_NUMBER column,host_:instancename under
INST_NAME column.
What is FAN?
Fast application Notification as it abbreviates to FAN relates to the events related to instances,services
and nodes.This is a notification mechanism that Oracle RAc uses to notify other processes about the
configuration and service level information that includes service status changes such as,UP or DOWN
events.Applications can respond to FAN events and take immediate action.
Where can we apply FAN UP and DOWN events?
FAN UP and FAN DOWN events can be applied to instances,services and nodes.
State the use of FAN events in case of a cluster configuration change?
During times of cluster configuration changes,Oracle RAC high availability framework publishes a FAN
event immediately when a state change occurs in the cluster.So applications can receive FAN events
and react immediately.This prevents applications from polling database and detecting a problem after
such a state change.
Why should we have seperate homes for ASm instance?
It is a good practice to have ASM home seperate from the database hom(ORACLE_HOME).This helps in
upgrading and patching ASM and the Oracle database software independent of each other.Also,we can
deinstall the Oracle database software independent of the ASM instance.
What is the advantage of using ASM?
Having ASM is the Oracle recommended storage option for RAC databases as the ASM maximizes
performance by managing the storage configuration across the disks.ASM does this by distributing the
database file across all of the available storage within our cluster database environment.
What is rolling upgrade?
It is a new ASM feature from Database 11g.ASM instances in Oracle database 11g release(from 11.1)
can be upgraded or patched using rolling upgrade feature. This enables us to patch or upgrade ASM
nodes in a clustered environment without affecting database availability.During a rolling upgrade we
can maintain a functional cluster while one or more of the nodes in the cluster are running in different
software versions.
Can rolling upgrade be used to upgrade from 10g to 11g database?
No,it can be used only for Oracle database 11g releases(from 11.1).
State the initialization parameters that must have same value for every instance in an
Oracle RAC database:-
Some initialization parameters are critical at the database creation time and must have same
values.Their value must be specified in SPFILE or PFILE for every instance.The list of parameters that
must be identical on every instance are given below:
ACTIVE_INSTANCE_COUNT
ARCHIVE_LAG_TARGET
COMPATIBLE
CLUSTER_DATABASE
CLUSTER_DATABASE_INSTANCE
CONTROL_FILES
DB_BLOCK_SIZE
DB_DOMAIN
DB_FILES
DB_NAME
DB_RECOVERY_FILE_DEST
DB_RECOVERY_FILE_DEST_SIZE
DB_UNIQUE_NAME
INSTANCE_TYPE (RDBMS or ASM)
PARALLEL_MAX_SERVERS
REMOTE_LOGIN_PASSWORD_FILE
UNDO_MANAGEMENT
Can the DML_LOCKS and RESULT_CACHE_MAX_SIZE be identical on all instances?
These parameters can be identical on all instances only if these parameter values are set to zero.
What two parameters must be set at the time of starting up an ASM instance in a RAC
environment?The parameters CLUSTER_DATABASE and INSTANCE_TYPE must be set.
Mention the components of Oracle clusterware:-
Oracle clusterware is made up of components like voting disk and Oracle Cluster Registry(OCR). What
is a CRS resource?
Oracle clusterware is used to manage high-availability operations in a cluster.Anything that Oracle
Clusterware manages is known as a CRS resource.Some examples of CRS resources are database,an
instance,a service,a listener,a VIP address,an application process etc.
What is the use of OCR?
Oracle clusterware manages CRS resources based on the configuration information of CRS resources
stored in OCR(Oracle Cluster Registry).
How does a Oracle Clusterware manage CRS resources?
Oracle clusterware manages CRS resources based on the configuration information of CRS resources
stored in OCR(Oracle Cluster Registry).
Name some Oracle clusterware tools and their uses?
OIFCFG - allocating and deallocating network interfaces
OCRCONFIG - Command-line tool for managing Oracle Cluster Registry
OCRDUMP - Identify the interconnect being used
CVU - Cluster verification utility to get status of CRS resources
What are the modes of deleting instances from ORacle Real Application cluster Databases?
We can delete instances using silent mode or interactive mode using DBCA(Database Configuration
Assistant).
How do we remove ASM from a Oracle RAC environment?
We need to stop and delete the instance in the node first in interactive or silent mode.After that asm
can be removed using srvctl tool as follows:
srvctl stop asm -n node_name
srvctl remove asm -n node_name
We can verify if ASM has been removed by issuing the following command:
srvctl config asm -n node_name
How do we verify that an instance has been removed from OCR after deleting an instance?
Issue the following srvctl command:
srvctl config database -d database_name
cd CRS_HOME/bin
./crs_stat
How do we verify an existing current backup of OCR?
We can verify the current backup of OCR using the following command : ocrconfig -showbackup
What are the performance views in an Oracle RAC environment?
We have v$ views that are instance specific. In addition we have GV$ views called as global views that
has an INST_ID column of numeric data type.GV$ views obtain information from individual V$ views.
What are the types of connection load-balancing?
There are two types of connection load-balancing:server-side load balancing and client-side load
balancing.
What is the differnece between server-side and client-side connection load balancing?
Client-side balancing happens at client side where load balancing is done using listener.In case of
server-side load balancing listener uses a load-balancing advisory to redirect connections to the
instance providing best service.
Give the usage of srvctl:-
srvctl start instance -d db_name -i "inst_name_list" [-o start_options]srvctl stop instance -d name -i
"inst_name_list" [-o stop_options]srvctl stop instance -d orcl -i "orcl3,orcl4" -o immediatesrvctl start
database -d name [-o start_options]srvctl stop database -d name [-o stop_options]srvctl start database
-d orcl -o mount

Thursday, June 12, 2008


SAN ( Storage Area Network )

What is a SAN ?
A storage area network (SAN) is a specialized high-speed network of storage devices and computer
systems (also referred to as servers, hosts, or host servers).
Currently,most SANs use the Fibre Channel protocol.
A storage area network presents shared pools of storage devices to multiple servers.
Each server can access the storage as if it were directly attached to that server. The SAN makes it
possible to move data between various storage devices, share data between multiple servers, and back
up and restore data rapidly and efficiently.
In addition, a properly configured SAN provides robust security, which facilitates both disaster recovery
and business continuance.
Components of a SAN can be grouped closely together in a single room or connected over long
distances.
This makes SAN a feasible solution for businesses of any size: the SAN can grow easily with the
business it supports.

What are the components of SAN(storage area network)?/List the SAN (storage area
network)Components:-
SAN(storage area network)is made of the following components :
1. SAN Switches
2. Fabric
3. Connections:HBA(Host Bus Adapters and Controllers)

SAN Switches :
Specialized switches called SAN switches are at the heart of the typical SAN. Switches provide
capabilities to match the number of host SAN connections to the number of connections provided by
the storage array.Switches also provide path redundancy in the event of a path failure from host server
to switch or from storage array to switch.

Fabric :
When one or more SAN switches are connected, a fabric is created.
The fabric is the actual network portion of the SAN. A special communications
protocol called Fibre Channel (FC) is used to communicate over the entire
network. Multiple fabrics may be interconnected in a single SAN, and even for a simple SAN it is not
unusual to be composed of two fabrics for redundancy.

Connections: HBA and Controllers :


Host servers and storage systems are connected to the SAN fabric through ports in the fabric. A host
connects to a fabric port through a Host Bus Adapter (HBA), and the storage devices connect to fabric
ports through their controllers.

Are servers homogenous in SAN environment?


No.Servers need not be homogenous in SAN environment.Each server may host numerous applications
that require dedicated storage for applications processing.

How does a SAN(storage area network) work?


The SAN (storage area network) components interact as follows:
1. When a host wishes to access a storage device on the SAN, it sends out a blockbased access request
for the storage device.
2. The request is accepted by the HBA for that host and is converted from its binary data form to the
optical form required for transmission on the fiber optic cable.
3. At the same time, the request is “packaged” according to the rules of the Fibre Channel protocol.
4. The HBA transmits the request to the SAN.
5. Depending on which port is used by the HBA to connect to the fabric, one of the SAN switches
receives the request and checks which storage device the host
wants to access.From the host perspective, this appears to be a specific disk, but it is actually just a
logical device that corresponds to some physical device on the SAN. It is up to the switch to determine
which physical device has been made available to the host for its targeted logical device.
6. Once the switch has determined the appropriate physical device, it passes the request to the
appropriate storage device.

What is a fibre channel protocol(FCP)?


Fibre Channel Protocol (FCP) is a transport protocol (similar to TCP used in IP networks) which
predominantly transports SCSI(small computer system interface) commands over Fibre Channel
networks.

What are the various layers of fibre channel protocol/fibre channel?


Fibre Channel is a layered protocol. It consists of 5 layers, namely:
1. FC0 The physical layer, which includes cables, fiber optics, connectors,pinouts etc.
2. FC1 The data link layer, which implements the 8b/10b encoding and decoding of signals.
3. FC2 The network layer, defined by the FC-PI-2 standard, consists of the core of Fibre Channel, and
defines the main protocols.
4. FC3 The common services layer, a thin layer that could eventually implement functions like
encryption or RAID.
5. FC4 The Protocol Mapping layer. Layer in which other protocols, such as SCSI, are encapsulated into
an information unit for delivery to FC2.
What is FC-PH?
FC0, FC1, and FC2 are also known as FC-PH, the physical layers of fibre channel. Where does the
fiber channel router operate?
Fibre Channel routers operate up to FC4 level (i.e. they are in fact SCSI routers), switches up to FC2,
and hubs on FC0 only.
What are the various speed at which we use fibre channel products?
Fibre Channel products are available at 1 Gbit/s, 2 Gbit/s, 4 Gbit/s, 8 Gbit/s, 10 Gbit/s and 20 Gbit/s.
Products based on the 1, 2, 4 and 8 Gbit/s standards should be interoperable, and backward
compatible. The 10 Gbit/s standard (and 20 Gbit/s derivative), however, is not backward compatible
with any of the slower speed devices, as it differs considerably on FC1 level (64b/66b encoding instead
of 8b/10b encoding). 10Gb and 20Gb Fibre Channel is primarily deployed as a high-speed "stacking"
interconnect to link multiple switches.
What is an iFCP?
iFCP (Internet Fibre Channel Protocol) is an emerging standard for extending Fibre channel storage
networks across the Internet. iFCP provides a means of passing data to and from Fibre Channel storage
devices in a local storage area network (SAN) or on the Internet using TCP/IP. TCP provides congestion
control as well as error detection and recovery services. iFCP merges existing SCSI and Fibre Channel
networks into the Internet. iFCP can either replace or be used in conjunction with existing Fibre Channel
protocols, such as FCIP(Fibre Channel over IP).
Why is iFCP superior to FCIP?
iFCP addresses some problems that FCIP does not. For example, FCIP is a tunneling protocol that simply
encapsulates Fibre Channel data and forwards it over a TCP/IP network as an extension of the existing
Fibre Channel network. However, FCIP is only equipped to work within the Fibre Channel environment,
while the storage industry trend is increasingly towards the Internet-based storage area network.
Because iFCP gateways can either replace or complement existing Fibre Channel fabrics, iFCP can be
used to facilitate migration from a Fibre Channel SAN to an IP SAN or a hybrid network.