Anda di halaman 1dari 24

1) How to set pga size, can you change it while the database is running?

show parameter pga_aggregate_target;

alter system set pga_aggregate_target=100m;
Yes the pga can be changed while the database is up and running.
2) How to know which parameter is dynamic/static?
ISSES_MODIFIABLE VARCHAR2(5) Indicates whether the parameter can be changed with ALTER
ISSYS_MODIFIABLE VARCHAR2(9) Indicates whether the parameter can be changed with ALTER
SYSTEM and when the change takes effect:

IMMEDIATE Parameter can be changed with ALTER

SYSTEM regardless of the type of parameter file used to start
the instance. The change takes effect immediately.

DEFERRED Parameter can be changed with ALTER

SYSTEM regardless of the type of parameter file used to start
the instance. The change takes effect in subsequent

FALSE Parameter cannot be changed with ALTER

SYSTEM unless a server parameter file was used to start the
instance. The change takes effect in subsequent instances.
SQL> desc v$parameter
SQL> select distinct ISSYS_MODIFIABLE from v$parameter;
3) How to know how much free memory available in sga?

select * from v$sgastat where name =free memory';

4) What are oracle storage structures?
Oracle storage structures are tablespace,segment,extent,oracle block
5) List types of Oracle objects
table, index, cluster table,IOT (Index Organisation Table),function, package, synonym, trigger,
sequence, procedure
6) What is an index, how many types of indexes you know? Why you need an index
Index is an oracle object which is used to retrieve the data much faster rather than scanning entire
table.Typically this is like an index page in a book which contains the links to the pages,where we
can go through easily through out the book.
If index page is not there,we have to search each and every page for our need,so we use indexes in
oracle also to retrive the data quickly.
Types of indexes:
Btree index: Used for searches mostly when used select statements(Ex:pincode)
bit map index: when having low cardinolity (low priority) columns used in
thestatements.for example: gender column
function based index: sum(salary), upper(ename), lower(ename)
reverse index: used mostly to increase the speed of inserts (its like btree only but the key is
7) What is synonym ?
Synonym is used to hide the complexity of the original object.
for example user a has table t which user a wants to hide the name but user b has to access it.
In this case user a can create a synonym on table t and give a select priviledge to user b.
SQL> create synonym aishu on t;
SQL> grant select on aishu to b;
Query: Select synonym_name from dba_synonyms;
8) What is sequence?
Sequence is a oracle object which used to create the unique and sequential numbering for a column
example: employee num,account id
create table employee(id number ,name varchar2(10),salary number);

create sequence aishu_seq start with 1 increment by 1;

insert into employee values (aishu_seq.nextval,paddu,120000);
9) Define different types of tablespaces you know?
Permanent: system table space,sys aux,user
undo: to store undo segments
temp: to store the sort segments
10) What is the difference between Locally managed tablespace and dictionary managed
LMT: Locally Managed Table space stores all the extent mapping or allocation details in the header
of the data file
DMT:Dictionary Managed Table space stores all the extent mapping or allocation details in the
dictionary table called UET$ and FET$
Since everytime an allocation of extents generate some recursive sql on UET$ and FET$ this is
contention in dictionary cache, hence this is not good for performance of database, but LMT can
store this outside of dictionary , coz it stores in header of the data file.
By Default from 10g the management is LMT only
11) What is Automatic segment space management? and how to find the tablespace in ASSM?
Oracle will allocates the extents automatically to the table or segment depending upon the size of
the table.We need not to give the storage parameters.
SQL>desc dba_tablespaces;
SQL> select tablespace_name, allocation_type,segment_space_management,extent_management
from dba_tablespaces;
12) What is uniform segment? How to find it?
In uniform segment every extent will have same size.
SQL>desc dba_tablespaces;
SQL> select tablespace_name, allocation_type,segment_space_management,extent_management
from dba_tablespaces;
13) Where do you see the tablespace information?
SQL>select * from dba_tablespaces;
14) How to find the datafiles that associated with particular tablespace? Ex: System
SQL> desc dba_data_files
SQL> select * from dba_data_files where tablespace_name=SYSTEM';

15) How to see which undo tablespace is used for database?

SQL> show parameter undo_tablespace






16) How to see the default temporary tablespace for a database?
SQL> select PROPERTY_NAME,PROPERTY_VALUE from database_properties where


