**ORACLE 10g DB
Que:- What is the characteristic of RDBMS?
Ans:-
Characteristics
of RDBMS Model: -
- It is based on set theory.
- A query is a data retrieval utility allows data manipulation and tables.
- Each table is independent entity and there is no relationship between tables.
- User interface is non procedure DML, since what needs to be done is specified.
- Eliminates parent chain relationship and represents data in database as simple row, column tables of data values.
- Rows of the database tables are called tuple and columns are called attributes.
Que:- Why ORACLE is RDBMS?
Ans:-
ORACLE is RDBMS because there are certain
rules to make up a relational data base management system, oracle follows it
and so it’s an RDBMS.
Que:- What is characteristic of SQL?
Ans:-
SQL enables end
user and system persons to deal with a number of database management systems
where it is available.Applications
written in SQL can be easily ported across systems. Such porting could be
required when the underlying DBMS needs to Upgraded because of change in
transaction volumes or when a system developed in one environment is to be used
on another.SQL as a language
is independent of the way it is implanted internally. A query returns the same
result regardless of whether optimizing Has been done with indexes or not. This
is because SQL specifies what is required and not how it is to be done. The language
while being simple and easy to learn can cope with complex situations. The results to be
expected are well defined in SQL.
Que:- What is DATA, DB, DBMS and RDBMS?
Ans:-
DATA: - The term
data means groups of information that represent the qualitative or quantitative
attributes of a variable or set of variables.
DB: - Databases
consist of software-based "containers" that are structured to collect
and store information so users can retrieve, add, update or remove such
information in an automatic fashion. Database programs are designed for users
so that they can add or delete any information needed. The structure of a
database is tabular, consisting of rows and columns of information.
RDBMS: - A
relational database management system (RDBMS) is a database management system(DBMS) that is based on the relational model as introduced by E. F. Codd.
Que:-
Find out the .env file for SQL to execute for Scott and new Scott?
Ans:-
That is glogin in
oracle database.
Que:-How
will you see date along with time?
Ans:-
we use a timestamp datatype or
Select
localtimestamp from dual;
select
to_char(sysdate,'YYYY-MM-DD HH:MI:SS') from dual;
Que:-
Find out way so that if a new user is created when create session is
automatically assign?
Ans:-
Que:-
What is an Oracle Instance?
Ans:-
The oracle
background process along with SGA is called ORACLE instance.
The Oracle
Process can be divided into 2 processes:
1) User Process.
2) Oracle
Process.
Oracle process
can be further divided into 2 sub processes:
1) Server
Process. 2) Background Process.
1) Server
process: They perform the work for user processes. In a dedicated server
process one server process is allocated for each user process. In Multi threaded
server configuration few shared server process take care of all user processes.
2) Background
Processes: Background process maintains relation between Oracle memory area and
the physical structure.
Oracle memory
area is also called as the System global area (SGA).The physical structure
consist of (data file, log file and the control file).There are many
background processes as described below:
2) Process
Monitor (PMON): This process performs the process recovery when a user process
fails. It is responsible to make the resources free which the failed process
was holding. When the process is killed or it fails PMON releases the lock from
the resources it was holding and makes the them free for the users.
3) Queue Monitor
(QMN): It is used to monitor the messages queues for the Advanced Queuing. It
is an optional background process.
4) Database
Writer (DBWn): This process writes the modified blocks to the buffer cache
using the (Least Used Algorithm).It writes in batches instead of writing for
every command. There are DBW0, DBW1--DBW9 to boost the system performance.
DB_WRITER_PROCESSES parameter specifies the number of DBWn processes.
5) Log Writer
(LGWR): This process writes the redo log entries to the redo buffer to the
online redo log files. These online redo log files are written in the
sequential manner unlike the data files which are written in the random manner.
6) Checkpoint
Process: At some point of time the DBWn writes all the blocks in the cache to
the data file. At this point the log files and the control files are updated to
reflect the recent change. This event is called as the checkpoint and the
process which takes care of this is called as the checkpoint process. A
checkpoint also occurs for the online redo log files and can be set through
LOG_CHECKPOINT_INTERVALS for more frequent checkpoints to save the amount of
time needed forrecovery.
7) Archiver
Process (ARCn): This process is active only when the database is running in the
Archive log mode and automatic archiving mode is enabled. As the LGWR writes,
and the log file is filled and if the database is running in the Archive log
mode then the previous log file is written to the Archive destination which is
specified in the parameter file.
8 ) Recover
Process (RECO): This process is only created in the distributed database option
to resolve the failed transaction due to system or network failure. To create
this process we can use the DISTRIBURED_TRANSACTIONS parameter.
9) Lock Process
(LCKn): This process is used only is the oracle parallel server process is
used. This process is used for inter instance locking. It is an optional
process.
10) Job Queue
Process (SNPn): This processes are used to automatically refresh the table
snapshots in distributed configuration. These processes also execute the job
requests submitted by the DBMS_JOB package. SYSTEM GLOBAL AREA (SGA): It is a
memory area allocated by the oracle.All the memory structures that resides in
the SGA are shared by the concurrent users connected to that instance. Hence
SGA is often called as the shared global area.
Que:-
What information is stored in Control File?
Ans:-
Every Oracle
database has a control file. A control file is a small binary file that records
the physical structure of the database The control files include information
about the physical structure of the database, such asdatabase name, names and
locations of datafiles and redo log files and time stamp of database creation, tablespace information, datafile offline ranges, log history, archived log
information,backup set and backup piece information, backup datafile and redo
log information, datafile copy information, the current log sequence number and
checkpoint information. The database name is taken from either the name
specified by the DB_NAME initialization parameter or the name used in the
CREATE DATABASE statement. Each time that a datafile or a redo log file is
added to, renamed in, or dropped from DB, a tablespace is created or dropped
from DB, the control file is updated to reflect this physical structure change.
Therefore, if you make a change to the physical structure of your database
(using ALTER DATABASE statements), then you should immediately make a backup of
your control file.
Que:-
When you start an Oracle DB which file is accessed first?
Ans:-
When you issue
the startup command, the first thing the database will do is enter the nomount
stage. During the nomount stage, Oracle first opens and reads the
initialization parameter file (init.ora) to see how the database is configured.
For example, the sizes of all of the memory areas in Oracle are defined within
the parameter file. After the parameter file is accessed, the memory areas
associated with the database instance are allocated. Also, during the nomount
stage, the Oracle background processes are started. Together, we call these
processes and the associated allocated memory the Oracle instance. Once the
instance has started successfully, the database is considered to be in the
nomount stage. If you issue the startup command, then Oracle will automatically
move onto the next stage of the startup, the mount stage.
Que:-
What is the Job of SMON, PMON processes?
Ans:-
System Monitor
(SMON): This process performs system or crash recovery when a failed instance
is starts again. In the parallel server option the SMON process of one instance
can perform recovery for other instance that has failed. It basically cleans up
the temporary segments that are no longer needed and also recovers the dead
transactions skipped during the crash and instance recovery because of file
read or offline error. SMON also deletes the free extents within the database
to make the free space continuous and easy to allocate.
Process Monitor
(PMON): This process performs the process recovery when a user process fails.
It is responsible to make the resources free which the failed process was
holding. When the process is killed or it fails PMON releases the lock from the
resources it was holding and makes the them free for the users.
Que:-
What is Instance Recovery?
Ans:-
Oracle performs
instance recovery when the database is restarted due to instance failure or
shutdown the database with ABORT option(shutdown abort) or startup the database
with FORCE option(startup force). Instance recovery is taken care by SMON oracle
background process automatically. Instance recovery consists of two steps. One
is Roll forward, next is Roll backward.
Roll forward:
Changes being
made to the database are recorded in the database buffer cache and buffer cache
will be written into data files. At the same time, the changes are recorded in
redo log buffer and redo log buffer will be written to redo log file. Oracle
writes the data from database buffer cache to data file only when there is enough data in data buffer cache. It is not necessary that, every commit,
oracle writes the data buffer cache into data file. When instance fails before
committed data are written into data files, Oracle uses the data recorded in
the online redo log files to recover the lost data when the associated database
is re-started. This process is called Roll forward or cache recovery.
Roll backward:
When we make any
changes in the database, the old image will be written into undo segment. Later
undo segment will be used to rollback the data when we rollback the
transaction. DBWR writes the buffer cache content into data file under
different circumstances. It might be possible to write the uncommitted data
from database buffer cache into data file. When instance fails and associated
database is restarted, it rollback the uncommitted transaction in data file by
using undo segment to maintain the read consistency. This is called roll
forward or transaction recovery.
Que:-
What is written in Redo Log Files?
Ans:-
Log Writer
(LGWR): This process writes the redo log entries to the redo buffer to the
online redo log files. These online redo log files are written in the
sequential manner unlike the data files which are written in the random manner.
Que:- what do you
mean by framwork.Give five example?
Ans:-
A framework is a
collection of classes and applications, libraries of SDKs and APIs to help the different
components all work together.AND a fram work is a basic conceptual
structure used to solve or address complex issues,usually a set of tools,
materials or components.
Especially in a software context the word is used as a name for different kind of toolsets,
component bases, then became a kind of buzzword or fashionable keyword.
EXAMPLE:-
1.Compilers for
different programming languages and target machines.
2.Financial
modeling applications.
3.Earth system
modeling applications.
4.Decision
support systems.
5.Web
applications.
6.Middleware.
Que:- Explain why
and how ORACLE 10g has grid facility and what is the benifit of gride?
Ans:-
Grid computing
enables groups of networked computers to be pooled and provisioned on demand to meet the changing
needs of business.Instead of dedicated servers and storage for each application, grid
computing enables multiple applications to share computing infrastructure, resulting in much
greater flexibility, cost, power efficiency, performance, scalability and availability, all
at the same time. Scale out
computing capacity on demand in smaller units, instead of buying oversized
systems for peak periods
or uncertain growth.Remove unneeded or failed machines without interruptions in service,
saving cost and ensuring business continuity. Manage all your systems end-to-end with integrated
and automated administration and monitoring.Oracle offers the most complete and field-proven
portfolio of industry leading grid computing solutions, from the Web tier all the way down
to middleware, database, servers and storage.
Benifits of Gride
Better look of
information
Faster response
to changing business priorities
Reduced IT coast
Que:- what is
N-tyre architecture?
Ans:-
Usually N-Tier
Architecture begins as a 3-Tier model and is expanded. It provides finer granularity.
Granularity is the ability of a system, in this case, an application, to be broken down into
smaller components or granules. The finer the granularity, the greater the flexibility
of a system. It can also be referred to as a systems’s modularity. Therefore, it refers to the
pulling apart of an application into separate layers or finer grains. One of the best
examples of N-Tier Architecture in web applications is the popular shopping-cart web
application. The client tier interacts with the user through GUIs (Graphic User Interfaces)
and with the application and the application server. In web applications, this client tier
is a web browser. In addition to initiating the request, the web browser also receives and
displays code in dynamic HTML (Hypertext Markup Language), the primary language of the
World Wide Web. In a shopping cart web application, the presentation tier displays
information related to such services as browsing merchandise, purchasing, and shopping cart
contents. It communicates with other tiers by outputting results to the browser client tier and
all other tiers in the network. This layer calls custom tags throughout the network and to
other networks. It also calls database stored procedures and web services, all in the goal of
providing a more sophisticated response. This layer glues the whole application
together and allows different nodes to communicate with each other and be displayed to the
user through the browser. It is located in the application server.
Que:- what is the
benifit of sqlplus /nolog?
Ans:-
The benifit of
this sentex we enter in a ORACLE secure and nobudy can't see my passwd in
the command of ps
-aef|grep sqlplus.
Que:-send an
email from an SQL prompt?
Ans:-
Que:- what do you
mean performance testing OR load testing OR stress testing OR regression
testing?
Ans:-
PERFORMANCE:- Software
performance testing is used to determine the speed or effectiveness of a computer, network,
software program or device. This process can involve quantitative tests done in a lab, such as measuring the response time or the number of MIPS (millions of instructions per
second) at which a system functions.
LOAD:- Load
testing is the process of putting demand on a system or device and measuring
its response. The
term load testing is used in different ways in the professional software testing
community. Load testing generally refers to the practice of modeling the
expected usage of a
software program by simulating multiple users accessing the program
concurrently.
STRESS:- Stress
testing is a form of testing that is used to determine the stability of a given system or
entity. It involves testing beyond normal operational capacity, often to a breaking point,
in order to observe the results.
REGRESSION:- Any
time you modify an implementation within a program, you should also do regression
testing. You can do so by rerunning existing tests against the modified code to determine whether
the changes break anything that worked prior to the change and by writing new tests where
necessary. Adequate coverage without wasting time should be a primary consideration
when conducting regression tests.
Que:- How to Take
a backup with RMAN, datagard tool?
Ans:-
RMAN
Configure for
multiple archiver processes
SELECT value FROM
gv$parameter WHERE name = 'log_archive_max_processes';
ALTER SYSTEM SET
log_archive_max_processes=3;
SELECT log_mode
FROM v$database;
SHUTDOWN;
STARTUP MOUNT
EXCLUSIVE;
ALTER DATABASE
ARCHIVELOG;
ALTER DATABASE
OPEN;
SELECT log_mode
FROM v$database;
SHUTDOWN;
After configure
this you have to logout from database and start RMAN
rman TARGET /
STARTUP MOUNT;
REPORT SCHEMA;
BACKUP DATABASE;
LIST BACKUP;
LIST COPY;
VALIDATE BACKUPSET
3;
SHUTDOWN
immediate;
Restore and
recovere database files;
And restart RMAN
with TARGET
rman TARGET /
restore database;
recover database;
alter database
show all
Que:- what is the
situation error when we use startup force?
Ans:-
In unusual circumstances,
you might experience problems when attempting to
start a database instance. You should not force a database to start
unless you are faced with the following: You cannot shut
down the current instance with the SHUTDOWN NORMAL, SHUTDOWN
IMMEDIATE, or SHUTDOWN TRANSACTIONAL commands. If one of these
situations arises, you can usually solve the problem by starting a new instance (and optionally mounting and opening the
database) using the STARTUP command with the FORCE option:
STARTUP FORCE
If an instance is
running, STARTUP FORCE shuts it down with mode ABORT before
restarting it.
Ans:-
This is a
catchall internal error message for Oracle program exceptions. It
indicates that a process has met a low-level, unexpected
condition. Various causes of this message include:
- time-outs
- file corruption
- failed data checks in memory
- hardware, memory, or I/O errors
- incorrectly restored files
Que:- what is
diff between undo and temp tablespace?
Ans:-
Temporary
tablespaces:
Temporary
tablespaces are logical units within an Oracle database that are used for sort
operations. When you join two
large tables, or when you are sorting a table by using the ORDER by clause,
Oracle uses the
temporary tablespace if in memory sort (area specified by SORT_AREA_SIZE or
within the PGA) is not possible
due to insufficient memory allocation.It is important to note that TEMPORARY
TABLESPACES have volatile or
non-persistent data. You don’t need to include temporary tablespaces in your
backup policy and can just
create them after you have performed a recovery.
Undo tablespaces:
Undo tablespaces
contain before image of data, that can be used to rollback a particular transaction. Broadly, undo
tablespaces are used for Roll back
transactions when a ROLLBACK statement is issued Recover the
database Provide read
consistency Analyze data as
of an earlier point in time by using Flashback Query Recover from
logical corruptions using Flashback features.
Que:- what is
recursive SQL?
Ans:-
When you issue a
SQL statement, the database must determine many things before it can even start executing that SQL statement. If you query a
table, do you have permissions to access that table? Does that table even
exist? Which tablespace holds that table? Oracle needs
answers to these questions and more. One of the things
that Oracle is really good at is processing SQL statements. So if Oracle needs
to find out if a table exists, Oracle will issue
a SQL statement against the Data Dictionary to answer that question. This is similar to you querying DBA_TABLES to determine if
the table exists. All of the SQL that Oracle issues behind the scenes on your
behalf is called "recursive SQL." Some of the
recursive SQL statements will require other questions to be asked, which spawns
a new level of recursive SQL.
If Oracle finds a
problem with your SQL statement, like the table does not exist, then Oracle
will raise an error (ORA-00942). If Oracle does not
find any problem, then your SQL statement will be executed. Executing your SQL
statement may require additional recursive SQL
statements.
Que:- what is
Bitmap Index in oracle?
Ans:-
A bitmap index is
a type of index that uses a string of bits to quickly locate rows in a table.
Bitmap indexes are normally used to index low
cardinality columns in a warehouse environment.
CREATE BITMAP
INDEX emp_bitmap_idx ON big_emp(sex);
OR
CREATE BITMAP
INDEX emp_dept_loc ON emp(dept.loc)
FROM emp, dept
WHERE emp.deptno
= dept.deptno
TABLESPACE
index_ts1;
Que:- Install
ORACLE with Hindi character set?
Ans:-
IN8ISCII Multiple-Script Indian Standard 8-bit
Latin/Indian
Que:- Create
table with LOB datatype insert and select sum LOB data?
Ans:-
DONE in the '/export/home/oracle/image'
directory.
Que:- What is BEQ
protocol in unix?
Ans:-
The BEQ Protocol
Adapter, is both a communications mechanism and a process spawning mechanism. If a
service name is not specified, either directly by the user on the command line or the login
screen, or indirectly through an environment variable such as TWO_TASK, then the BEQ
Protocol Adapter will be used. In which case, a dedicated server will always be used, and the
multi-threaded server will never be used. This dedicated server is started automatically by
the BEQ Protocol Adapter, which waits for the server process to start and attach to an
existing SGA. If the startup of the server process is successful, the BEQ Protocol Adapter
then provides inter-process communication via UNIX pipes.
Que:- What should
be the TEN quality of network?
Ans:-
1.SECURITY 2.Transparency
3.DATA
INTEGRITY
4.ENCAPSULATION,DECAPSULATION
5.SPEED 6.ACCESSABILITY (anywhere)
7.CONNECTIVITY 8.AWARENESS (prevent other)
9.NETWORK
MAP 10.SHARING NETWORK
Que:- What are
dead locks in oracle?
Ans:-
A deadlock occurs
when two or more threads of control are blocked, each waiting on a resource held by
the other thread. When this happens, there is no possibility of the threads ever making
forward progress unless some outside agent takes action to break the deadlock.
For example, if
Txn A is blocked by Txn B at the same time Txn B is blocked by Txn A then the threads of
control containing Txn A and Txn B are deadlocked; neither thread can make any forward
progress because neither thread will ever release the lock that is blocking the other thread. When two threads
of control deadlock, the only solution is to have a mechanism external to the two threads
capable of recognizing the deadlock and notifying at least one thread that it is in a
deadlock situation. Once notified, a thread of control must abandon the
attempted operation in
order to resolve the deadlock. DB's locking subsystem offers a deadlock notification
mechanism.
Que:- what is the
facility give by oracle to avoid dead lock (automaticity)?
Ans:-
The DBMS_LOCK
package makes Oracle lock management services available to PL/SQL developers. User locks
created and managed using DBMS_LOCK are functionally identical to native RDBMS
locks, even down to the
various sharing modes and the deadlock detection.
Locks are
typically used to provide serialized access to some resource. Within the
database, the most familiar use of
locking is to prevent multiple users from updating the same row in a table at
the same time. Using DBMS_LOCK,
applications can be written that serialize and coordinate access or usage of
nondata resources. For instance,
user locks can be used to do the following:
Provide exclusive
access to an external device or service (e.g a printer).
Coordinate or
synchronize parallelized applications.
Disable or enable
execution of programs at specific times.
Detect whether a
session has ended a transaction using COMMIT or ROLLBACK.
Que:- Connect
listener to client with different port number?
Ans:-
We have two
utility and one technique to configure listener with diff port:
1.netmgr
2.netca
3.we can copy the
same line in the listener.ora file and do some changes like lsnt
"NAME","PORT".
After configure
it you start,restart the lsnr by name.
Que:- Search
about "oracle manager connection" on google?
Ans:-
Oracle Connection
Manager is a multipurpose networking solution that offers increased
scalability, multiprotocol connectivity and secure network
access control. It offers the following features to Oracle network:
- Connection multiplexing
- Access control
- Source routing
- Multiprotocol Support
- Firewall Proxy Support
Oracle Connection
Manager enables large numbers of users to connect to a single server by acting
as a connection concentrator to "funnel"
multiple client database sessions across a single network connection. This is
done through multiplexed network connections, a networking
feature included with Oracle Net. Oracle Connection Manager reduces operating
system resource requirements by minimizing the
number of network connections made to a server. Network bottlenecks are thus
avoided and system scalability significantly
increases so that thousands of users can now access a single database.
Que:- What is trigger,procedure,function,cursor
in oracle
Ans:-
CURSOR: When a
query is executed in oracle, a result set is produced and stored in the memory.
Oracle allows the programmer to access this result set in the memory through
cursors.
TRIGGER: Trigger
is program of PL/SQL that execute automaticaly when you give a specified
condition.
PROCEDURE: Procedures
are code fragments that don̢۪t normally return a value, but may have some outside effects (like updating tables).
FUNCTION: Functions
are special types of procedures that have capability to return a value.
Que:- Take a
backup datapump?
Ans:-
Create DIRECTORY
"name" '/to/path"
grant read,write
on directory "name" to "username"
expdp
user/password tables="name","name" directory="name"
dumpfile="name.dmp"
Que:- Insert a
row via SQL loader?
Ans:-
First you should
create a file control file like dada.ctl
LOAD DATA
INFILE chacha.txt
APPEND INTO TABLE
"table ka name"
FIELDS TERMINATED
BY ',' OPTIONALLY ENCLOSED BY '"'
(id, name)
And you give the
text file code like this form 12,"name"
Que:- Create a
user with three table and views after that you take backup with expdp utility
and import only those views starting from any "word"?
Ans:-
create DIRECTORY
"name" '/to/path"
grant read,write
on directory "name" to "username"
create
user,tables and views
expdp
user/password tables="name","name"
directory="name" dumpfile="name.dmp"
logfile="name.log";
after that you delete all tables,view from user
impdp
user/password dumpfile="name" directory="name"
include=views:\"LIKE \'name%\'\";
Que:- Find out
and try to understand the source code where bugzilla has created oracle schema?
Ans:-:-
In browser when
we click on "create new account" and give e-mail and userid/passwd information:find
out what happened to that information for which consequently to get an e-mail also find out
which language has been used to process open a new account information.
Que:- which one
utility is best for take the backup from Oracle DB?
Ans:-
This is our own decision that which one is the best for backup exp, expdp, DBCA, RMAN, dba_rollback_segs;
Que:- Why is a
UNION ALL faster than a UNION?
Ans:-
The union
operation, you will recall, brings two sets of data together. It will *NOT*
however produce duplicate or redundant rows. To perform this feat of magic, a
SORT operation is done on both tables. This is obviously computationally
intensive, and uses significant memory as well. A UNION ALL conversely just dumps collection of both sets together in random order, not worrying about
duplicates.
Que:- What are
some advantages to using Oracle's CREATE DATABASE statement to create a new
database manually?
Ans:-
You can script
the process to include it in a set of install scripts you deliver with a
product.
You can put your
create database script in CVS for version control, so as you make changes or
adjustments to it, you can track them like you do changes to software code.
You can log the
output and review it for errors.
You learn more about
the process of database creation, such as what options are available and why.
Que:- What are
three rules of thumb to create good passwords? How would a DBA enforce those
rules in Oracle? What business challenges might you encounter?
Ans:-
Typical password
cracking software uses a dictionary in the local language, as well as a list of
proper names, and combinations thereof to attempt to guess unknown passwords.
Since computers can churn through 10's of thousands of attempts quickly, this
can be a very affective way to break into a database. A good password therefore
should not be a dictionary word, it should not be a proper name, birthday, or
other obvious guessable information. It should also be of sufficient length,
such as eight to ten characters, including upper and lowercase, special
characters, and even alternate characters if possible.
Oracle has a facility called password security profiles. When installed they can enforce complexity, and length rules as well as other password related security measures. In the security arena, passwords can be made better, and it is a fairly solvable problem. However, what about in the real-world? Often the biggest challenge is in implementing a set of rules like this in the enterprise. There will likely be a lot of resistance to this, as it creates additional hassles for users of the system who may not be used to thinking about security seriously. Educating business folks about the real risks, by coming up with real stories of vulnerabilities and break-ins you've encountered on the job, or those discussed on the internet goes a long way towards emphasizing what is at stake.
Oracle has a facility called password security profiles. When installed they can enforce complexity, and length rules as well as other password related security measures. In the security arena, passwords can be made better, and it is a fairly solvable problem. However, what about in the real-world? Often the biggest challenge is in implementing a set of rules like this in the enterprise. There will likely be a lot of resistance to this, as it creates additional hassles for users of the system who may not be used to thinking about security seriously. Educating business folks about the real risks, by coming up with real stories of vulnerabilities and break-ins you've encountered on the job, or those discussed on the internet goes a long way towards emphasizing what is at stake.
Que:- Describe
the Oracle Wait Interface, how it works, and what it provides. What are some
limitations? What do the db_file_sequential_read and db_file_scattered_read
events indicate?
Ans:-
The Oracle Wait
Interface refers to Oracle's data dictionary for managing wait events.
Selecting from tables such as v$system_event and v$session_event give you event
totals through the life of the database (or session). The former are totals for
the whole system, and latter on a per session basis. The event
db_file_sequential_read refers to single block reads, and table accesses by
rowid. db_file_scattered_read conversely refers to full table scans. It is so named
because the blocks are read, and scattered into the buffer cache.
Que:- How do you
return the top-N results of a query in Oracle? Why doesn't the obvious method
work?
Ans:-
Most people think
of using the ROWNUM pseudocolumn with ORDER BY. Unfortunately the ROWNUM is
determined *before* the ORDER BY so you don't get the results you want. The
answer is to use a subquery to do the ORDER BY first. For example to return the
top-5 employees by salary:
SELECT * FROM (SELECT * FROM employees ORDER BY salary) WHERE ROWNUM < 5;
SELECT * FROM (SELECT * FROM employees ORDER BY salary) WHERE ROWNUM < 5;
Que:- Can
Oracle's Data Guard be used on Standard Edition, and if so how? How can you
test that the standby database is in sync?
Ans:-
Oracle's Data
Guard technology is a layer of software and automation built on top of the
standby database facility. In Oracle Standard Edition it is possible to be a
standby database, and update it *manually*. Roughly, put your production
database in archivelog mode. Create a hotbackup of the database and move it to
the standby machine. Then create a standby controlfile on the production
machine, and ship that file, along with all the archived redolog files to the
standby server. Once you have all these files assembled, place them in their
proper locations, recover the standby database, and you're ready to roll. From
this point on, you must manually ship, and manually apply those archived
redologs to stay in sync with production. To test your standby database, make a
change to a table on the production server, and commit the change. Then
manually switch a logfile so those changes are archived. Manually ship the
newest archived redolog file, and manually apply it on the standby database.
Then open your standby database in read-only mode, and select from your changed
table to verify those changes are available. Once you're done, shutdown your
standby and startup again in standby mode.
Que:- What is a
database link? What is the difference between a public and a private database
link? What is a fixed user database link?
Ans:-
Database link
allows you to make a connection with a remote database, Oracle or not, and
query tables from it, even incorporating those accesses with joins to local
tables. Private database
link only works for, and is accessible to the user/schema that owns it. A global
one can be accessed by any user in the database. Fixed user link
specifies that you will connect to the remote db as one and only one user that
is defined in the link. Alternatively, a current user database link will
connect as the current user you are logged in as.
50 DBA
Professional focused Interview Questions-Answers:(By James F. Koopmann )
Que:- Explain the
difference between a hot backup and a cold backup and the benefits associated
with each.
Ans:-
A hot backup is
basically taking a backup of the database while it is still up and running and
it must be in archive log mode. A cold backup is taking a backup of the
database while it is shut down and does not require being in archive log mode.
The benefit of taking a hot backup is that the database is still available for
use while the backup is occurring and you can recover the database to any point
in time. The benefit of taking a cold backup is that it is typically easier to
administer the backup and recovery process. In addition, since you are taking
cold backups the database does not require being in archive log mode and thus
there will be a slight performance gain as the database is not cutting archive
logs to disk.
Que:- You have just had to restore from backup and
do not have any control files. How would you go about bringing up this
database?
Ans:-
I would create a
text based backup control file, stipulating where on disk all the data files
where and then issue the recover command with the using backup control file
clause.
Que:- How do you
switch from an init.ora file to a spfile?
Ans:-
Issue the create
spfile from pfile command.
Que:- Explain the
difference between a data block, an extent and a segment.
Ans:-
A data block is
the smallest unit of logical storage for a database object. As objects grow
they take chunks of additional storage that are composed of contiguous data
blocks. These groupings of contiguous data blocks are called extents. All the
extents that an object takes when grouped together are considered the segment
of the database object.
Que:- Give two
examples of how you might determine the structure of the table DEPT.
Ans:-
Use the describe
command or use the dbms_metadata.get_ddl package.
Que:- Where would
you look for errors from the database engine?
Ans:-
In the alert log.
Que:- Compare and
contrast TRUNCATE and DELETE for a table.
Ans:-
Both the truncate
and delete command have the desired outcome of getting rid of all the rows in a
table. The difference between the two is that the truncate command is a DDL
operation and just moves the high water mark and produces a now rollback. The
delete command, on the other hand, is a DML operation, which will produce a
rollback and thus take longer to complete.
Que:- Give the
reasoning behind using an index.
Ans:-
Faster access to
data blocks in a table.
Que:- Give the
two types of tables involved in producing a star schema and the type of data
they hold.
Ans:-
Fact tables and
dimension tables. A fact table contains measurements while dimension tables
will contain data that will help describe the fact tables.
Que:- What type
of index should you use on a fact table?
Ans:-
A Bitmap index.
Que:- Give two
examples of referential integrity constraints.
Ans:-
A primary key and
a foreign key.
Que:- A table is
classified as a parent table and you want to drop and re-create it. How would
you do this without affecting the children tables?
Ans:-
Disable the
foreign key constraint to the parent, drop the table, re-create the table,
enable the foreign key constraint.
Que:- Explain the
difference between ARCHIVELOG mode and NOARCHIVELOG mode and the benefits and
disadvantages to each.
Ans:-
ARCHIVELOG mode
is a mode that you can put the database in for creating a backup of all
transactions that have occurred in the database so that you can recover to any
point in time. NOARCHIVELOG mode is basically the absence of ARCHIVELOG mode
and has the disadvantage of not being able to recover to any point in time.
NOARCHIVELOG mode does have the advantage of not having to write transactions
to an archive log and thus increases the performance of the database slightly.
Que:- What
command would you use to create a backup control file?
Ans:-
Alter database
backup control file to trace.
Que:- Give the
stages of instance startup to a usable state where normal users may access it.
Ans:-
STARTUP NOMOUNT -
Instance startup
STARTUP MOUNT -
The database is mounted
STARTUP OPEN -
The database is opened
Que:- What column
differentiates the V$ views to the GV$ views and how?
Ans:-
The INST_ID
column which indicates the instance in a RAC environment the information came
from.
Que:- How would
you go about generating an EXPLAIN plan?
Ans:-
Create a plan
table with utlxplan.sql.
Use the explain
plan set statement_id = 'tst1' into plan_table for a SQL statement
Look at the
explain plan with utlxplp.sql or utlxpls.sql
Que:- How would
you go about increasing the buffer cache hit ratio?
Ans:-
Use the buffer
cache advisory over a given workload and then query the v$db_cache_advice
table. If a change was necessary then I would use the alter system set
db_cache_size command.
Que:- Explain an
ORA-01555.
Ans:-
You get this
error when you get a snapshot too old within rollback. It can usually be solved
by increasing the undo retention or increasing the size of rollbacks. You
should also look at the logic involved in the application getting the error
message.
Que:- Explain the
difference between $ORACLE_HOME and $ORACLE_BASE.
Ans:-
ORACLE_BASE is
the root directory for oracle. ORACLE_HOME located beneath ORACLE_BASE is where
the oracle products reside.
Que:- How would
you determine the time zone under which a database was operating?
Ans:-
select DBTIMEZONE
from dual;
Que:- Explain the
use of setting GLOBAL_NAMES equal to TRUE.
Ans:-
Setting
GLOBAL_NAMES dictates how you might connect to a database. This variable is
either TRUE or FALSE and if it is set to TRUE it enforces database links to
have the same name as the remote database to which they are linking.
Que:- What
command would you use to encrypt a PL/SQL application?
Ans:-
WRAP
Que:- Explain the
difference between a FUNCTION, PROCEDURE and PACKAGE.
Ans:-
A function and
procedure are the same in that they are intended to be a collection of PL/SQL
code that carries a single task. While a procedure does not have to return any
values to the calling application, a function will return a single value. A
package on the other hand is a collection of functions and procedures that are
grouped together based on their commonality to a business function or
application.
Que:- Explain the
use of table functions.
Ans:-
Table functions
are designed to return a set of rows through PL/SQL logic but are intended to
be used as a normal table or view in a SQL statement. They are also used to
pipeline information in an ETL process.
Que:- Name three
advisory statistics you can collect.
Ans:-
Buffer Cache
Advice, Segment Level Statistics, & Timed Statistics
Que:- Where in
the Oracle directory tree structure are audit traces placed?
Ans:-
In unix
$ORACLE_HOME/rdbms/audit, in Windows the event viewer
Que:- Explain
materialized views and how they are used.
Ans:-
Materialized
views are objects that are reduced sets of information that have been
summarized, grouped, or aggregated from base tables. They are typically used in
data warehouse or decision support systems.
Que:- When a user
process fails, what background process cleans up after it?
Ans:-
PMON
Que:- What
background process refreshes materialized views?
Ans:-
The Job Queue
Processes.
Que:- How would
you determine what sessions are connected and what resources they are waiting
for?
Ans:-
Use of V$SESSION
and V$SESSION_WAIT
Que:- Describe
what redo logs are.
Ans:-
Redo logs are
logical and physical structures that are designed to hold all the changes made
to a database and are intended to aid in the recovery of a database.
Que:- How would
you force a log switch?
Ans:-
ALTER SYSTEM
SWITCH LOGFILE;
Que:- Give two
methods you could use to determine what DDL changes have been made.
Ans:-
You could use
Logminer or Streams
Que:- What does
coalescing a tablespace do?
Ans:-
Coalescing is
only valid for dictionary-managed tablespaces and de-fragments space by
combining neighboring free extents into large single extents.
Que:- What is the
difference between a TEMPORARY tablespace and a PERMANENT tablespace?
Ans:-
A temporary
tablespace is used for temporary objects such as sort structures while
permanent tablespaces are used to store those objects meant to be used as the
true objects of the database.
Que:- Name a
tablespace automatically created when you create a database.
Ans:-
The SYSTEM
tablespace.
Que:- When
creating a user, what permissions must you grant to allow them to connect to
the database?
Ans:-
Grant the CONNECT
to the user.
Que:- How do you
add a data file to a tablespace?
Ans:-
ALTER TABLESPACE
ADD DATAFILE SIZE
Que:- How do you
resize a data file?
Ans:-
ALTER DATABASE
DATAFILE RESIZE ;
Que:- What view
would you use to look at the size of a data file_
Ans:-
DBA_DATA_FILES
Que:- What view
would you use to determine free space in a tablespace?
Ans:-
DBA_FREE_SPACE
Que:- How would
you determine who has added a row to a table?
Ans:-
Turn on fine
grain auditing for the table.
Que:- How can you
rebuild an index?
Ans:-
ALTER INDEX
REBUILD;
Que:- Explain
what partitioning is and what its benefit is.
Ans:-
Partitioning is a
method of taking large tables and indexes and splitting them into smaller, more
manageable pieces.
Que:- You have
just compiled a PL/SQL package but got errors, how would you view the errors?
Ans:-
SHOW ERRORS
Que:- How can you
gather statistics on a table?
Ans:-
The ANALYZE
command.
Que:- How can you
enable a trace for a session?
Ans:-
Use the
DBMS_SESSION.SET_SQL_TRACE or
Use ALTER SESSION
SET SQL_TRACE = TRUE;
Que:- What is the
difference between the SQL*Loader and IMPORT utilities?
Ans:-
These two Oracle
utilities are used for loading data into the database. The difference is that
the import utility relies on the data being produced by another Oracle utility
EXPORT while the SQL*Loader utility allows data to be loaded that has been
produced by other utilities from different data sources just so long as it
conforms to ASCII formatted or delimited files.
Que:- Name two
files used for network connection to a database.
Ans:-
TNSNAMES.ORA and
SQLNET.ORA
Que:- Give two
UNIX kernel parameters that effect an Oracle install
Ans:-
SHMMAX &
SHMMNI
Que:- Briefly,
how do you install Oracle software on UNIX.Basically, set up disks, kernel
parameters, and run orainst.
Ans:-
Que:- What are
the components of physical database structure of Oracle database?
Ans:-
Oracle database
is comprised of three types of files. One or more datafiles, two are more redo
log files, and one or more control files.
Que:- What are
the components of logical database structure of Oracle database?
Ans:-
There are
tablespaces and database's schema objects.
Que:- What is a
tablespace?
Ans:-
A database is
divided into Logical Storage Unit called tablespaces. A tablespace is used to
grouped related logical structures together.
Que:- What is
SYSTEM tablespace and when is it created?
Ans:-
Every Oracle
database contains a tablespace named SYSTEM, which is automatically created
when the database is created. The SYSTEM tablespace always contains the data
dictionary tables for the entire database.
Que:- Explain the
relationship among database, tablespace and data file.
Ans:-
Each databases
logically divided into one or more tablespaces one or more data files are
explicitly created for each tablespace.
Que:- What is
schema?
Ans:-
A schema is
collection of database objects of a user.
Que:- What are
Schema Objects?
Ans:-
Schema objects
are the logical structures that directly refer to the database's data. Schema
objects include tables, views, sequences, synonyms, indexes, clusters, database
triggers, procedures, functions packages and database links.
Que:- Can objects
of the same schema reside in different tablespaces?
Ans:-
Yes.
Que:- Can a
tablespace hold objects from different schemes?
Ans:-
Yes.
Que:- What is
Oracle table?
Ans:-
A table is the
basic unit of data storage in an Oracle database. The tables of a database hold
all of the user accessible data. Table data is stored in rows and columns.
Que:- What is an
Oracle view?
Ans:-
A view is a
virtual table. Every view has a query attached to it. (The query is a SELECT
statement that identifies the columns and rows of the table(s) the view uses.)
Que:- Do a view
contain data?
Ans:-
Views do not
contain or store data.
Que:- Can a view
based on another view?
Ans:-
Yes.
Que:- What are
the advantages of views?
Ans:-
- Provide an additional
level of table security, by restricting access to a predetermined set of rows
and columns of a table.
- Hide data
complexity.
- Simplify
commands for the user.
- Present the
data in a different perspective from that of the base table.
- Store complex
queries.
Que:- What is an
Oracle sequence?
Ans:-
A sequence
generates a serial list of unique numbers for numerical columns of a database's
tables.
Que:- What is a
synonym?
Ans:-
A synonym is an
alias for a table, view, sequence or program unit.
Que:- What are
the types of synonyms?
Ans:-
There are two
types of synonyms private and public.
Que:- What is a
private synonym?
Ans:-
Only its owner
can access a private synonym.
Que:- What is a
public synonym?
Ans:-
Any database user
can access a public synonym.
Que:- What are
synonyms used for?
Ans:-
- Mask the real
name and owner of an object.
- Provide public
access to an object
- Provide
location transparency for tables, views or program units of a remote database.
- Simplify the
SQL statements for database users.
Que:- What is an
Oracle index?
Ans:-
An index is an
optional structure associated with a table to have direct access to rows, which
can be created to increase the performance of data retrieval. Index can be
created on one or more columns of a table.
Que:- How are the
index updates?
Ans:-
Indexes are
automatically maintained and used by Oracle. Changes to table data are
automatically incorporated into all relevant indexes.
Que:- What are
clusters?
Ans:-
Clusters are
groups of one or more tables physically stores together to share common columns
and are often used together.
Que:- What is
cluster key?
Ans:-
The related
columns of the tables in a cluster are called the cluster key.
Que:- What is
index cluster?
Ans:-
A cluster with an
index on the cluster key.
Que:- What is hash cluster?
Ans:-
A row is stored
in a hash cluster based on the result of applying a hash function to the row's
cluster key value. All rows with the same hash key value are stores together on
disk.
Que:- When can
hash cluster used?
Ans:-
Hash clusters are
better choice when a table is often queried with equality queries. For such
queries the specified cluster key value is hashed. The resulting hash key value
points directly to the area on disk that stores the specified rows.
Que:- What is
database link?
Ans:-
A database link
is a named object that describes a "path" from one database to
another.
Que:- What are
the types of database links?
Ans:-
Private database
link, public database link & network database link.
Que:- What is
private database link?
Ans:-
Private database
link is created on behalf of a specific user. A private database link can be
used only when the owner of the link specifies a global object name in a SQL
statement or in the definition of the owner's views or procedures.
Que:- What is
public database link?
Ans:-
Public database
link is created for the special user group PUBLIC. A public database link can
be used when any user in the associated database specifies a global object name
in a SQL statement or object definition.
Que:- What is
network database link?
Ans:-
Network database
link is created and managed by a network domain service. A network database
link can be used when any user of any database in the network specifies a
global object name in a SQL statement or object definition.
Que:- What is
data block?
Ans:-
Oracle database's
data is stored in data blocks. One data block corresponds to a specific number
of bytes of physical database space on disk.
Que:- How to
define data block size?
Ans:-
A data block size
is specified for each Oracle database when the database is created. A database
users and allocated free database space in Oracle data blocks. Block size is
specified in init.ora file and cannot be changed latter.
Que:- What is row
chaining?
Ans:-
In circumstances,
all of the data for a row in a table may not be able to fit in the same data
block. When this occurs, the data for the row is stored in a chain of data
block (one or more) reserved for that segment.
Que:- What is an
extent?
Ans:-
An extent is a
specific number of contiguous data blocks, obtained in a single allocation and
used to store a specific type of information.
Que:- What is a
segment?
Ans:-
A segment is a
set of extents allocated for a certain logical structure.
Que:- What are
the different types of segments?
Ans:-
Data segment,
index segment, rollback segment and temporary segment.
Que:- What is a
data segment?
Ans:-
Each
non-clustered table has a data segment. All of the table's data is stored in
the extents of its data segment. Each cluster has a data segment. The data of
every table in the cluster is stored in the cluster's data segment.
Que:- What is an
index segment?
Ans:-
Each index has an
index segment that stores all of its data.
Que:- What is
rollback segment?
Ans:-
A database
contains one or more rollback segments to temporarily store "undo"
information.
Que:- What are
the uses of rollback segment?
Ans:-
To generate
read-consistent database information during database recovery and to rollback
uncommitted transactions by the users.
Que:- What is a
temporary segment?
Ans:-
Temporary
segments are created by Oracle when a SQL statement needs a temporary work area
to complete execution. When the statement finishes execution, the temporary
segment extents are released to the system for future use.
Que:- What is a
datafile?
Ans:-
Every Oracle
database has one or more physical data files. A database's data files contain
all the database data. The data of logical database structures such as tables
and indexes is physically stored in the data files allocated for a database.
Que:- What are
the characteristics of data files?
Ans:-
A data file can
be associated with only one database. Once created a data file can't change
size. One or more data files form a logical unit of database storage called a
tablespace.
Que:- What is a
redo log?
Ans:-
The set of redo
log files for a database is collectively known as the database redo log.
Que:- What is the
function of redo log?
Ans:-
The primary
function of the redo log is to record all changes made to data.
Que:- What is the
use of redo log information?
Ans:-
The information
in a redo log file is used only to recover the database from a system or media
failure prevents database data from being written to a database's data files.
Que:- What does a
control file contains?
Ans:-
- Database name
- Names and
locations of a database's files and redolog files.
- Time stamp of
database creation.
Que:- What is the
use of control file?
Ans:-
When an instance
of an Oracle database is started, its control file is used to identify the
database and redo log files that must be opened for database operation to
proceed. It is also used in database recovery. Data Base
Administration
Que:- What is a
database instance? Explain.
Ans:-
A database
instance (Server) is a set of memory structure and background processes that
access a set of database files. The processes can be shared by all of the
users. The memory
structure that is used to store the most queried data from database. This helps
up to improve database performance by decreasing the amount of I/O performed
against data file.
Que:- What is
Parallel Server?
Ans:-
Multiple
instances accessing the same database (only in multi-CPU environments)
Que:- What is a
schema?
Ans:-
The set of
objects owned by user account is called the schema.
Que:- What is an
index? How it is implemented in Oracle database?
Ans:-
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 command
Que:- What are
clusters?
Ans:-
Group of tables
physically stored together because they share common columns and are often used
together is called cluster.
Que:- What is a
cluster key?
Ans:-
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.
Que:- What are
the basic element of base configuration of an Oracle database?
Ans:-
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:
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
Que:- What is a
deadlock? Explain.
Ans:-
Two processes
waiting to update the rows of a table, which are locked by other processes then
deadlock arises. In a database
environment this will often happen because of not issuing the 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 this processes being killed externally. Memory Management
Que:- What is
SGA?
Ans:-
The System Global
Area in an Oracle database is the area in memory to facilitate the transfer of
information between users. It holds the most recently requested structural
information between users. It holds the most recently requested structural
information about the database. The structure is database buffers, dictionary
cache, redo log buffer and shared pool area.
Que:- What is a shared pool?
Ans:-
The data
dictionary cache is stored in an area in SGA called the shared pool. This will allow
sharing of parsed SQL statements among concurrent users.
Que:- What is
mean by Program Global Area (PGA)?
Ans:-
It is area in
memory that is used by a single Oracle user process.
Que:- What is a
data segment?
Ans:-
Data segment are
the physical areas within a database block in which the data associated with
tables and clusters are stored.
Que:- What are
the factors causing the reparsing of SQL statements in SGA?
Ans:-
Due to
insufficient shared pool size. Monitor the ratio
of the reloads takes place while executing SQL statements. If the ratio is
greater than
Que:- Then increase the SHARED_POOL_SIZE.
Ans:-
Que:- Then increase the SHARED_POOL_SIZE.
Ans:-
Database Logical
& Physical Architecture
Que:- What is
Database Buffers?
Ans:-
Database buffers
are cache in the SGA used to hold the data blocks that are read from the data
segments in the database such as tables, indexes and clusters DB_BLOCK_BUFFERS
parameter in INIT.ORA decides the size.
Que:- What is
dictionary cache?
Ans:-
Dictionary cache
is information about the database objects stored in a data dictionary table.
Que:- What is
meant by recursive hints?
Ans:-
Number of times
processes repeatedly query the dictionary table is called recursive hints. It
is due to the data dictionary cache is too small. By increasing the
SHARED_POOL_SIZE parameter we can optimize the size of data dictionary cache.
Que:- What is
redo log buffer?
Ans:-
Changes made to
the records are written to the on-line redo log files. So that they can be used
in roll forward operations during database recoveries. Before writing them into
the redo log files, they will first brought to redo log buffers in SGA and LGWR
will write into files frequently. LOG_BUFFER parameter will decide the size.
Que:- How will
you swap objects into a different table space for an existing database?
Ans:-
- Export the user
- Perform import
using the command imp system/manager file=export.dmp indexfile=newrite.sql.
This will create all definitions into newfile.sql.
- Drop necessary
objects.
- Run the script
newfile.sql after altering the tablespaces.
- Import from the
backup for the necessary objects.
Que:- List the
Optional Flexible Architecture (OFA) of Oracle database? How can we organize
the tablespaces in Oracle database to have maximum performance?
Ans:-
SYSTEM - Data
dictionary tables.
DATA - Standard
operational tables.
DATAQue:- Static
tables used for standard operations
INDEXES - Indexes
for Standard operational tables.
INDEXESQue:--
Indexes of static tables used for standard operations.
TOOLS - Tools
table.
TOOLSQue:--
Indexes for tools table.
RBS - Standard
Operations Rollback Segments,
RBSQue:-RBSQue:--
Additional/Special Rollback segments.
TEMP - Temporary
purpose tablespace
TEMP_USER -
Temporary tablespace for users.
USERS - User
tablespace.
Que:- How will
you force database to use particular rollback segment?
Ans:-
SET TRANSACTION
USE ROLLBACK SEGMENT rbs_name.
Que:- What is
meant by free extent?
Ans:-
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.
Que:- Which
parameter in Storage clause will reduce number of rows per block?
Ans:-
PCTFREE parameter
Row size also
reduces no of rows per block.
Que:- What is the
significance of having storage clause?
Ans:-
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 updating, etc.,
Que:- How does
Space allocation table place within a block?
Ans:-
Each block
contains entries as follows
Fixed block
header
Variable block
header
Row Header, row
date (multiple rows may exists)
PCTEREE (% of
free space for row updating in future)
Que:- What is the
role of PCTFREE parameter is storage clause?
Ans:-
This is used to
reserve certain amount of space in a block for expansion of rows.
Que:- What is the
OPTIMAL parameter?
Ans:-
It is used to set
the optimal length of a rollback segment.
Que:- What is the
functionality of SYSTEM table space?
Ans:-
To manage the
database level transactions such as modifications of the data dictionary table
that record information about the free space usage.
Que:- How will
you create multiple rollback segments in a database?
Ans:-
- Create a
database, which implicitly creates a SYSTEM rollback segment in a SYSTEM
tablespace.
- Create a second
rollback segment name RQue:-in the SYSTEM tablespace.
- Make new
rollback segment available (after shutdown, modify init.ora file and start
database)
- Create other
tablespaces (RBS) for rollback segments.
- Deactivate
rollback segment RQue:-and activate the newly created rollback segments.
Que:- How the
space utilization takes place within rollback segments?
Ans:-
It will try to
fit the transaction in a cyclic fashion to all existing extents. Once it found
an extent is in use then it forced to acquire a new extent (number of extents
is based on the optimal size)
Que:- Why query
fails sometimes?
Ans:-
Rollback segment
dynamically extent to handle larger transactions entry loads.
A single
transaction may wipeout all available free space in the rollback segment
tablespace. This prevents other user using rollback segments.
Que:- How will
you monitor the space allocation?
Ans:-
By querying
DBA_SEGMENT table/view
Que:- How will
you monitor rollback segment status?
Ans:-
Querying the
DBA_ROLLBACK_SEGS view
IN USE - Rollback
Segment is on-line.
AVAILABLE -
Rollback Segment available but not on-line.
OFF-LINE -
Rollback Segment off-line
INVALID -
Rollback Segment Dropped.
NEEDS RECOVERY -
Contains data but need recovery or corrupted.
PARTLY AVAILABLE
- Contains data from an unresolved transaction involving a
distributed
database.
Que:- List the
sequence of events when a large transaction that exceeds beyond its optimal value
when an entry wraps and causes the rollback segment to expand into another
extend.
Ans:-
Transaction
Begins.
An entry is made
in the RES header for new transactions entry
Transaction
acquires blocks in an extent of RBS
The entry
attempts to wrap into second extent. None is available, so that the RBS must
extent.
The RBS checks to
see if it is part of its OPTIMAL size.
RBS chooses its
oldest inactive segment.
Oldest inactive
segment is eliminated.
RBS extents
The data
dictionary tables for space management are updated.
Transaction
Completes.
Que:- How can we
plan storage for very large tables?
Ans:-
Limit the number
of extents in the table
Separate table
from its indexes.
Allocate
sufficient temporary storage.
Que:- How will
you estimate the space required by a non-clustered tables?
Ans:-
Calculate the
total header size
Calculate the
available data space per data block
Calculate the
combined column lengths of the average row
Calculate the
total average row size.
Calculate the
average number rows that can fit in a block
Calculate the
number of blocks and bytes required for the table.
After arriving
the calculation, add
Que:- % additional space to calculate the initial extent size for a working table.
Que:- % additional space to calculate the initial extent size for a working table.
Ans:-
Que:- It is possible
to use raw devices as data files and what are the advantages over file system
files?
Ans:-
Yes, The advantages
over file system files are that I/O will be improved because Oracle is
bye-passing the kernel which writing into disk. Disk corruption will be very
less.
Que:- What is a
Control file?
Ans:-
Database's
overall physical architecture is maintained in a file called control file. It
will be used to maintain internal consistency and guide recovery operations.
Multiple copies of control files are advisable.
Que:- How to
implement the multiple control files for an existing database?
Ans:-
Shutdown the
database
Copy one of the
existing controlfile to new location
Edit Config ora
file by adding new control filename
Restart the
database.
Que:- What is
redo log file mirroring? How can be achieved?
Ans:-
Process of having
a copy of redo log files is called mirroring.
This can be
achieved by creating group of log files together, so that LGWR will
automatically writes them to all the members of the current on-line redo log
group. If any one group fails then database automatically switch over to next
group. It degrades performance.
Que:- What is
advantage of having disk shadowing / mirroring?
Ans:-
Shadow set of
disks save as a backup in the event of disk failure. In most operating systems
if any disk failure occurs it automatically switchover to place of failed disk.
Improved
performance because most OS support volume shadowing can direct file I/O
request to use the shadow set of files instead of the main set of files. This
reduces I/O load on the main set of disks.
Que:- What is use
of rollback segments in Oracle database?
Ans:-
They allow the
database to maintain read consistency between multiple transactions.
Que:- What is a
rollback segment entry?
Ans:-
It is the set of
before image data blocks that contain rows that are modified by a transaction.
Each rollback
segment entry must be completed within one rollback segment.
A single rollback
segment can have multiple rollback segment entries.
Que:- What is hit
ratio?
Ans:-
It is a measure
of well the data cache buffer is handling requests for data.
Hit Ratio =
(Logical Reads - Physical Reads - Hits Misses)/ Logical Reads.
Que:- When will
be a segment released?
Ans:-
When Segment is
dropped.
When Shrink (RBS
only)
When truncated
(TRUNCATE used with drop storage option)
Que:- What are
disadvantages of having raw devices?
Ans:-
We should depend
on export/import utility for backup/recovery (fully reliable)
The tar command
cannot be used for physical file backup, instead we can use dd command, which
is less flexible and has limited recoveries.
Que:- List the
factors that can affect the accuracy of the estimations?
Ans:-
- The space used
transaction entries and deleted records, does not become free immediately after
completion due to delayed cleanout.
- Trailing nulls
and length bytes are not stored.
- Inserts of,
updates to and deletes of rows as well as columns larger than a single data
block, can cause fragmentation a chained row pieces.
Que:- What is
user Account in Oracle database?
Ans:-
A user account is
not a physical structure in database but it is having important relationship to
the objects in the database and will be having certain privileges.
Que:- How will
you enforce security using stored procedures?
Ans:-
Don't grant user
access directly to tables within the application. Instead grant the
ability to access the procedures that access the tables. When procedure
executed it will execute the privilege of procedures owner. Users cannot access
tables except via the procedure.
Que:- What are
the dictionary tables used to monitor a database space?
Ans:-
DBA_FREE_SPACE
DBA_SEGMENTS
DBA_DATA_FILES.
SQL*Plus
Statements
Que:- What are
the types of SQL statement?
Ans:-
Data Definition
Language: CREATE, ALTER, DROP, TRUNCATE, REVOKE, NO AUDIT & COMMIT.
Data Manipulation
Language: INSERT, UPDATE, DELETE, LOCK TABLE, EXPLAIN PLAN & SELECT.
Transactional
Control: COMMIT & ROLLBACK
Session Control:
ALTERSESSION & SET ROLE
System Control:
ALTER SYSTEM.
Que:- What is a
transaction?
Ans:-
Transaction is
logical unit between two commits and commit and rollback.
Que:- What is
difference between TRUNCATE & DELETE?
Ans:-
TRUNCATE commits
after deleting entire table i.e., cannot be rolled back.
Database triggers
do not fire on TRUNCATE
DELETE allows the
filtered deletion. Deleted records can be rolled back or committed.
Database triggers
fire on DELETE.
Que:- What is a
join? Explain the different types of joins?
Ans:-
Join is a query,
which retrieves related columns or rows from multiple tables.
Self Join -
Joining the table with itself.
Equi Join -
Joining two tables by equating two common columns.
Non-Equi Join -
Joining two tables by equating two common columns.
Outer Join -
Joining two tables in such a way that query can also retrieve rows that do not
have corresponding join value in the other table.
Que:- What is the
sub-query?
Ans:-
Sub-query is a
query whose return values are used in filtering conditions of the main query.
Que:- What is
correlated sub-query?
Ans:-
Correlated
sub-query is a sub-query, which has reference to the main query.
Que:- Explain
CONNECT BY PRIOR?
Ans:-
Retrieves rows in
hierarchical order e.g select empno,
ename from emp where.
Que:- Difference between
SUBSTR and INSTR?
Ans:-
INSTR (String1, String2 (n, (m)),
INSTR returns the position of the m-th occurrence of the string 2 in string1. The search begins from nth position of string1.
SUBSTR (String1 n, m)
SUBSTR returns a character string of size m in string1, starting from n-th position of string1.
INSTR returns the position of the m-th occurrence of the string 2 in string1. The search begins from nth position of string1.
SUBSTR (String1 n, m)
SUBSTR returns a character string of size m in string1, starting from n-th position of string1.
Que:- Explain
UNION, MINUS, UNION ALL and INTERSECT?
Ans:-
INTERSECT -
returns all distinct rows selected by both queries.
MINUS - returns
all distinct rows selected by the first query but not by the second.
UNION - returns
all distinct rows selected by either query
UNION ALL -
returns all rows selected by either query, including all duplicates.
Que:- what is
ROWID?
Ans:-
ROWID is a pseudo
column attached to each row of a table. It is Que:- characters long, blockno,
rownumber are the components of ROWID.
Que:- What is the
fastest way of accessing a row in a table?
Ans:-
Using ROWID .
Que:- What is an
integrity constraint?
Ans:-
Integrity
constraint is a rule that restricts values to a column in a table.
Que:- What is
referential integrity constraint?
Ans:-
Maintaining data
integrity through a set of rules that restrict the values of one or more
columns of the tables based on the values of primary key or unique key of the
referenced table.
Que:- What is the
usage of SAVEPOINTS?
Ans:-
SAVEPOINTS are
used to subdivide a transaction into smaller parts. It enables rolling back
part of a transaction. Maximum of five save points are allowed.
Que:- What is ON
DELETE CASCADE?
Ans:-
When ON DELETE
CASCADE is specified Oracle maintains referential integrity by automatically
removing dependent foreign key values if a referenced primary or unique key
value is removed.
Que:- What are
the data types allowed in a table?
Ans:-
CHAR,
VARCHAR2, NUMBER, DATE, RAW, LONG and LONG RAW.
Que:- What is the maximum SIZE allowed for
each type?
Ans:-
CHAR pads blank
spaces to the maximum length.
VARCHAR2 does
not pad blank spaces.
For CHAR the
maximum length is 255 and 2000 for VARCHAR2.
Que:- How many
LONG columns are allowed in a table? Is it possible to use LONG columns in
WHERE clause or ORDER BY?
Ans:-
Only one LONG
column is allowed. It is not possible to use LONG column in WHERE or ORDER BY
clause.
Que:- What are
the pre-requisites to modify datatype of a column and to add a column with NOT
NULL constraint?
Ans:-
- To modify the
datatype of a column the column must be empty.
- To add a column
with NOT NULL constrain, the table must be empty.
Que:- Where the
integrity constraints are stored in data dictionary?
Ans:-
The integrity
constraints are stored in USER_CONSTRAINTS.
Que:- How will
you activate/deactivate integrity constraints?
Ans:-
The integrity
constraints can be enabled or disabled by ALTER TABLE ENABLE CONSTRAINT /
DISABLE CONSTRAINT.
Que:- If unique
key constraint on DATE column is created, will it validate the rows that are
inserted with SYSDATE?
Ans:-
It won't, Because
SYSDATE format contains time attached with it.
Que:- What is a
database link?
Ans:-
Database link is
a named path through which a remote database can be accessed.
Que:- How to
access the current value and next value from a sequence? Is it possible to
access the current value in a session before accessing next value?
Ans:-
Sequence name
CURRVAL, sequence name NEXTVAL. It is not possible. Only if you access next
value in the session, current value can be accessed.
Que:- What is
CYCLE/NO CYCLE in a Sequence?
Ans:-
CYCLE specifies
that the sequence continue to generate values after reaching either maximum or
minimum value. After pan-ascending sequence reaches its maximum value, it
generates its minimum value. After a descending sequence reaches its minimum,
it generates its maximum.
NO CYCLE specifies
that the sequence cannot generate more values after reaching its maximum or
minimum value.
Que:- What are
the advantages of VIEW?
Ans:-
- To protect some
of the columns of a table from other users.
- To hide
complexity of a query.
- To hide
complexity of calculations.
Que:- Can a view
be updated/inserted/deleted? If Yes - under what conditions?
Ans:-
A View can be
updated/deleted/inserted if it has only one base table if the view is based on
columns from one or more tables then insert, update and delete is not possible.
Que:- If a view
on a single base table is manipulated will the changes be reflected on the base
table?
Ans:-
If changes are
made to the tables and these tables are the base tables of a view, then the
changes will be reference on the view.
Que:-
Which default Database roles are created when you create a Database?
Ans:- RESOURCE
Que:-
What is a Checkpoint?
Ans:-
Que:-
Which Process reads data from Datafiles?
Ans:-
Que:-
Which Process writes data in Datafiles?
Ans:-
Que:-
Can you make a Datafile auto extendible. If yes, how?
Ans:-
Que:-
What is a Shared Pool?
Ans:-
Que:-
What is kept in the Database Buffer Cache?
Ans:-
Que:-
How many maximum Redo Log Files one can have in a Database?
Ans:-
Que:-
What is difference between PFile and SPFile?
Ans:-
Que:-
What is PGA_AGGREGRATE_TARGET parameter?
Ans:-
Que:-
Large Pool is used for what?
Ans:-
Que:-
What is PCT Increase setting?
Ans:-
Que:-
What is PCTFREE and PCTUSED Setting?
Ans:-
Que:-
What is Row Migration and Row Chaining?
Ans:-
Que:-
What is 01555 - Snapshot Too Old error and how do you avoid it?
Ans:-
Que:-
What is a Locally Managed Tablespace?
Ans:-
Que:-
Can you audit SELECT statements?
Ans:-
Que:-
What does DBMS_FGA package do?
Ans:-
Que:-
What is Cost Based Optimization?
Ans:-
Que:-
How often you should collect statistics for a table?
Ans:-
Que:-
How do you collect statistics for a table, schema and Database?
Ans:-
Que:-
Can you make collection of Statistics for tables automatic?
Ans:-
Que:-
On which columns you should create Indexes?
Ans:-
Que:-
What type of Indexes are available in Oracle?
Ans:-
Que:-
What is B-Tree Index?
Ans:-
Que:-
A table is having few rows, should you create indexes on this table?
Ans:-
Que:-
A Column is having many repeated values which type of index you should create on
this column, if you have to?
Ans:-
Que:-
When should you rebuilt indexes?
Ans:-
Que:-
Can you built indexes online?
Ans:-
Que:-
Can you see Execution Plan of a statement.
Ans:-
Que:-
A table is created with the following setting storage (initial 200k next 200k
minextents 2 maxextents 100 pctincrease 40). What will be size of 4th extent?
Ans:-
Que:-
What is DB Buffer Cache Advisor?
Ans:-
Que:-
What is STATSPACK tool?
Ans:-
Que:-
Can you change SHARED_POOL_SIZE online?
Ans:-
Que:-
Can you Redefine a table Online?
Ans:-
Que:-
Can you assign Priority to users?
Ans:-
Que:-
You want users to change their passwords every 2 months. How do you enforce
this?
Ans:-
Que:-
How do you delete duplicate rows in a table?
Ans:-
Que:-
What is Automatic Management of Segment Space setting?
Ans:-
Que:-
What is COMPRESS and CONSISTENT setting in EXPORT utility?
Ans:-
Que:-
What is the difference between Direct Path and Convention Path loading?
Ans:-
Que:-
What is the difference between Range Partitioning and Hash Partitioning?
Ans:-
Que:-
What is difference between Multithreaded/Shared Server and Dedicated Server?
Ans:-
Que:-
Can you import objects from Oracle ver. 7.3 to 9i?
Ans:-
Que:-
How do you move tables from one tablespace to another tablespace?
Ans:-
Que:- Use of latch in oracle?
Ans:-
Que:- Explain the purpose of automatic transaction in oracle database?
Ans:-
No comments:
Post a Comment