Sie sind auf Seite 1von 16

ORACLE BASICS INTERVIEW QUESTIONS

1.What is difference between varchar and varchar2?

Varchar means fixed length char varchar2 means variable length char

2. Difference between oracle8i and oracle9i?

a. The biggest difference between Oracle8i and Oracle9i is that Oracle9i lets you resize the
SGA memory areas dynamically i.e., the Database Buffer Cache DB_CACHE_SIZE or the
SHARED_POOL_SIZE, etc., can be resized when the database is up and running. The same
is not possible with Oracle8i. You can get more information from OTN

b. Oracle 9i is an enhanced version of the Oracle 8i.Oracle 8i does not provided time
stamping facility, which is provided in Oracle 9i.

c. you can drop a column in oracle 9i using alter table command where as this is not
available in oracle 8i

d. Database performance ease of management scalability security availability Windows


2000 integration and application areas: Internet content management commerce
integration packaged applications Business Intelligence native compilation of PL/SQL
reduction in latch contention (SGA locks) and I/O improvements better Java performance
(better compilation, improved garbage collection) distributed database performance
enhancements enhanced 3-tier security (integration with LDAP...) improved hosting
security (through use of virtual private databases), fine-grained auditing and single sign-on
improved user security (more password management features, etc.)Ability to encrypt
stored data row-level access control (Oracle Label Security)

e. Listed below are some of the features of 9i:


1) U has automatic undo management.
2) U has automatic segment space management
3) U got these locally managed tablespaces which is better than the dictionary
managed tablespaces as u can avoid fragmentation with locally managed
tablespaces.
4) U has a new dbms_metadata package to extract object definitions from database.
5) Multi table insert is possible with 9i
6) Importantly u has this spfile in 9i.
7) Also u has dynamic memory management facility with 9i.
8) U has tuning advisories with 9i.
9) U has multi block size parameter with 9i and many more features like these.

3.What is Pro*C? What is OCI?

Pro *C
The Pro* c/C++ precompiler takes the SQL statement that embedded in C/C++ code convert
into standard C/C++ code. When successfully precompile this code, the result is a C or C++
program that we compile and used to build the application that access the Oracle
Application.

OCI: - OCI refer to Oracle Call interface is set of Low Level API (Application Program
Interface Call) used to interact with Oracle Database. By OCI one can use the operation such
as Logon, Fatch, parse, execute etc. Generally these are written in C/C++.

4.What is the difference between "NULL in C" and "NULL in Oracle?


The NULL in C treated as Zero or void. but in SQL NULL value is Non or blank represented it
can't manipulated

5. In Oracle varchar2 takes dynamic space for storage then why char is still in oracle?

The major difference between varchar2 and char is fixed length and variable length.
Varchar2 have variable length mean if we declare as 20 space and its use only 5 space the
memory assign only 5. But in char takes daclare space while use any number space less than
declare

6.what are the difference between and constraints and triggers?

Constraints are used to maintain the integrity and atomicity of database .in other words it
can be said they are used to prevent invalid data entry. The main 5 constraints are
NOT NULL, PRIMARY KEY, FOREIGN KEY, UNIQUE KEY and CHECK

Triggers are basically stored procedures, which automatically fired when any insert, update
or delete is issued on table

Another most imp. Diff. is that trigger effected only those row after which trigger applied
but constraint effected all row of table.

7.what is normalization? What is the advantage of normalization (briefly)

1.The process of separating data into distinct, unique sets is called normalization. This is
implemented to improve the performance of the RDBMS, such as reduces redundancy of
data and data inconsistency.

2.Normalization is the process of removing redundant data from your tables in order to
improve storage efficiency, data integrity and scalability.

3.Database normalization is a series of steps followed to obtain a database design that allows
for consistent storage and efficient access of data in a relational database. These steps
reduce data redundancy and the risk of data becoming inconsistent.

4.Normalization is the process used to reduce the unnecessary repetition of data i.e.,
redundant data. It is performed on the data, which is redundant and makes the data in a
normalized format. It is of step-by-step process IstNotmal, FormIIndNormal, formIIIrdNormal,
formIVthNormal form or Boyce odd Normal form By performing this we will get the data in
the Normalized formati.,e from DBMS to RDBMS.

8.How the logs are escalated?

