oracle technical interview questions for an oracle dba

20
Oracle Listener The listener is a process running on a node that listenes for incoming connections on behlf of a database or a number of databases. The following are the characteristics of a listener: A listener process can listen for more than one database Multiple listeners can listen on behalf of a single database to perform load balancing The listener can listen for multiple protocols The default name of the listener in Oracle Net is LISTENER The name of the listener must be unique per listener.ora file When an instance is started, Initialization parameters about the listener are read from the init.ora file by which PMON registers information with the listener. If a listener is not up when the instance starts, PMON will not register information with the listener. PMON will continue attempting to contact the listener. The listener will reject any connections made to an unregistered service. The listener.ora file The listener.ora file is used to configure the listener for static service registration. The listener.ora file must reside on the machine or node on which the listener is to reside. The listener.ora file contains configuration information for the following: The listener name The listener address Databases that use the listner Listener parameters e.g. LISTENER = (ADDRESS_LIST = (ADDRESS = (PROTOCOL=TCP)(Host=stc-sun02)(Port=1521)) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (ORACLE_HOME = /home/oracle) (GLOBAL_DBNAME = ORCL.us.oracle.com) (SID_NAME = ORCL) ) …… Use the following commands to control the listener: START [ listener_name] STOP [listener_name] LSNRCTL Commands

Upload: papusaha

Post on 27-Dec-2015

29 views

Category:

Documents


0 download

DESCRIPTION

oracle

TRANSCRIPT

Page 1: Oracle Technical Interview Questions for an Oracle DBA

Oracle Listener

The listener is a process running on a node that listenes for incoming connections on behlf of a database or a number of databases. The following are the characteristics of a listener:

A listener process can listen for more than one database Multiple listeners can listen on behalf of a single database to perform load balancing The listener can listen for multiple protocols The default name of the listener in Oracle Net is LISTENER The name of the listener must be unique per listener.ora file

When an instance is started, Initialization parameters about the listener are read from the init.ora file by which PMON registers information with the listener. If a listener is not up when the instance starts, PMON will not register information with the listener. PMON will continue attempting to contact the listener. The listener will reject any connections made to an unregistered service.

The listener.ora fileThe listener.ora file is used to configure the listener for static service registration. The listener.ora file must reside on the machine or node on which the listener is to reside.

The listener.ora file contains configuration information for the following:

The listener name The listener address Databases that use the listner Listener parameters

e.g. LISTENER = (ADDRESS_LIST = (ADDRESS = (PROTOCOL=TCP)(Host=stc-sun02)(Port=1521)) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (ORACLE_HOME = /home/oracle) (GLOBAL_DBNAME = ORCL.us.oracle.com) (SID_NAME = ORCL) ) ……

Use the following commands to control the listener:

START [ listener_name] STOP [listener_name]

LSNRCTL CommandsCommand DescriptionCHANGE_PASSWORD Dynamically changes the encrypted password of a listener.EXIT Quits the LSNRCTL utilityHELP Provides the list of all available LSNRCTL commandsQUIT Provides the functionality of the EXIT commandRELOAD Shuts down everything except listener addresses and rereads the

listener.ora file. You use this command to add or change services without actually stopping the listener.

SAVE_CONFIG Creates a backup of your listener configuration file (called listener.bak) and updates the listener.ora file itself to reflect any changes

SERVICES Provides detailed information about the services the listener listens for SET parameter This command sets a listener parameter

Page 2: Oracle Technical Interview Questions for an Oracle DBA

SHOW parameter This command lists the value of a listener parameter.

SET and SHOW ModifiersCommand DescriptionSET CONNECT_TIMEOUT Determines the amount of time the listener waits for a valid

connection request after a connection has been startedSET CURRENT_LISTENER Sets or shows parameters when multiple listeners are usedSET LOG_DIRECTORY Sets a nondefault location for the log file or to return the location

to the default.SET LOG_FILE Sets a nondefault name for the log file.SET LOG_STATUS Turns listener logging on or offSET PASSWORD Changes the password sent from the LSNRCTL utility to the

listener process for authentication purpose only.SET SAVE_CONFIG_ON_STOP Saves any changes made by the LSNRCTL SET command