17) How to see what is the default block size for a database ?
SQL> show parameter block_size;






18) Is it possible to have multiple blocksizes in a database if so how? Explain

Yes it is possible but we have to create multiple DB buffer pools while setting the required block
size parameter.To do that it require database bounce.
For example if you want to have 2k size along with default 8k
SQL> show parameter db_2k_cache_size
SQL>alter system set db_2k_cache_size=100M scope=spfile;
SQL>shut immediate
Now we can create the table space using new 2k block size
create tablespace test_2k datafile /u01/oradata/paddu/test2k.dbf size 100M block size 2k;

19) What is the oracle block, can you explain?

Oracle block is the lowest level of storage structure where it contains the data(business/oracle data)
The block has divided into many sections starting from block header,row header,row directory,ITL
list(Intrested Transaction List),free space.
20) Can you change the blocksize once the database is created?
Obsolutely no becoz once the datafiles is formatted into 8k we cannot change the database block
sizes , if you need, you have to create fresh database with new block size and restore from backup or
21) Can you change the database name once the database is created?
Yes we can but the database has to be shutdown and also this will change all of the headers of the
Option 1
1) Using NID utility
a)SQL>alter database close;
b) nid target=sys as sysdba dbname=ketan(this will change the control files and headers of the
datafiles with the correction of new name)
c)cd $ORACLE_HOME/dbs
d) cp initaishu.ora initketan.ora
e)vi initketan.ora
find db_name parameter and change it to ketan
f)vi /etc/oratab
change the name aishu to ketan
g) . oraenv
set the variable ORACLE_SID=ketan
f) startup the database
SQL> startup (but the database open will error out since the datbase should open with resetlogs)
h) alter database open resetlogs;
Option 2
By changing the control file
a)alter database backup control file to trace;
b)go to trace directory and edit the control file trace
c)In control file trace update database name aishu to ketan
d)shut down the database
e)remove the control file
f)vi init file and change the dbname aishu to ketan
g)startup nomount
h)execute the control file trace which we modified earlier(this will create a new control file in the
location with the new dbname )
i) alter database open resetlogs;

22) Can you change the instance name once the database is created?
SQL>alter system set instance_name=test scope=spfile;
shut immediate;
cp spfilepaddu.ora spfilekarthika.ora
export ORACLE_SID=karthika
23) Can you rename the tablespace once it is created?
SQL>alter tablespace testtbs1 rename to testtbs3;
24) Can you rename the user once it is created?
No there is no direct command to change the user name but there is a work around.
1) export user
exp / as sysdba owner=paddu file=/home/oracle/paddu.dmp
sqlplus / as sysdba
SQL> drop user paddu cascade;
QL>create user aishu identified by aishu;
SQL>grant connect,resource to aishu;
SQL> exit
imp file=/home/oracle/paddu.dmp fromuser=paddu touser=aishu
sqlplus / as sysdba
SQL>select username from dba_users;
25) Can you rename the table once it is created?
connect to user aishu
SQL>connect aishu/aishu
SQl>select * from tab
SQL> create table t as select * from user_tables;
SQL> create table dummy (id number,name varchar2(50),salary number);
SQL>rename t to t1
26) Can you rename the column in a table?
SQL>desc t;
alter table t rename column result_cache to aishu;
27) Where you can see the datafile information?

desc dba_data_files;
SQL> select tablespace_name,file_name,autoextensible, bytes/1024/1024 SIZE_MB from
28) Where you can see the tempfile or tablespace information?(for a particular database)
desc dba_temp_files;
desc dba_tablespaces;
29) What is the difference between v$ views and dba views?
dba views are static views
v$ views are dynamic views
dba views are available once the db is in open mode only
V$ can be viewed even the database is in mount state
30) What is the difference between a role and privilege , can you provide an example?
Set of priviliges is nothing but a role.
providing authorisation to an user such as create,alter,delete,drop,truncate,insert,update.
How many types of privileges are there ?
system privileges : create session/user
object privileges : insert,update,delete or create table
31) Where to view the roles and privileges assigned to a user?
For roles:-desc
dba_roles can be used to know what are all the roles in a database.
select * from dba_roles;
role_sys_privs can used to know what are all the system privileges assigned to that role.
role_tab_privs can be used to know what are all the object privileges assigned to that role
dba_role_privs can be used to know the grantees assigned to that role
For privileges:dba_tab_privs: can be used to know what all privileges assigned to a user
SQL> select grantee,owner,table_name,grantor,privilege from dba_tab_privs where grantee=AISHU';
dba_sys_privs: to know what all system privileges assigned to a user
SQL> select grantee,privilege from dba_sys_privs where grantee=AISHU';