There are different types are logs which are logged by Oracle Database Engine. A DBA has to
look in for alter log which exist background dump dust. The seviourity of the problem are
analysed and escalated based on the information provided by the alter log.

9.What is structure of Database?

1.Oracle database usually contains one database and a single instance. But, Oracle 9i, 10g
RAC (Real Application Clusters) can have multiple instances to interact with a single
database for high availability.
Instance is non-persistent, memory based background processes and structures.
Database is persistent, disk based, data and control files

2.Physical Structure of Database:


One or more data files, control file(s), Redo log file(s) and init.ora file
Logical Structure of Database:
Table spaces, segments, extents, blocks

10.what is the difference between primary key, unique key, and surrogate key?

Primary Key: A column in a table whose values uniquely identify the rows in the table. A
primary key value cannot be NULL.

Unique Key: Unique Keys are used to uniquely identify each row in an Oracle table. There
can be one and only one row for each unique key value.

Surrogate Key: A system generated key with no business value. Usually implemented with
database-generated sequences.

Primary Key Unique key


1.There is only one 1. There may be more than 1
Primary key for I table Unique Key in table

2.It can contain Null Value 2. It can contain Null Value

1. what are the diffrent file types that are supported by SQL*Loader?

a.direct method (skips dbcache, no redo generation)

b. conventional method (just opposite of direct load)

2.How to find how many database reside in Oracle server in query?

select count(*) from v$database;

3.What spfile/init.ora file parameter exists to force the CBO to make the execution path of a
given statement use an index, even if the index scan may appear to be calculated as more
costly?

CBO (Cost Based Optimizer): Generates an execution plan for a SQL statement
Optimizer_index_cost_adj parameter can be set to help CBO to decide an execution
plan, which affects the speed of SQL query. We can also make necessary changes to
the following parameters to effect CBO performance:
Optimizer_search_limit & optimizer_max_permutations

4.How many memory layers are in the shared pool?

The shared pool portion of the SGA contains three major areas: library cache,
dictionary cache, buffers for parallel execution messages, and control structures.

5.What are the attributes of the Virtual Indexes?

a. These are permanent and continue to exist unless we drop them.

b. Their creation will not affect existing and new sessions. Only sessions marked for
Virtual Index usage will become aware of their existence.

c. Such indexes will be used only when the hidden parameter


"_use_nosegment_indexes" is set to true.
d. The Rule based optimizer did not recognize Virtual Indexes when I
Tested, however, CBO recognizes them. In all of my examples, I have used CBO.
However, I did not carry out intensive testing in RBO and you may come across
exceptions to this view.

d. Dictionary view DBA_SEGMENTS will not show an entry for Virtual Indexes. The
table DBA_INDEXES and DBA_OBJECTS will have an entry for them in Oracle 8i; in
Oracle 9i onwards, DBA_INDEXES no longer show Virtual Indexes.

e. Virtual Indexes cannot be altered and throw a "fake index" error!


f. Virtual Indexes can be analyzed, using the ANALYZE command or DBMS_STATS
package, but the statistics cannot be viewed (in Oracle 8i, DBA_INDEXES will not
show this either). Oracle may be generating artificial statistics and storing it
somewhere for referring it later.
Creating Virtual Index
Creating a Virtual Index can be achieved by using the NOSEGMENT clause with the
CREATE INDEX command.

6.What is meant by Virtual Indexes in Oracle?

Virtual Indexes are another undocumented feature used by Oracle. Virtual indexes,
as the name suggests are pseudo-indexes that will not behave the same way that
normal indexes behave, and are meant for a very specific purpose. A virtual index is
created in a slightly different manner than the normal indexes. A virtual index has no
segment pegged to it, i.e., the DBA_SEGMENTS view will not show an entry for this.

Oracle handles such indexes internally and few required dictionary tables are
updated so that the optimizer can be made aware of its presence and generate an
execution plan considering such indexes.As per Oracle, this functionality is not
intended for standalone usage. It is part of the Oracle Enterprise Manger Tuning Pack
(Virtual Index Wizard).

The virtual index wizard functionality allows the user to test a potential new index
prior to actually building the new index in the database.It allows the CBO to evaluate
the potential new index for a selected SQL statement by building an explain plan that
is aware of the potential new index.

This allows the user to determine if the optimizer would use the index, once
implemented.

7.What are materialized views? When are they used?