permanently if the parameter is on. All parameters are saved right before the listener exits.

SET STARTUP_WAITTIME Sets the amount of time the listener sleeps before responding to a START command

SET TRC_DIRECTORY Sets a nondefault location for the trace file or to return the location to the default

SET TRC_FILE Sets a nondefault name for the trace fileSET TRC_LEVEL Turns on tracing for the listener

Sample TNSNAMES.ORA file at Server Side

################################################################# This file is automatically generated by AutoConfig. It will be read and# overwritten. If you were instructed to edit this file, or if you are not# able to use the settings created by AutoConfig, refer to Metalink document# 165195.1 for assistance.##$Header: NetServiceHandler.java 115.51 2006/10/19 09:14:49 nsugguna ship $################################################################

HDEV1= (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=cidcscfshrdev1.cidc.cummins.com)(PORT=4801)) (CONNECT_DATA= (SID=HDEV1) ) )

HDEV1_806_BALANCE= (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=cidcscfshrdev1.cidc.cummins.com)(PORT=4801)) (CONNECT_DATA= (SID=HDEV1) ) )

HDEV1_FO= (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=cidcscfshrdev1.cidc.cummins.com)(PORT=4801)) (CONNECT_DATA= (SID=HDEV1) ) )

HDEV1_BALANCE= (DESCRIPTION= (LOAD_BALANCE=YES) (FAILOVER=YES) (ADDRESS_LIST= (ADDRESS=(PROTOCOL=tcp)(HOST=cidcscfshrdev1.cidc.cummins.com)(PORT=4801)) )

Page 3: Oracle Technical Interview Questions for an Oracle DBA

(CONNECT_DATA= (SID=HDEV1) ) )

FNDFS_CIDCSCFSHRDEV1= (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=cidcscfshrdev1.cidc.cummins.com)(PORT=4802)) (CONNECT_DATA= (SID=FNDFS) ) )

FNDFS_CIDCSCFSHRDEV1.cidc.cummins.com= (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=cidcscfshrdev1.cidc.cummins.com)(PORT=4802)) (CONNECT_DATA= (SID=FNDFS) ) )

FNDFS_HDEV1_CIDCSCFSHRDEV1= (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=cidcscfshrdev1.cidc.cummins.com)(PORT=4802)) (CONNECT_DATA= (SID=FNDFS) ) )

FNDFS_HDEV1_CIDCSCFSHRDEV1.cidc.cummins.com= (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=cidcscfshrdev1.cidc.cummins.com)(PORT=4802)) (CONNECT_DATA= (SID=FNDFS) ) )

FNDSM_CIDCSCFSHRDEV1_HDEV1= (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=cidcscfshrdev1.cidc.cummins.com)(PORT=4802)) (CONNECT_DATA= (SID=FNDSM) ) )

FNDSM_CIDCSCFSHRDEV1.cidc.cummins.com_HDEV1= (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=cidcscfshrdev1.cidc.cummins.com)(PORT=4802)) (CONNECT_DATA= (SID=FNDSM) ) )

Rep60_HDEV1,Rep60_HDEV1.world=(ADDRESS=(PROTOCOL=tcp)(HOST=cidcscfshrdev1)(PORT=4803))

IFILE=/u02/app/applmgr/HDEV1/8.0.6/network/admin/HDEV1/HDEV1_ifile.ora

Sample Sqlnet.ora file

sqlnet.expire_time = 5

Sample Listener.ora file# $Header: admk80ln_ux.sql 115.27 2006/05/09 21:18:41 mmanku ship $# LISTENER.ORA For Oracle Applications# This file is automatically generated

APPS_HDEV1 = (ADDRESS_LIST = (ADDRESS= (PROTOCOL= TCP)(Host= cidcscfshrdev1)(Port= 4802)) )

Page 4: Oracle Technical Interview Questions for an Oracle DBA