32) What is the difference between with grant option and with admin option while assigning
Grant option : We can grant that grant to other user
admin option : can be used for sysdba privileges to grant other
grant select on T to aishu with grant option;
Aishu can grant select on table T to any one;
grant dba to aishu with admin option;
aishu can grant or manage dba role and assign to anyone.
34) How to reovoke privilege or role?
revoke select on T from aishu;
revoke suresh from aishu;(suresh is a role here )
33) How to change the default tablespace for a user?
alter user aishu default tablespace t;
34) How to give a tablespace quota to a user?
alter user aishu grant unlimited quota on tablespace t;
36) What are constraints? Can you list them and when will you use them?
Constrains in oracle are use to protect the integrity of the data.
for example a not null constraint will not allow any null value in the column
a unique constraint will not allow any duplicate value in the column
a primary key constraint will not allow any duplicate value and null in the column.
a foreign key constraint will be from the one of the primary key of the table which means data must
resides in the primary key table(Master list table)
Master Table (a table that contains primary key)
SQL> create table pincode (area varchar2(30), pincodenum number primary key);
SQL> insert into pincode values (Miyapur,500049);
SQL> insert into pincode values(Ameerpet,500084);
Child Table ( aa table that is referred to primary key column)
SQL> Create table employee (empname varchar2(30),empid number unique,address1 varchar2(10)
check=Hyderabad, address2 varchar2(20),pincode number
constraint pin_fk foreign key(pincode) references pincode (pincodenum));
SQL> Insert into employee values(Aishu,1,Ameerpet,Line,500084);

37) What is Row chaining? When does it occur? where can you find it? What is the solution?
When the row is not adequate to fit in the block while inserting oracle will insert half row in one
block and half in another block leaving a pointer between these two blocks.
select table_name,chain_cnt from dba_tables where table_name=tablename';
create a table with bigger the block size
1) Create tablespace ts data file /u01/oradata/aishu/paddu.dbf size 100m blocksize 16k;
2) alter table employee move to ts;
Here TS is the tablespace name with bigger size, before creating tablespace it is assumed that you
have created a db buffer cache for it.
38) What is row migration? When does it occur? Where can you find this information?
Row migration happens when update occurs at one column and the row is not adequate to fit in the
block then the entire row will be moved to the new block.
select table_name,chain_cnt from dba_tables where table_name=tablename';
set pct_free storage parameter for table to adequate.;
39) How to find whether the instance is using spfile or pfile?
show parameter spfile;
40) How to create password file?
orapwd file=$ORACLE_HOME/dbs/pwaishu.ora entry=5 ignore case=Y;
41) How to create a database manually , can you provide steps briefly?
1) create a parameter file in /dbs directory with necessary parameters like
db_name,instance_name,control file locations,sga_max_size etc..
2)create necessary directories for datafiles,trace files,redo log files, control files according OFA
3)prepare the create db command
4)create catalog views (compile,invalid)
SQL> @?/rdbms/admin/catalog.sql
SQL> @?/rdbms/admin/catproc.sql

5) add entries in listner.ora,tnsnames.ora

6) add entry in /etc/oratab

42) What is OFA? What is the benefit of it?

Oracle Flexible Architecture
Different directory structures with diff files and we keeping the files (redolog,control etc) in the
corresponding described locations which keeps the files in track and we can easily manage
them,Inaddition to tha I/O will be redistributed.
43) What does system tablespace and sysaux tablespace contains?
system table space stores the system tables such as dbtables,oracle base tables,dictionary objects
that related to oracle.a kind of metada(data about data)
Sysaux table space: from 10g onwards oracle has segregated some of the dictionary objects to be
created in sysaux table space seperating from system table space to reduce the burden on the one
table space
for example oracle session statistics,system statistics,awr data( automatic work load
repository),oracle execution statistics
44) Do you know about statistics , what is the use of it? What kind of statistics exists in
Statistics is a collection information about data or database
There are different types of statistics that oracle maintains1)System-Statistics: statistics about the hardware like cpu speed,I/O speed,read time write time
etc : select * from aux_stats$
2)Object statistics : For a table oracle collects the information about no.of rows,no.ofblocks,avg row
length etc.We can view
SQL>select table_name,num_rows,blocks,avg_row_len from dba_tables
for index oracle collect statistics on index column about no.of rows,no.of root blocks,no.ofbranch
blocks,no.of leaf blocks,no.of distinct values etc.
46. Why you need statistics to be collected?
These statistics wil help the query execution engine called optimizer to determine how best the data
can the accessed
45) Where to find the table size?
table=create segment in a tablespace, that segment contains extents and that extents contains
T=100 * 8192 = 819200000
SQL>select segment_name,bytes/1024/1024 from dba_segments where segment_name=T';