Materialized view is like a view but stores both definition of a view plus the rows
resulting from execution of the view. It uses a query as the bases and the query is
executated at the time the view is created and the results are stored in a table. You
can define the Materialized view with the same storage parametes as any other table
and place it in any tablespace of your choice. You can also index and partition the
Materialized view table like other tables to improve performance of queries
executed aginst them.

Use of Meterialized view:-

Expensive operations such as joins and aggregations do not need to be re executed.


If the query is astisfied with data in a Meterialized view, the server transforms the
query to reference the view rather than the base tables.
8.What is a functional index - explain?

Function-based indexes can use any Function or Object method that is declared as
repeatable.
Queries using expressions can use the index.
Ex: - CREATE INDEX sales_margin_inx
ON sales (revenue - cost);

Sql> SELECT ordid


FROM sales
WHERE (revenue - cost) > 1000;
We have to enable Function-based indexes by enableing the following initialization
parameters
ALTER SESSION SET QUERY_REWRITE_ENABLED = TRUE;
ALTER SESSION SET QUERY_REWRITE_INTEGRITY = TRUSTED;

9.Where we use bitmap index?

a. Bitmap indexes are most appropriate for columns having low distinct values.
b. We can use bitmap index where cardinality is very low like gender column or color
column.

10.What is an extent?
a. An extent is the smallest unit of storage allocation comprising collection of Blocks.
b. Well an extent is a chunk of a space that is used by database segments when a
segment is created it allocates extents.

11.How to you move from dedicated server Process to a Shared Server Process

Use DBCA (DATABASE CONFIGUARATION ASSISTANT) toolYou will get the option to
select shared server mode.

12.What are the components of physical database structure of Oracle database?

A. Totally there are 6 files (components) of physical database structure.3 mandatory


& 3 optional. Three mandatory files are
1> data file: store actual data
2> control file: stores structural & status information of database.
3> redo log file: stores changed/committed data
Three optional files are
4>-parameter file: stores all size related parameters note: this file is
mandatory for a1st time u create a database, and then it is optional.
5> archive log file: its offline copy of redo log files
6>-password file: used to make normal user to behave as a super user.

b. 1. Control files
2. Init file
3. Log files 4. Redo/archive log files 5. data files
C. Physical components of oracle database are control files, redo log files and datafiles.
Control file: control file is read in the mount state of database. Control file is a small
binary file, which records the physical structure of database, which includes
Database name
Names and locations of datafiles and online redo log files. Timestamp of database
creation
Checkpoint information current logs sequence number.
Redo log files: This files saves all the changes that are made to the database as they
occur. This plays a great role in the database recovery.
Datafiles: datafiles are the physical files, which stores data of all logical structure.

11.What are the components of logical database structure of Oracle database

Tablespace, segments, extents, data Blocks.

A logical unit of storage of database is called Tablespace.

A segment is a space allocated for a specific logical storage structure within a


tablespace.

Extents: Space allocated to a segments.

Datablocks: Oracle server manage the storage space in the datafiles in units is called
data blocks or oracle blocks.

12.What are the different types of segments?

table segment, index segment, IOT, cluster, temp segment, data segment.

13.Can you name few DBMS packages and their use?

DBMS_OUTPUT.PUT_LINE ('strings');
Print out the strings
DBMS_UTILITY.get_time ()
get the current time
DBMS_ALERT
e.g begin
dbms_alert.register('myregister');
end
To register interst in a named alert

14.How can be determine the size of the log files.


Select sum (bytes)/1024/1024 size_in_mb from v$log;

15.How can be determine the size of the database?

A. Select sum (bytes)/1024/1024/1024 Size_in_GB from dba_data_files;

B. Select sum (bytes)/1024/1024 from v_$datafile + select sum (bytes)/1024/1024


from v_$logfile will give u the total size of the database

C. Select (select sum (bytes/1024/1024/1024) from v$datafile) +( select


sum(bytes/1024/1024/1024) from v$tempfile) + (select sum(bytes/1024/1024/1024)
from v$log) "Size of Database in GB" from dual.

16. How can you check which user has which Role.

desc dba_tab_privs (OR) Can use ROLE_TAB_PRIVS also (OR) select * from
dba_role_privs order by grantee;

17. Can you start a database without SPfile in oracle 9i?

While starting database Oracle reads spfiledb.ora, spfile.ora, initdb.ora or init.ora