SID_LIST_APPS_HDEV1 = (SID_LIST = ( SID_DESC = ( SID_NAME = FNDSM ) ( ORACLE_HOME = /u02/app/applmgr/HDEV1/8.0.6 ) ( PROGRAM = /u02/app/applmgr/HDEV1/11i/fnd/11.5.0/bin/FNDSM ) ( envs='MYAPPSORA=/u02/app/applmgr/HDEV1/11i/APPSHDEV1.env,PATH=/usr/bin:/usr/ccs/bin:/bin,FNDSM_SCRIPT=/u02/app/applmgr/HDEV1/common/admin/scripts/HDEV1/gsmstart.sh' ) ) ( SID_DESC = ( SID_NAME = FNDFS ) ( ORACLE_HOME = /u02/app/applmgr/HDEV1/8.0.6 ) ( PROGRAM = /u02/app/applmgr/HDEV1/11i/fnd/11.5.0/bin/FNDFS ) ( envs='EPC_DISABLED=TRUE,NLS_LANG=American_America.UTF8,LD_LIBRARY_PATH=/usr/dt/lib:/usr/openwin/lib:/u02/app/applmgr/HDEV1/8.0.6/lib,SHLIB_PATH=/usr/lib:/usr/dt/lib:/usr/openwin/lib:/u02/app/applmgr/HDEV1/8.0.6/lib,LIBPATH=/usr/dt/lib:/usr/openwin/lib:/u02/app/applmgr/HDEV1/8.0.6/lib,APPLFSTT=HDEV1_FO;HDEV1_BALANCE;HDEV1;HDEV1_806_BALANCE,APPLFSWD=/u02/app/applmgr/HDEV1/11i/admin;/u02/app/applmgr/HDEV1/temp;/u02/app/applmgr/HDEV1/common/html/oam/nonUix/launchMode/restricted' ) ) )

# Listener general parameters

STARTUP_WAIT_TIME_APPS_HDEV1 = 0CONNECT_TIMEOUT_APPS_HDEV1 = 10TRACE_LEVEL_APPS_HDEV1 = OFFLOG_DIRECTORY_APPS_HDEV1 = /u02/app/applmgr/HDEV1/8.0.6/network/adminLOG_FILE_APPS_HDEV1 = APPS_HDEV1TRACE_DIRECTORY_APPS_HDEV1 = /u02/app/applmgr/HDEV1/8.0.6/network/adminTRACE_FILE_APPS_HDEV1 = APPS_HDEV1ADMIN_RESTRICTIONS_APPS_HDEV1 = OFFIFILE = /u02/app/applmgr/HDEV1/8.0.6/network/admin/HDEV1/HDEV1_listener_ifile.ora

HDEV1_listener_ifile.oraCHN1 = (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=cidcscfshrdev1)(PORT=4901)) (CONNECT_DATA=(SID=CHN1)) )

HGOLD= (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=ftdcscfshrtst1.ftdc.cummins.com)(PORT=4701)) (CONNECT_DATA= (SID=HGOLD) ) )

#HPRD3=# (DESCRIPTION=# (ADDRESS=(PROTOCOL=tcp)(HOST=cidcscfshrprd1.cidc.cummins.com)(PORT=6801))# (CONNECT_DATA=# (SID=HPRD3)# )# )##HPXY2=# (DESCRIPTION=# (ADDRESS=(PROTOCOL=tcp)(HOST=ftdcscfshrprx1.ftdc.cummins.com)(PORT=5401))# (CONNECT_DATA=# (SID=HPXY2)# )# )#CILCST_TST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 160.95.215.178)(PORT = 1561)) (CONNECT_DATA = (SERVICE_NAME = CSTTST)) )

The sqlnet.ora file controls the behavior of Oracle Net Services

Oracle Server Configuration Options

Page 5: Oracle Technical Interview Questions for an Oracle DBA

Oracle creates server processes to handle the requests of user processes connected to an instance. A server process can be either a dedicated server process, where one server process services only one user process, or it can be a shared server process, where a server process can service multiple user processes. Shared server processes are a part of Oracle shared server architecture.

Dedicated Server Processes The user process and server process are separate Each user process has its own server process The user and server processes can run on different machines to take advantage of distributed processing There is one-to-one ratio between the user and server processes Even when the user process is not making a database request, the dedicated server exists but remains

idle.