46> How to find the size of a database?

select sum (bytes) from dba_segments;
46) Where to find different types of segments in oracle database?
select distinct segment_type from dba_segments;
47) How to resize the datafile?
To resize a datafile the first most thing is the data file should be in auto extendable mode
ALTER DATABASE DATAFILE /u02/oracle/rbdb1/stuff01.dbf RESIZE 100M;.
Can i resize the datafile to lesser than it has?
I have 1gb
I want to 100MB,
But the data in that datafile is upto 500MB
can i resize to 100mb?
Yes we can unless the data is not above 100MB in the datafile.
48) How to add datafile to a tablepsace?
alter tablespace t add datafile /u01/oradata/paddu/tbs1 size 100M;
49) How to delete the datafile?
alter tablespace t drop datafile /u01/oradata/paddu/tbs1
Note:The drop datafile will only works if the datafile is empty
50) How to move datafiles from one location to another location? Can you provide the steps?
1.Connect as SYS DBA with CONNECT / AS SYSDBA command.
2.Make offline the affected tablespace with ALTER TABLESPACE <tablespace name> OFFLINE;
3.Copy the datafiles from old location to new location using OS cp
4.Modify the name or location of datafiles in Oracle data dictionary using following command
ALTER database RENAME DATAFILE <old location> TO <new location>';
5.Bring the tablespace online again with ALTER TABLESPACE alter tablespace <tablespace name>
ONLINE; command
51) What is profile? what is the benefit of profile? Where do you see the information of
profiles? Provide an example of profile?
Profile is a set of properties assign to an user
For an example password complexity,password reuse,password expiry,idle time etc

SQL>desc dba_profiles;
SQL> select username,profile from dba_users;
52) How to change the profile of a user?
alter user username profile profile name
53) How to create user?
create user username identified by password default tablespace testtbs1 profile test;
ex: create user paddu identified by paddu default tablespace testtbs1 profile test;
SQL> select username,profile from dba_users;
SQL> grant connect,resource to paddu;
54) How to create schema?
schema is nothing but an user.
55) How to grant privileges to user?
using grant command
grant create table to user;
grant create table to user with grant option;
Note: with grant option provides user to grant the privilege to other users as well, kind of admin
56) Can you delete alert log while database is up and running?
show parameter background;
Yes database can create a new alert log file,but whenever any activity happens in the database it
creates a new alert log file
Yes one can delete or move the alert log file while the database is up and running there will be no
impact,oracle will automatically creates a new alert log if it not found any in the directory
57) What is fragmentation of table?
Fragmentation of a table is something when ever there is a purge or deletion of a table.Oracle will
not use those unused blocks and always try to allocate the extents above high watermark.this leads
the table to grow larger than its size.

58) What is cursor?

Cursor is some thing which resides in the PGA and dictionary cache in SGA.
A cursor is a handle, or pointer, to the context area. Through the cursor, Cursors allow you to fetch
and process rows returned by a SELECT statement, Through the cursor, a PL/SQL program can
control the context area and what happens to it as the statement is processed.

Two important features about the cursor are implicit and explicit cursors.
An implicit cursor is one created "automatically" for you by Oracle when you execute a query. It is
simpler to code, but suffers from
Inefficiency (the ANSI standard specifies that it must fetch twice to check if there is more than one
Vulnerability to data errors (if you ever get two rows, it raises a TOO_MANY_ROWS exception).
Example :SELECT col INTO var FROM table WHERE something;
An explicit cursor is one you create yourself. It takes more code, but gives more control - for
example, you can just open-fetch-close if you only want the first record and don't care if there are
CURSOR cur IS SELECT col FROM table WHERE something;
OPEN cur;
FETCH cur INTO var;
CLOSE cur;
59) Can you tell various dynamic views you know about and their purpose?
v$session-shows about sessions information that logged into database
Ex:select sid,status,username,logon_time,blocking_session,module,event,sql_id from v$session
v$process : To view the process information to attached to the session
Ex: select pid,spid,addr from v$process
v$database: To view the database information
Ex: select dbid,name,open_mode,created from v$database;