file. Yes it is possible to start the database using init.ora file only. The main
advantage of using the SPFILE.ora is only to make changes to the dynamic
initialization parameters without restarting the database using the SCOPE option. The
changes will be stored in the spfile only and if you start the database using "pfile"
option those changes wont be applicable to the database.

18.Do a view contain data?

A view does not contain any data of its own, but is like a window through which data
from other tables can be viewed and changed
The answer depends on the type of view. In case of normal view, the ans is NO it only
contains query based on a base table but in case of materialized view, YES it does
contain data and for the updated data in the base table, it needs to be refreshed.

NO: Because view is for view one or more tables data like query.

19.What is Oracle table?

A table is the most commonly used form of storing user data.


A table is used to store the information in form of rows &columns in the database.
Table is a segment (type of Segments), which is used to store user data. Tables can
have partitions (value wise, date period wise) and each partition can have separate
tablespace for better performance. The Collection of informations stored in the
structured format that is called a table.

20.Can objects of the same schema reside in different tablespaces?

Yes, it can. For example if you specify a different tablepace (B) for indexes, the
indexes of the tables that the user create would be residing in B, and the table would
reside in the user's default tablespace A.

Yes: Schema objects can stored in different tablespace and a tablespace can
contained one or more schema objects data.

21.What is an Oracle index?

An Index is a tree structure that allows direct access to a row in a table. Indexes can
be classified based on their logical design or on their physical implementation.
The Logical classification groups indexes from an application perspective, while the
physical classification is derived from the way the indexes are stored

An index is a schema object that can speed up the retrieval of rows by using
pointers. If you do not have an index, then a full table scan occurs. Its purpose is to
reduce disk I/O by using an indexed path to locate data quickly. If a table is dropped,
the corresponding indexes are also dropped.

It is created in existing table to locate rows more quickly&efficiently. The users


cannot see the indexes; they are just used to speed up the queries

22.Can we create index on long raw column?

NO we can't create index on long raw column.

23.What is the basic element of base configuration of an Oracle database?

It consists of - one or more data files


- One or more control files
- Two or more redo log files
The database contains - Multiple users/schema's
- One or more rollback segments
- One or more tablespaces
- Data dictionary tables.
User objects (table, indexes, views etc.)

24.What are clusters?

Groups of tables physically stored together because they share common columns and
are often used together is called clusters.

25.What is the function of redo log?

The primary function of the redo log is to record all changes made to data.

26.What are the characteristics of data files?

Characterstics of Data File:


- A Data file can be associated with only one database.
- Once created, a data file cannot change is size.
- One or more data files form a logical unit of database storage called a Tablespace.

Datafile size can be change by using ALTER DATABASE .................RESIZE command.


ORACLE DBA INTERVIEW QUESTIONS

1.What is a temporary segment

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
segments extents are released to the system for future use.

2.What are the uses of rollback segment

The use of RollBack Segment is Database is - to maintain read consistency between multiple
transactions.

3.What process writes from data files to buffer cache?

Server Process (OR) it is an server process not DBWR(DataBase Writer)

4.What is a redo log?

Redo log contains the before and after image copies of changed data.

5.What is a on-line redo log?

The On-line Redo Log is a set of tow or more on-line redo files that record all committed
changes made to the database. Whenever a transaction is committed, the corresponding
redo entries temporarily stores in redo log buffers of the SGA are written to an on-line
redo log file by the background process LGWR. The on-line redo log files are used in
cyclical fashion..

6.What does LGWR do ?

It is one of the main background process in oracle . In oracle and unix environment you can
check this process using ps -ef |pg command . which is writting all the uncommited
transaction from SGA to redologfile . (or)
Log Writer (LGWR) writes redo log entries generated in the redo log buffer of the SGA to on-
line Redo Log File.

7.Name init.ora parameters which effects system performance.

These are the Parameters for init.ora

DB_BLOCK_BUFFERS
SHARED_POOL_SIZE
SORT_AREA_SIZE
DBWR_IO_SLAVES
ROLLBACK_SEGMENTS
SORT_AREA_RETAINED_SIZE
DB_BLOCK_LRU_EXTENDED_STATISTICS
SHARED_POOL_RESERVE_SIZE

8.What is a database instance and Explain

An Oracle instance is a combination of background processes and memory structures (SGA).