Adding or Removing Dispatchers If the load on the dispatcher processes is consitently high, start additional dispatcher processes to route

user requests without waiting. You may start new dispatchers until the number of dispatchers equals MAX_DISPATCHER.

The load on the dispatchers can be monitored using the data dictionary views V$CIRCUIT and V$DISPATCHER

In contrast, if the loan on dispatchers is consistently low, reduce the number of dispatchers

Useful Dictionary Views Summarized

V$CIRCUIT This view contains information about virtual circuits which are user connections to the database through dispatchers and servers

V$SHARED_SERVER This view contains information on the shared server processesV$DISPATCHER This view provides information on the dispatcher processesV$SHARED_SERVER_MONITOR This view contains information for tuning the shared server

processesV$QUEUE This view contains information on request and response queuesV$SESSION This view lists session information for each current session

Oracle Instance An oracle instance consists of memory areas (mainly system global area (SGA) and background processes, namely PMON, SMON, DBWn, LGWR, and CKPT. An instance is created during the nomount stage of the database startup after the parameter file has been read. If any of these processes terminate, the instance shuts down.

Memory structures

Type DescriptionDatabase buffer cache

Memory area used to store blocks read from data files. Data is read into the blocks by server processes and written out by DBWn asynchronously.

Log Buffer Memory containing before and after image copies of changed data to be written to the redo logs

Large pool An optional area in the SGA that provides large memory allocations for backup and restore operations, I/o server processes, and session memory for the shared server and oracle XA.

Shared pool Stores parsed versions of SQL statements, PL/SQL procedures, and data dictionary information

Page 6: Oracle Technical Interview Questions for an Oracle DBA

Background Processes

Type DescriptionDatabase writer (DBWn)

Writes dirty buffers from the data buffer cache to the data files. This activity is asynchronous.

Log Writer (LGWR) Writes data from the redo log buffer to the redo log filesSystem Monitor (SMON)

Performs automatic instance recovery. Recovers space in temporary segments when they are no longer in use. Merges contiguous areas of free space depending on parameters that are set.

Process Monitor (PMON)

Cleans up the connections/server process dedicated to an abnormally terminated user process. Performs rollback and releases the resources held by the failed process.

Checkpoint (CKPT) Synchronizes the headers of the data files and control files with the current redo log and checkpoint numbers.

Archiver (ARCn)(Optional)

A process that automatically copies redo logs that have been marked for archiving

An Oracle database consists of the following physical files :

File Type Description TypeDatafiles Physical storage of data. At lease one file

is required per database. This file stores the system tablespace

Binary

Redo logs Contain before and after image copies of changed data, for recovery purposes. At least two groups are required

Binary

Control files Record the status of the database, physical structure, and RMAN meta data

Binary

Parameter file

Store parameters required for instance startup

Text

ServerParameter file

Store persistent parameters required for instance startup

Binary

Password file (optional)

Store information on users who can start, stop, and recover the database

Binary

Archive logs(optional)

Physical copies of the online redo log files. Created when the database is set in Archive log mode. Used in recovery

Binary

Page 7: Oracle Technical Interview Questions for an Oracle DBA

Important Dynamic views

View Name DescriptionV$SGA Queries the size of the instance for the shared pool, log buffer, data buffer cache

and fixed memory sizes (operating system-dependent)V$INSTANCE Queries the status of the instance, such as the instance mode, instance name,

startup time, and host nameV$PROCESS Queries the background and server processes created for the instanceV$BGPROCESS Queries the background processes created for the instanceV$DATABASE Lists status and recovery information about the database. It includes information

on the database name, the unique database identifier, the creation data, the control file creation date and time, the last database checkpoint, and other information

V$DATAFILE Lists the location and names of the data files that are contained in the database. It

Instance

SGA Shared SQL and PL/SQL

Data Dict. Cache

Java pool Large pool

Database Buffer Cache

Redo log buffer

SMON CKPT

DBWn PMON LGWR

ARCn

User Process

Serverr Process PGA

Database

Datafile1

Datafile2

Datafile3

ControlFile

Redo Log file 2

Redo Log file 1

ArchivedLog FilesParameter

file

Password file

Page 8: Oracle Technical Interview Questions for an Oracle DBA

includes information relating to the file number and name, creation date, status (online or offline), enabled (read-only, read-write), last data file checkpoint, size, and other information

Large Pool

Can be configured as separate memory area in the SGA to be used for: Oracle backup and restore operations I/O server processes Session memory for the shared servers

Is sized by the LARGE_POOL_SIZE parameter

Minimum 300K

SELECT * FROM v$sgastatWHERE pool = ‘large pool’;

Function of the LGWR Background processThe log writer LGWR) writes redo entries from the redo log buffer to the redo log files as follows:

When the redo log buffer is one-third full When a timeout occurs When there is 1 MB of redo Before DBWn writes modified blocks in the database buffer cache to the data files When a transaction commits

Oracle Technical Interview Questions for an Oracle DBA

1. What is an Oracle Instance?Answer : An Oracle instance is the combination of the background processes and memory structures.

2. What information is stored in Control File?Answer : The information in the control file includes:

• Database name is taken from either the name specified by the initialization parameter DB_NAME or the name used in the CREATE DATABASE statement.• Database identifier is recorded when the database is created.• Time stamp of database creation is also recorded at database creation.• Names and locations of associated data files and online redo log files are updated when a data file or redo log is added to, renamed in, or dropped from the database.• Tablespace information is updated as tablespaces are added or dropped.• Redo log history is recorded during log switches.• Location and status of archived logs are recorded when archiving occurs.• Location and status of backups are recorded by the Recovery Manager utility.• Current log sequence number is recorded when log switches occur.• Checkpoint information is recorded as checkpoints are made.

Page 9: Oracle Technical Interview Questions for an Oracle DBA

3. When you start an Oracle DB which file is accessed first?Answer : Reading the initialization file from $ORACLE_HOME/dbs in the following order:

– First spfileSID.ora. If not found then– spfile.ora– initSID.ora

4. What is the Job of  SMON, PMON processes?Answer : The system monitor process (SMON) performs recovery, if necessary, at instance startup. SMON is also responsible for cleaning up temporary segments that are no longer in use and for coalescing contiguous free extents within dictionary managed tablespaces. If any terminated transactions were skipped during instance recovery because of file-read or offline errors, SMON recovers them when the tablespace or file is brought back online. SMON checks regularly to see whether it is needed. Other processes can call SMON if they detect a need for it.With Real Application Clusters, the SMON process of one instance can perform instance recovery for a failed CPU or instance

The process monitor (PMON) performs process recovery when a user process fails. PMON is responsible for cleaning up the database buffer cache and freeing resources that the user process was using. For example, it resets the status of the active transaction table, releases locks, and removes the process ID from the list of active processes.

PMON periodically checks the status of dispatcher and server processes, and restarts any that have stopped running (but not any that Oracle has terminated intentionally). PMON also registers information about the instance and dispatcher processes with the network listener.

Like SMON, PMON checks regularly to see whether it is needed and can be called if another process detects the need for it.

5. What is Instance Recovery?Answer : When an Oracle instance fails, Oracle performs an instance recovery when the associated database is re-started. Instance recovery occurs in two steps: Cache recovery: Changes being made to a database are recorded in the database buffer cache. These changes are also recorded in online redo log files simultaneously. When there are enough data in the database buffer cache, they are written to data files. If an Oracle instance fails before the data in the database buffer cache are written to 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 cache recovery. Transaction recovery: When a transaction modifies data in a database, the before image of the modified data is stored in an undo segment. The data stored in the undo segment is used to restore the original values in case a transaction is rolled back. At the time of an instance failure, the database may have uncommitted transactions. It is possible that changes made by these uncommitted transactions have gotten saved in data files. To maintain read consistency, Oracle rolls back all uncommitted transactions when the associated database is re-started. Oracle uses the undo data stored in undo segments to accomplish this. This process is called transaction recovery.

6. What is written in Redo Log Files?Answer : Each Oracle database has a redo log. This redo log records all changes made in datafiles.

7. How do you control number of Datafiles one can have in an Oracle database?

8. How many Maximum Datafiles can there be in an Oracle Database?