v$instance : To view the instance information

v$lock : To view the locked sessions
Ex:SQL> select SID,type,id1,lmode,request from v$lock;
SID is the session ID column that is requesting or holding the lock
TYPE: Type is the column that shows about what kind of end queue or lock it has
ID1 :This column says about the object id that involved in lock.Match this object id dba_objects to
get the object names
LMODE : lock mode it can be 1-6
6 is the least level of lock and an exclusive lock,when we update a row that row will be locked as
exclusive so that no one will be modified
From 1-5 the locks are different types of levels which are some shared or table level locks
Row exclusive Any DML that happens on any row locks as exclusive so that no one can modify
Row shared Select statement ran, during that period the rows will be in shared mode so that no
modification to be done until that select retrieve all rows.
Table Lock When an update statement ran on column , no other can moidfy the structure of table,
and allow row exclusive
v$parameter Displays information about parametters in database
SQL>select name,value,ISSYS_MODIFIABLE from v$parameter where name=sga_target';
v$sgastat : Displays information about sga individual pool sizes and also displays free
memory in the sga
SQL> select * from v$sgastat;
v$sgainfo : Displays information about sga pool sizes
SQL> select * from v$sgainfo;
v$transaction: Displays information about the transactions that running in the database
SQL>select * from v$transaction;
v$pgaStat:displays about pga allocated in the database
SQL>select * from v$pgastat;
v$sga_resize_ops : Displays information about sga resize operation when sga target is set
SQL> select * from v$sga_resize_ops;

v$sysstat : Displays the systems statistics information

SQL> select * from v$sysstat;
v$sesstat : Displays the information about session statistics
SQL> select * from v$sesstat;
Display each statistics information from sysstat but for each session, so 604 statistics X each
v$logfile : Displays information about the redo log files
SQL> select group#,member,status from v$logfile;
v$log : Displays information about redolog groups
SQL>select group#,members,status from v$log;
v$undostat : Displays the information about undo usage in the database
v$sysaux_occupants : Displays the information about objects that resides in sysaux table space
60) Difference between v$ views and dba_views?
V$ views are dynamic and populated from base table like X$BH and USER$ etc etc
DBA_** views are the the views built on top of v$ views in combination. for example v$session has
been built from v$session,user$ etc
60) Where to view the session information?
SQL> select sid,status,username,logon_time,machine,sql_id,blocking_session,event from v$session
where sid=;
If you do not know the sid replace with any column information you know in where condition.
61) Where to view the process associated with session information?
select sid,status,username,action,program,machine from v$session where paddr in (select addr
from v$process where spid=5046);
61) Where to view the locks in oracle database?

62) What are locks?

locks are low level serialization mechanism called end queues in oracle which protects the database
of data changes
63) What latches?
latches are typically a kind of locks but held for very short time to protect the memory structures of
the instance
64) Where does Oracle latch or lock occurs?
Oracle latch occurs in the memory structures i.e, in instance ex:buffer latch,redolog latch,shared
pool latch
Oracle lock occurs at block level to protect the integrity of the data as the data stored in the block
only ex: row lock,table lock etc
65) Where to see the information about latches?
v$latch and v$latch_children
66) How to switch from pfile to spfile?
SQL>create spfile from pfile;
bounce the database;
Now the database will pickup the spfile automatically
67) Explain the difference between a data block, an extent and a segment.
Data block is a lowest level storage structure, a block cannot span multiple extents
Extent is a set of block which resides inside the table space, an extent cannot span multiple
Segment is set of extents nothing but an object, a segment can spawn multiple datafiles
68) How to get the DDL of a table or index? i.e create statement?
SQL> select dbms_metadata.get_ddl(AISHU,T,TABLE) from dual
SQL> select dbms_metadata.get_ddl(TABLE,T,AISHU) from dual;





SQL> set long 1000

SQL> /





For user
SQL> select dbms_metadata.get_ddl(USER,AISHU) from dual;