9.What are the Advantages of Using DBCA

These are a few of the advantages of using DBCA:

You can use its wizards to guide you through a selection of options providing an easy means
of creating and tailoring your database. It allows you to provide varying levels of detail. You
can provide a minimum of input and allow Oracle to make decisions for you, eliminating the
need to spend time deciding how best to set parameters or structure the database.
Optionally, it allows you to be very specific about parameter settings and file allocations.

It builds efficient and effective databases that take advantage of Oracle's new features.

It uses Optimal Flexible Architecture (OFA), whereby database files and administrative files,
including initialization files, follow standard naming and placement practices

10.How do you find whether the instance was started with pfile or spfile

There are 3 different ways :-

1) SELECT name, value FROM v$parameter WHERE name = 'spfile'; //This query will return
NULL if you are using PFILE

2) SHOW PARAMETER spfile // This query will returns NULL in the value column if you are
using pfile and not spfile

3) SELECT COUNT(*) FROM v$spparameter WHERE value IS NOT NULL; // if the count is non-
zero then the instance is using a spfile, and if the count is zero then it is using a pfile:
By Default oracle will look into the default location depends on the o/s. Like in unix, oracle
will check in $oracle_home/dbs directory and on windows it will check in
oracle_home/database directory, and the content of pfile is just text based, but spfile
content is in binary format, that is understandable by oracle very well.

Also oracle server always check the spfile or pfile with these sequence :-

SPFILE<SID>.ORA, SPFILE.ORA, PFILE<SID>.ORA,PFILE.ORA

11.What is an index segment

Oracle creates the index segment for an index or an index partition when you issue the
CREATE INDEX statement. In this statement, you can specify storage parameters for the
extents of the index segment and a tablespace in which to create the index segment. (The
segments of a table and an index associated with it do not have to occupy the same
tablespace.) Setting the storage parameters directly affects the efficiency of data retrieval
and storage

12.What is public database link

You can create a public database link for a database. All users and PL/SQL subprograms in
the database can use a public database link to access data and database objects in the
corresponding remote database.
When many users require an access path to a remote Oracle database, an administrator can
create a single public database link for all users in a database.
CREATE PUBLIC DATABASE LINK ...;
13.What is row chaining

if any of the empty row is not sufficient to hold the row. then row is placed in multiple
blocks. it happenes when the block size is small and rows are of large size. then it cause
chaining. Due to chaining performance degrades and will cause more IOs

14.What is the use of control file

Control file is binary file which is having all the information realted to database. db_name,
maxlogfiles, maxdatafiles, tablespaces information. Without this u cannot open your
database. Init.ora parameter file showing the location of the controlfile. (or)
control file is a binary file which contains db_name,dbcreated,checkpoint
information,datafiles and logfiles.

15.What is a tablespace

Tablespace is nothing but a logical object comprisiing of one or more data files which
actually stores the data. (or) A tablespace is a collection of one or more datafile.

16.What is SYSTEM tablespace and when is it created

SYSTEM TABLESPACE USAGE NOTES:

Username - Name of the user


Created - User creation date
Profile - Name of resource profile assigned to the user
Default Tablespace - Default tablespace for data objects
Temporary Tablespace - Default tablespace for temporary objects

Only SYS, SYSTEM and possibly DBSNMP should have their default tablespace set to SYSTEM.

select USERNAME,
CREATED,
PROFILE,
DEFAULT_TABLESPACE,
TEMPORARY_TABLESPACE
from dba_users
order by USERNAME

Objects in SYSTEM TS
OBJECTS IN SYSTEM TABLESPACE NOTES:

Owner - Owner of the object


Object Name - Name of object
Object Type - Type of object
Tablespace - Tablespace name
Size - Size (bytes) of object

Any user (other than SYS, SYSTEM) should have their objects moved out of the SYSTEM
tablespace

select OWNER,
SEGMENT_NAME,
SEGMENT_TYPE,
TABLESPACE_NAME,
BYTES
from dba_segments
where TABLESPACE_NAME = 'SYSTEM'
and OWNER not in ('SYS','SYSTEM')
order by OWNER, SEGMENT_NAME

17.How to define data block size

The primary block size is defined by the Initiaization parameter DB_BLOCK_SIZE.

18.What is an Oracle sequence