9. What is a Tablespace?Answer : A tablespace is a logical storage unit within an Oracle database. It is logical because a tablespace is not visible in the file system of the machine on which the database resides. A tablespace, in turn, consists of at least one datafile which, in turn, are physically located in the file system of the server.

10. What is the purpose of  Redo Log files?Answer : Redo logs are transaction journals. Each transaction is recorded in the redo logs.

Page 10: Oracle Technical Interview Questions for an Oracle DBA

11. Which default Database roles are created when you create a Database?Answer : CONNECT, RESOURCE, DBA EXP_FULL_DATABASE IMP_FULL_DATABASE DELETE_CATALOG_ROLE EXECUTE_CATALOG_ROLE EXECUTE SELECT_CATALOG_ROLE

12. What is a Checkpoint?An event called a checkpoint occurs when the Oracle background process DBWn writes all the modified database buffers in the SGA, including both committed and uncommitted data, to the data files.Checkpoints are implemented for the following reasons:• Checkpoints ensure that data blocks in memory that change frequently are written to data files regularly. Because of the least recently used algorithm of DBWn, a data block that changes frequently might never qualify as the least recently used block and thus might never be written to disk if checkpoints did not occur.• Because all database changes up to the checkpoint have been recorded in the data files, redo log entries before the checkpoint no longer need to be applied to the data files if instance recovery is required. Therefore, checkpoints are useful because they can expedite instance recovery. At a checkpoint, the following information is written:• Checkpoint number into the data file headers• Checkpoint number, log sequence number, archived log names, and system changenumbers into the control file.CKPT does not write data blocks to disk or redo blocks to the online redo logs.

13. Which Process reads data from Datafiles? The server process first checks the buffer cache for the presence of data. If not found then only copy the data from datafile to buffer cache. Then send the data to the client.

14. Which Process writes data in Datafiles?DBWn writes data in Datafile.

15. Can you make a Datafile auto extendible. If yes, how?Yes, use EXTENT MANAGEMENT LOCAL AUTOALLOCATE while creating tablespace.

16. What is a Shared Pool?Shared pool stores parsed version of SQL statements, PL/SQL procedures, and data dictionary information.

17. What is kept in the Database Buffer Cache?Memory area used to store blocks read from data files. Data is read into the blocks by server processes and written out by DBWn asynchronously.

18. How many maximum Redo Logfiles one can have in a Database?Depends on what you specified for MAXLOGFILES during database creation (manually) or what you specified for "Maximum no. of redo log files" with DBCA

19. What is difference between PFile and SPFile?A PFILE is a static, client-side text file that must be updated with a standard text editor like "notepad" or "vi". This file normally reside on the server, however, you need a local copy if you want to start Oracle from a remote machine. DBA's commonly refer to this file as the INIT.ORA file.

An SPFILE (Server Parameter File), on the other hand, is a persistent server-side binary file that can only be modified with the "ALTER SYSTEM SET" command. This means you no longer need a local copy of the pfile to start the database from a remote machine. Editing an SPFILE will corrupt it, and you will not be able to start your database anymore.

20.  What is PGA_AGGREGRATE_TARGET parameter?

Page 11: Oracle Technical Interview Questions for an Oracle DBA

21. Large Pool is used for what?An optional area in the SGA that provides large memory allocations for backup and restore operatins, I/O server processes, and session memory for the shared server.

22. What is PCT Increase setting?The percent of increase in extent size after NEXT extent and thereafter.

23. What is PCTFREE and PCTUSED Setting?PCTFREE for a data segment specifies the percentage of space in each data block reserved for growth resulting from updates to rows in the block. The default for PCTFREE is 10%.PCTUSED for a data segment represents the minimum percentage of used space that the oracle server tries to maintain for each data block of the table. A block is put back on the free list when its used space falls below PCTUSED.

24. What is Row Migration and Row Chaining?

A migrated row is a row that was moved to another block due to an update making it too large to fit on its original block with the other rows there. We cannot just "move" the row -- we have lots of indexes pointing to the original block. We therefore leave behind a forwarding address on the original block and migrate the updated row to a new block. now, when you access that row, we discover it is not really there -- it is migrated and we read the other block to get it.