69) What is the difference between a TEMPORARY tablespace and a PERMANENT tablespace?
Temporary table space for sorting and also used for temporary tables
Permanent table space contains the permanent or business data.
70) What is checkpoint? why database need it?
checkponit which occurs when ever the redolog switch happens,during this ckpt process writes the
check point information to control file and the data file header and tells to dbwr to flush the dirty
buffer from buffer cache to disk until that check point.
71) What is log switch, when does it occurs?

Log switch occurs when the current redo log is full and the log writer has to go to next redo log
71) Where to view the undo usage information?
72) How to set the log archive destination? can we have multiple destinations for
Yes we can have multiple destination for achivelogs
we can have 30 destination from 11g onwards
to see destiantion you can use follow and set accordingly
show parameter log_archive
SQL> alter system set log_archive_dest= scope=memory;
System altered.
SQL> alter system set log_archive_dest_1=location=/u02/archives/paddu scope=memory;
System altered.
SQL> alter system set log_archive_dest_2=location=/u01/archives/paddu scope=memory;
System altered.
73) Can you rename a database? Provide steps?
Yes, we can rename a database, we have two topins
Until 10g,
As the database name is written in control file we have to change the database name in control file
and in init file.
1. Alter Database backup control file to trace;
2. Above step will create a text control file in user_dump_dest directory.
3. Change name of the Database in above file and ininit.ora file.
5. Run the script that was modified in step 3
From 10g onwards
Using NID utility
If I am changing the database name , does mu backup are valid?

Invalid, Your database name is changed so the old backup backup in invalid as the name is old, rman
check with dbid and name.
74) Why you need to do open resetlogs, what does it?
Whenever there is recovery operation performed specifically incomplete media recovery , the
database must be open with reset logs since we dont have the archives or redo information until
point of failure, hence this is required. further this will reset the archive log sequence
75) How to multiplex controlfiles?
if we are using pfile:
show parameter control_files;
Note down the control file location
shut down the database
copy the control file old location to newer location
add the new control file location in parameter file
startup the database
show parameter control_files;(this shows the old and new location as well)
if we are using spfile:
show parameter control_files;
alter system set controlfile=oldlocation,newlocation scope=spfile
shut down the database
copy the control file from old location to new location
startup the database
76) How to multiplex redo log files?
alter database add log to group3;
77) How to add redo log groups to a database?
alter database add log size 50m group6;
v$log or v$logfiles;
78) Can you drop the redo log groups while the database is up and running?
Yes we can drop the redolog group but the redo log should be inactive
79) Can you drop the system tablespace, if so what happened to database?
No we cant drop the system tablespace.Oracle will not allow it
80) Can you drop the normal tablespace, if so what happened to database?
Yes we can drop the normal table spaces but the associated objects will be dropped

but the table space should be empty if not we have to use

SQL>drop tablespace tablespace name including contents;
if you want to drop the associated datafiles also with table space we should use
SQL>drop tablespace tablespace name including contents and datafiles;
81) What is the difference between Oracle home and oracle base
ORACLE_BASE is the root directory for oracle. ORACLE_HOME located beneath ORACLE_BASE is
where the oracle products reside.
82) Where do you check the free space of objects?
select * from dba_free_space;
83) How to kill the blocking session, how to find the blocking session?
We have to find the blocking session information by using
SQL>select sid,username,serial#,status,event,blocing_session from v$session where
Now check the blocking_session column for the sid that is blocking and confirm with the
application team to kill
Now execute
SQL> alter system kill session sid,serial# immediate;
alternatively we can also find the lock informatin in v$lock
84) Can you kill the pmon or smon or ckpt ? what happens to database?
These are all the mandatory process to run the database.if we kill any of the process the DB will be
85) Define the parameters for different pools of oracle instance?
shared pool:shared_pool_size;
DB buffer cache:db_cache_size;
java pool:java_pool_size;
stream pool:stream_pool_size;
Redolog buffer:log_buffer;
alternatively sga_max_size and sga_target should set to manage this pools automatically.
86) Consider the scenario below,

shared pool:shared_pool_size; 100m