A sequence is a database object created by a user that can be used to generate unique
integers. A typical usage of sequences is to generate primary key values which are unique
for each row.
It is generated and incremented (or decremented) by an internal Oracle routine. It can be
used by multiple users and for multiple tables too. A sequence can be used instead of writing
an application code for sequence-generating routine.

19.Explain the relationship among database, tablespace and data file.What is schema

Databases, tablespaces and datafiles are closely related, but they have important
differences:

--- A Oracle Database consists of one or more tablespaces


--- Each Table space in an Oracle database consists of one or more files called datafiles.
--- A database's data is collectively stored in the datafiles that constitute each tablespace of
the database

(or)
When a database user is created, a corresponding schema with the same name is created for
that user. A schema is a named collection of objects that include Tables, Triggers,
constraints, Indexes, Views etc. A user can only be associated with one schema, and that is
the same name as the user's. Username and schema are often used interchangeably.

20.DIFFERENTIATE BETWEEN Latches vs Enqueues

Enqueues are another type of locking mechanism used in Oracle. An enqueue is a more
sophisticated mechanism which permits several concurrent processes to have varying degree
of sharing of "known" resources. Any object which can be concurrently used, can be
protected with enqueues. A good example is of locks on tables. We allow varying levels of
sharing on tables e.g. two processes can lock a table in share mode or in share update mode
etc.

One difference is that the enqueue is obtained using an OS specific locking mechanism. An
enqueue allows the user to store a value in the lock, i.e the mode in which we are
requesting it. The OS lock manager keeps track of the resources locked. If a process cannot
be granted the lock because it is incompatible with the mode requested and the lock is
requested
with wait, the OS puts the requesting process on a wait queue which is serviced in FIFO.
Another difference between latches and enqueues is that in latches there is no ordered
queue of waiters like in enqueues.
Latch waiters may either use timers to wakeup and retry or spin (only in multiprocessors).
Since all waiters are concurrently retrying (depending on the scheduler), anyone might get
the latch and conceivably the first one to try might be the last one to get.

21.What is a latch?

Latches are low level serialization mechanisms used to protect shared data structures in the
SGA. The implementation of latches is operating system dependent, particularly in regard to
whether a process will wait for a latch and for how long.

A latch is a type of a lock that can be very quickly acquired and freed. Latches are typically
used to prevent more than one process from executing the same piece of code at a given
time. Associated with each latch is a cleanup procedure that will be called if a process dies
while holding the latch. Latches have an associated level that is used to prevent deadlocks.
Once a process acquires a latch at a certain level it cannot subsequently acquire a latch at a
level that is equal to or less than that level (unless it acquires it nowait).

What is difference between Logical Standby Database and Physical Standby database?

The primary functional difference between logical and physical standby database setups is
that logical standby permits you to add additional objects (tables, indexes, etc) to the
database, while physical standby is always an exact structural duplicate of the master
database. The downside, though, is that logical standby is based on newer technologies
(logical standby is new in Oracle 9.2) and tends to be generally regarded as more
tempramental than physical standby.

22.What is the frequency of log Updated..?

1.COMMIT or ROLLABCK
2.time out occurs (3 secs)
3 1/3 of log is full
4.1 mb of redo
5. Checkpoint occurs

23.How do you pin an object.

Use dbms_shared_pool procedure.


EXECUTE DBMS_SHARED_POOL.KEEP(OBJECTNAME);

24.How do you rename a database?


--------------------------------------------------------------------------------

-- To change the name of the database


-- For this script to run properly do the following:

-- Backup the Control fiel to Trace


ALTER DATABASE BACKUP CONTROLFILE TO TRACE;

-- Shutdown the database to make the changes


SHUTDOWN IMMEDIATE;

-- Edit the trace file and change the CREATE CONTROLFILE command
-- CREATE CONTROLFILE REUSE SET DATABASE "NEW_SID_NAME" RESETLOGS
-- (note the SET keyword)

Change the name in Control file and Init.ora


The first line of Control file should be "CREATE CONTROLFILE REUSE SET DATABASE ""
RESETLOGS ARCHIVELOG"

- modify the db_name parameter in the init.ora

-- Startup the datbase nomount with changed PFile


STARTUP NOMOUNT;

-- Execute the create controlfile command.


@create_control.sql;

-- Cancel base recovery of the database