A chained row is a row that is too large to fit on a single block. If you have a 2k blocksize but your row size is 4k, we will use 3 blocks to store that row in pieces. Any table with a long/long raw will have chained rows. Any table whose rowsize exceeds the blocksize will have chained rows. Any table with more then 255 columns will have chained rows (we break really wide tables up).

25. What is 01555 - Snapshot Too Old error and how do you avoid it?

26. What is a Locally Managed Tablespace?

27. Can you audit SELECT statements?

28. What does DBMS_FGA package do?

29. What is Cost Based Optimization?

30. How often you should collect statistics for a table?

31. How do you collect statistics for a table, schema and Database?32. Can you make collection of Statistics for tables automatic?33. On which columns you should create Indexes?34. What type of Indexes are available in Oracle?35. What is B-Tree Index?36. A table is having few rows, should you create indexes on this table?37. A Column is having many repeated values which type of index you should create on this column, if you have to?38. When should you rebuilt indexes?39. Can you built indexes online?40. Can you see Execution Plan of a statement.41. A table is created with the following setting

      storage (initial 200k                    next 200k                    minextents 2

Page 12: Oracle Technical Interview Questions for an Oracle DBA

                   maxextents 100                    pctincrease 40)

     What will be size of 4th extent?

42. What is DB Buffer Cache Advisor?

43. What is STATSPACK tool?

44. Can you change SHARED_POOL_SIZE online?

45. Can you Redefine a table Online?

46. Can you assign Priority to users?

47. You want users to change their passwords every 2 months. How do you enforce this?

48. How do you delete duplicate rows in a table?

49. What is Automatic Management of Segment Space setting?

50. What is the difference between DELETE and TRUNCATE statements?

51. What is COMPRESS and CONSISTENT setting in EXPORT utility?

52. What is the difference between Direct Path and Convention Path loading?

53. Can you disable and enable Primary key?

54. What is an Index Organized Table?

55. What is a Global Index and Local Index?

56. What is the difference between Range Partitioning and Hash Partitioning?

57. What is difference between Multithreaded/Shared Server and Dedicated Server?

58. Can you import objects from Oracle ver. 7.3 to 9i?

59. How do you move tables from one tablespace to another tablespace?

60. How do see how much space is used and free in a tablespace?

Unix Related Interview Questions for an Oracle DBA

  In many Oracle DBA interviews  many questions are asked relating to Unix. Here I have collected some common Interviews questions asked to a DBA relating to Unix environment. These questions are mostly asked for senior Oracle DBA positions. I have compiled these

Page 13: Oracle Technical Interview Questions for an Oracle DBA

questions based upon the feedback I got from many candidates who have attended interviews in various MNC's

  1. How do you see how many instances are running?

2. How do you automate starting and shutting down of databases in Unix?

3. You have written a script to take backups. How do you make it run automatically every week?

4. What is OERR utility?

5. How do you see Virtual Memory Statistics in Linux?

6. How do you see how much hard disk space is free in Linux?

7. What is SAR?

8. What is SHMMAX?

9. Swap partition must be how much the size of RAM?

10. What is DISM in Solaris?11. How do you see how many memory segments are acquired by Oracle Instances?

12. How do you see which segment belongs to which database instances?

13. What is VMSTAT?

14. How do you set Kernel Parameters in Red Hat Linux, AIX and Solaris?

15. How do you remove Memory segments?

16. What is the difference between Soft Link and Hard Link?

17. What is stored in oratab file?

18. How do you see how many processes are running in Unix?

19. How do you kill a process in Unix?

20. Can you change priority of a Process in Unix?

Backup and Recovery Interview Questions for an Oracle DBA

 

Some of the Common Backup and Recovery Interview Questions for Oracle Database Administrator.  These questions are common for both Senior Oracle DBA or Junior DBA. I have compiled these questions based upon the feedback I got from many candidates who have attended interviews in various MNC's

1. Which types of backups you can take in Oracle?

Page 14: Oracle Technical Interview Questions for an Oracle DBA

2. A database is running in NOARCHIVELOG mode then which type of backups you can take?