DB buffer cache:db_cache_size; 100m
java pool:java_pool_size; 100m
largepool:large_pool_size; 100m
stream pool:stream_pool_size; 10m
Redolog buffer:log_buffer; 5m
Total SGA manually allocated in pools: 410M
I have also kept SGA_MAX_SIZE=400M in pfile and started the database which one the Oracle
consider, 410M or 400M
410M, if the sga_max_size is lesser than the all pools total if specified in pfile then sga_max_size
parameter is ignored.
86) List Process you follow to start looking into Performance issue at database level (If the
application is running very slow, at what points do you need to go about the database in
order to improve the performance?)
Answer ( Although i have never worked directly on performance issues, the below can be steps)
Run a TOP command in Unix to see CPU usage (identify CPU killer processes)
Run VMSTAT, SAR, and PRSTAT command to get more information on CPU and memory usage and
possible blocking
Run AWR report to identify:
2. RESOURCE intensive SQL statements
See if STATISTICS on affected tables needs to be re-generated
IF poorly written statements are culprit, run a EXPLAIN PLAN on these statements and see whether
new index or use of HINT brings the cost of SQL down.
87) Can you explain different modes of startup of oracle database?
No mount:starts the instance and bg process only
Mount:Oracle reads the control file and identify all the datafiles and kept them ready.
Open:The datafiles marked as read/write and database is now ready for operation.
88) Can you explain different modes of shutdown of oracle database?
close:all the changes in the buffer cache will be pushed to datafiles and existed session will be
disconnected and no new sessions will be permitted.

dismount: All the datafiles will be closed

instance shut down:bg wil be stopped and memory pools will be cleared from OS.
89) How to know how many oracle homes or oracle instances exists in database host?
Once the oracle installation is completed the installer will update the file called /etc/oratab with
new home with this file we can find how many homes are existed
To find how many instances are running use
ps -eaf | grep pmon
90) What is the difference between putty and sqlplus?
Putty is an ssh client to connect to the database host from remotely.
SQL database connectivity tool to connect to the database using tns names entry
91) What is tns string?
tns string is an entry to identify the database host,db port and the db name.Oracle will use oracle
sqlplus will use this entries appropriate or right database host.
92) What is tnsentry?
Tns entry is a address to the database host and database written in the tnsnames.ora,
generally tnsnames.ora located at $ORACLE_HOME/network/admin
92) How to change the database into archivelog mode?
SQL> archive log list;
Database log mode

Archive Mode

Automatic archival


Archive destination


Oldest online log sequence


Next log sequence to archive 26

Current log sequence


We have to bring the db to mount mode and then use

SQL>alter database close;(This brings the db to mount mode)
SQL>alter database archive log;
SQL>startup force;
To disable the archive log just use
SQL>alter database noarchivelog;

93) How to set the password to expiry of 90 days?

identify the profile for that user
SQL> select username,default_profile from dba_user where username=user';
SQL> select * from dba_profiles where profile=DEFAULT';
change the profile for password life time
SQL> alter profile default set limit=PASSWORD_LIFE_TIME=90;
94) How to set the new password for Oracle user?
alter user username identified by newpassword;
95) How to set the same password to oracle user when the password is expired?
select username,password from dba_users where username=username';
SQL>alter user username identified by values above password';
96) Where do you find the password for oracle user?
select username,password from dba_users where username=username';
97)How to set new undo tablespace in oracle database?
create a new undo tablespace
SQL> create undo tablespace undotbs4 datafile /u01/oradata/paddu/undotbs4.dbs size 100m;
Tablespace created.
SQL> show parameter undo_tablespace;






SQL> alter system set undo_tablespace=UNDOTBS4 scope=spfile;

System altered.
SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 263049216 bytes

Fixed Size

2212448 bytes

Variable Size

167775648 bytes

Database Buffers
Redo Buffers

88080384 bytes
4980736 bytes

Database mounted.
Database opened.
SQL> show parameter undo_tablespace;






100) Renaming schema
Fastest Way, since the original import will not happen only metadata creation will happen, as
the transportable import has been performed, In TTS the associated datafiles will be attached
to new user , hence the datafiles with existing object(tables/indexex etc) will be point to new
1. create user new_user
2. grant to new_user;
3. execute dbms_tts.transport_set_check();
4. alter tablespace read only;
5. exp transport_tablespace=y tablespaces=
6. drop tablespace including contents;
7. imp transport_tablespace=y tablespaces= datafiles= fromuser=old_user touser=newuser
8. create nondata objects in new_user schema
9. [drop user old_user cascade;]
10. alter tablespace read write;