Recover database USING BACKUP CONTROLFILE until cancel;
CANCEL

-- Open resetlogs the database


ALTER DATABASE OPEN RESETLOGS;

-- Rename GLOBAL_NAME to
ALTER DATABASE RENAME GLOBAL_NAME TO ;

-- Create SPFile, IF required give NAME and PATH of the PFILE


CREATE SPFILE FROM PFILE;

select name from v$database;

(or)

You can change Database my by simple do some steps.

1. Alter Database backup control file to trace;


2. Above step will create a text control file.
3. Change the Database name there and in init.ora file.
4. create new control file by running script (from backup control file)
5. Startup mount
6.open database resetlogs.
And your database name will be changed

25.What is the use of redo log information

Redo log information are used to recover database if it get currept.

26.Explain Oracle memory structure.

The Oracle RDBMS creates and uses storage on the computer hard disk and in random access
memory (RAM). The portion in the computer’s RAM is called memory structure. Oracle has
two memory structures in the computer’s RAM. The two structures are the Program Global
Area (PGA) and the System Global Area (SGA).
The PGA contains data and control information for a single, user process. The SGA is the
memory segment that stores data that the user has retrieved from the database or data that
the user wants to place into the database
27.What are memory structures in Oracle?

The basic memory structures associated with Oracle include:


• System Global Area (SGA), which is shared by all server and background
processes and holds the following:
o Database buffer cache
o Redo log buffer
o Shared pool
o Large pool (if configured)
• Program Global Areas (PGA), which is private to each server and background
process; there is one PGA for each process. The PGA holds the following:
o Stack areas
o Data areas

28.State new features of Oracle 9i.

1. Dynamic Memomry Management


2. Default tablespace at the db levele
3. temporary tablespace at the dba level
4. Undo tablespace managemnet (auto/manual)

29.What does database do during mounting process?

During database mount process, Oracle would check for the existence of controlfiles
mentioned in init.ora file but it wont check the contents of the controlfile which is done
during the opening of database.

30.What is the view name where i can get the space in MB for tables or views?

select segment_name,sum(bytes) from dba_segmentswhere segment_name='TABLE_NAME'


AND OWNER='OWNER of the table'group by segment_name

31.How to DROP an Oracle Database?

You can do it at the OS level by deleting all the files of the database. The files to be deleted
can be found using:

1) select * from dba_data_files;


2) select * from v$logfile;
3) select * from v$controlfile;
4) archive log list
5) initSID.ora
6) In addition you can clean the UDUMP, BDUMP, scripts etc

Clean up the listener.ora and the tnsnames.ora. make sure that the oratab entry is also
removed. (or)
Go To Dbca And Click On Delete Database

32.What is Parallel Server ?

Multiple instances accessing the same database (Only In Multi-CPU environments)


33.What are the basic element of Base configuration of an oracle Database ?

It consists of
one or more data files.
one or more control files.
two or more redo log files.
The Database contains
multiple users/schemas
one or more rollback segments
one or more tablespaces
Data dictionary tables
User objects (table,indexes,views etc.,)
The server that access the database consists of
SGA (Database buffer, Dictionary Cache Buffers, Redo log buffers, Shared SQL pool)
SMON (System MONito)
PMON (Process MONitor)
LGWR (LoG Write)
DBWR (Data Base Write)
ARCH (ARCHiver)
CKPT (Check Point)
RECO
Dispatcher
User Process with associated PGS

34.What is a deadlock ? Explain .

Two processes wating to update the rows of a table which are locked by the other process
then deadlock arises.
In a database environment this will often happen because of not issuing proper row lock
commands. Poor design of front-end application may cause this situation and the
performance of server will reduce drastically.
These locks will be released automatically when a commit/rollback operation performed or
any one of this processes being killed externally.

(OR)

A deadlock is a condition where two or more users are waiting for data locked by each other.
Oracle automatically detects a deadlock and resolves them by rolling back one of the
statements involved in the deadlock, thus releasing one set of data locked by that
statement. Statement rolled back is usually the one which detects the deadlock. Deadlocks
are mostly caused by explicit locking because oracle does not do lock escalation and does
not use read locks. Multitable deadlocks can be avoided by locking the tables in same order
in all the applications, thus precluding a deadlock. (OR)
System waiting for an event that may or may not happens and can be rectified using round
robin algorithm which implemented internally by operating systems