3. Can you take partial backups if the Database is running in NOARCHIVELOG mode?

4. Can you take Online Backups if the the database is running in NOARCHIVELOG mode?

5. How do you bring the database in ARCHIVELOG mode from NOARCHIVELOG mode?

6. You cannot shutdown the database for even some minutes, then in which mode you should run the database?

7. Where should you place Archive logfiles, in the same disk where DB is or another disk?

8. Can you take online backup of a Control file if yes, how?

9. What is a Logical Backup?

10. Should you take the backup of Logfiles if the database is running in ARCHIVELOG mode?

11. Why do you take tablespaces in Backup mode?

12. What is the advantage of RMAN utility?

13. How RMAN improves backup time?

14. Can you take Offline backups using RMAN?

15. How do you see information about backups in RMAN?

16. What is a Recovery Catalog?

17. Should you place Recovery Catalog in the Same DB?

18. Can you use RMAN without Recovery catalog?

19. Can you take Image Backups using RMAN?

20. Can you use Backupsets created by RMAN with any other utility?21. Where RMAN keeps information of backups if you are using RMAN without Catalog?

22. You have taken a manual backup of a datafile using o/s. How RMAN will know about it?

23. You want to retain only last 3 backups of datafiles. How do you go for it in RMAN?

24. Which is more efficient Incremental Backups using RMAN or Incremental Export?

25. Can you start and shutdown DB using RMAN?

26. How do you recover from the loss of datafile if the DB is running in NOARCHIVELOG mode?

27. You loss one datafile and it does not contain important objects. The important objects are there in other datafiles which are intact. How do you proceed in this situation?

28. You lost some datafiles and you don't have any full backup and the database was running in NOARCHIVELOG mode. What you can do now?

Page 15: Oracle Technical Interview Questions for an Oracle DBA

29. How do you recover from the loss of datafile if the DB is running in ARCHIVELOG mode?

30. You loss one datafile and DB is running in ARCHIVELOG mode. You have full database backup of 1 week old and partial backup of this datafile which is just 1 day old. From which backup should you restore this file?

31. You loss controlfile how do you recover from this?

32. The current logfile gets damaged. What you can do now?

33. What is a Complete Recovery?

34. What is Cancel Based, Time based and Change Based Recovery?

35. Some user has accidentally dropped one table and you realize this after two days. Can you recover this table if the DB is running in ARCHIVELOG mode?

36. Do you have to restore Datafiles manually from backups if you are doing recovery using RMAN?

37. A database is running in ARCHIVELOG mode since last one month. A datafile is added to the database last week. Many objects are created in this datafile. After one week this datafile gets damaged before you can take any backup. Now can you recover this datafile when you don't have any backups?

38. How do you recover from the loss of a controlfile if you have backup of controlfile?

39. Only some blocks are damaged in a datafile. Can you just recover these blocks if you are using RMAN?

40. Some datafiles were there on a secondary disk and that disk has become damaged and it will take some days to get a new disk. How will you recover from this situation?41. Have you faced any emergency situation. Tell us how you resolved it?42. At one time you lost parameter file accidentally and you don't have any backup. How you will recreate a new parameter file with the parameters set to previous values.

15. What is Consistent Backup?A Consistent backup is one in which the files being backed up contain all changes upto the same system change number (SCN)

16. What is fractured Block?Because the database continues writing to the file during an online backup, there is the possibility of backing up inconsistent data within a block. For example, assume that either RMAN or an operating system utility reads the block while database writer is in the middle of updating the block. In this case, RMAN or the copy utility could read the old data in the top half of the block and the new data in the bottom top half of the block. The block is a fractured block, meaning that the data in this block is not consistent.

17. What are the steps to performing complete recovery on the whole database?

Mount the database Ensure that all datafiles you want to recover are online Restore a backup of the whole database or the files you want to recover Apply online or archived redo logs, or a combination of the two

18. What are the steps to performing complete recovery on a tablespace or datafile?

Take the tablespace or datafile to be recovered offline if the database is open Restore a backup of the datafiles you want to recover Apply online or archived redo logs, or a combination of the two

Page 16: Oracle Technical Interview Questions for an Oracle DBA