You are on page 1of 56




As an Oracle DBA, you must understand the concepts of Oracle architecture clearly. It is a basic
step or main point that you need before you go to manage your database. By this article, I will try
to share my knowledge about it. Hope it can be useful for you.
What is An Oracle Database?
Basically, there are two main components of Oracle database –– instance and database itself. An
instance consists of some memory structures and the background processes, whereas a database
refers to the disk resources. Figure 1 will show you the relationship.

Figure 1. Two main components of Oracle database
As we cover above, the memory structures and background processes contitute an instance. The
memory structure itself consists of System Global Area (SGA), Program Global Area (PGA), and an
optional area –– Software Area Code. In the other hand, the mandatory background processes are
Database Writer (DBWn), Log Writer (LGWR), Checkpoint (CKPT), System Monitor (SMON), and
Process Monitor (PMON). And another optional background processes are Archiver (ARCn),
Recoverer (RECO), etc. Figure 2 will illustrate the relationship for those components on an

Figure 2. The instance components


System Global Area

SGA is the primary memory structures. When Oracle DBAs talk about memory, they usually mean
the SGA. This area is broken into a few of part memory –– Buffer Cache, Shared Pool, Redo Log
Buffer, Large Pool, and Java Pool.
Buffer Cache
Buffer cache is used to stores the copies of data block that retrieved from datafiles. That is, when
user retrieves data from database, the data will be stored in buffer cache. Its size can be
manipulated via DB_CACHE_SIZE parameter in init.ora initialization parameter file.
Shared Pool
Shared pool is broken into two small part memories –– Library Cache and Dictionary Cache. The
library cache is used to stores information about the commonly used SQL and PL/SQL statements;
and is managed by a Least Recently Used (LRU) algorithm. It is also enables the sharing those
statemens among users. In the other hand, dictionary cache is used to stores information about
object definitions in the database, such as columns, tables, indexes, users, privileges, etc.
The shared pool size can be set via SHARED_POOL_SIZE parameter in init.ora initialization
parameter file.
Redo Log Buffer
Each DML statement (insert, update, and delete) executed by users will generates the redo entry.
What is a redo entry? It is an information about all data changes made by users. That redo entry
is stored in redo log buffer before it is written into the redo log files. To manipulate the size of
redo log buffer, you can use the LOG_BUFFER parameter in init.ora initialization parameter file.
Large Pool
Large pool is an optional area of memory in the SGA. It is used to relieves the burden place on the
shared pool. It is also used for I/O processes. The large pool size can be set by
LARGE_POOL_SIZE parameter in init.ora initialization parameter file.
Java Pool
As its name, Java pool is used to services parsing of the Java commands. Its size can be set by
JAVA_POOL_SIZE parameter in init.ora initialization parameter file.
Program Global Area
Although the result of SQL statemen parsing is stored in library cache, but the value of binding
variable will be stored in PGA. Why? Because it must be private or not be shared among users.
The PGA is also used for sort area.
Software Area Code
Software area code is a location in memory where the Oracle application software resides.
Oracle Background Processes
Oracle background processes is the processes behind the scene that work together with the
Database writer (DBWn) process is used to write data from buffer cache into the datafiles.
Historically, the database writer is named DBWR. But since some of Oracle version allows us to
have more than one database writer, the name is changed to DBWn, where n value is a number 0
to 9.
Log writer (LGWR) process is similar to DBWn. It writes the redo entries from redo log buffer into
the redo log files.



Checkpoint (CKPT) is a process to give a signal to DBWn to writes data in the buffer cache into
datafiles. It will also updates datafiles and control files header when log file switch occurs.
System Monitor (SMON) process is used to recover the system crach or instance failure by
applying the entries in the redo log files to the datafiles.
Process Monitor (PMON) process is used to clean up work after failed processes by rolling back the
transactions and releasing other resources.
The database refers to disk resources, and is broken into two main structures –– Logical
structures and Physical structures.
Logical Structures
Oracle database is divided into smaller logical units to manage, store, and retrieve data
effeciently. The logical units are tablespace, segment, extent, and data block. Figure 3 will
illustrate the relationships between those units.

Figure 3. The relationships between the Oracle logical structures
A Tablespace is a grouping logical database objects. A database must have one or more tablespaces. In the
Figure 3, we have three tablespaces –– SYSTEM tablespace, Tablespace 1, and Tablespace 2. Tablespace is
composed by one or more datafiles.
A Tablespace is further broken into segments. A segment is used to stores same type of objects. That is,
every table in the database will store into a specific segment (named Data Segment) and every index in the
database will also store in its own segment (named Index Segment). The other segment types are Temporary
Segment and Rollback Segment.
A segment is further broken into extents. An extent consists of one or more data block. When the database
object is enlarged, an extent will be allocated. Unlike a tablespace or a segment, an extent cannot be


Data Block
A data block is the smallest unit of storage in the Oracle database. The data block size is a specific number of
bytes within tablespace and it has the same number of bytes.
Physical Structures
The physical structures are structures of an Oracle database (in this case the disk files) that are not directly
manipulated by users. The physical structure consists of datafiles, redo log files, and control files.
A datafile is a file that correspondens with a tablespace. One datafile can be used by one tablespace, but one
tablespace can has more than one datafiles.
Redo Log Files
Redo log files are the files that store the redo entries generated by DML statements. It can be used for
recovery processes.
Control Files
Control files are used to store information about physical structure of database, such as datafiles size and
location, redo log files location, etc.

11.Backup and Recovery Interview Questions
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?
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?
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.
1.List Tablespace Fragmentation Information.
SELECT tablespace_name,COUNT(*) AS fragments,
SUM(bytes) AS total,
MAX(bytes) AS largest
FROM dba_free_space
GROUP BY tablespace_name;
2.List Free and used space in database.

.segment_type. 4.segment_type. SELECT FILE_NAME. SELECT TABLESPACE_NAME. bytes FROM dba_extents WHERE segment_name = TNAME .tablespace_name.segment_name. MAX_EXTENTS.s. 8. SELECT sum(bytes)/1024 "used space in KB" FROM dba_segments.6 Page SELECT sum(bytes)/1024 "free space in KB" FROM dba_free_space. blocks. empty blocks. extents FROM dba_segments WHERE extents+5 > max_extents AND segment_type<>'CACHE'. NEXT_EXTENT.next_extent). extent count. List segments reaching extent limits SELECT s.AUTOEXTENSIBLE. INITIAL_EXTENT. empty_blocks FROM dba_tables WHERE table_name=TNAME.List names and default storage parameters for tablespace. SELECT chain_cnt AS CHAINED_BLOCKS FROM dba_tables WHERE table_name=TNAME.TABLESPACE_NAME. and chain block count SELECT blocks as BLOCKS_USED. Check the current number of extents and blocks allocated to a seg SELECT SEGMENT_NAME. 3.BYTES.BLOCKS FROM DBA_SEGMENTS.tablespace_name=f. Extent Information SELECT segment_name.tablespace_name HAVING max(f.EXTENTS. MAXBYTES. MIN_EXTLEN FROM DBA_TABLESPACES. 9.next_extent FROM dba_segments s WHERE NOT EXISTS (SELECT 1 FROM dba_free_space f WHERE s.bytes) > s. 5. SELECT COUNT(*) AS EXTENT_COUNT FROM dba_extents WHERE segment_name=TNAME.max_extents. 6. List table blocks.s. PCT_INCREASE.s. 7.TABLESPACE_NAME. Which Tablespace is belongs to which datafiles. List segments with fewer than 5 extents remaining SELECT segment_name.INCREMENT_BY FROM DBA_DATA_FILES. extent_id.

V$ROLLSTAT T2 WHERE T1. v$transaction t1 where t2.EXTENTS.ses_addr 11. v$rollstat t2 WHERE t2. Information about all rollback segments in the database SELECT SEGMENT_NAME. T2. t1. select 'TABLE:'.2 .hwmsize.USERNAME. /* General Rollback Segment Information */ SELECT t1. T2. t2.uniqueness FROM dba_indexes WHERE index_name in (SELECT constraint_name FROM dba_constraints WHERE table_name = TNAME AND constraint_type in ('P'. t2. Statistics of the rollback segments currently used by instance SELECT T1. V$SORT_USAGE T2 WHERE T1.table_name. 13.TABLESPACE. t2. T2.7 Page 10. t2.HWMSIZE. T2. Active sorts in instance SELECT T1.username. 14.USN = .CONTENTS. Index & constraint information SELECT index_name.TABLESPACE_NAME. T2.status FROM v$rollname t1. .BLOCKS FROM V$SESSION T1.SADDR = T2.SESSION_ADDR . t2.table_owner from user_synonyms order by 1. List tables and synonyms set pagesize 0.used_ublk from v$session t2.USN AND T1.optsize. t1. /* Rollback Segment Information .EXTENTS.OPTSIZE. t1.xidusn. T2.table_name.xacts.'U')) .Active Sessions */ select t2.OWNER. T2.ubafil. 12.usn = t1.'current' from user_tables union select 'SYNONYM:'.NAME LIKE '%RBS%'. t2.ubablk.STATUS FROM DBA_ROLLBACK_SEGS. t2.synonym_name.extents. T2. T2.STATUS FROM V$ROLLNAME T1.usn . T2.rssize.NAME .saddr = t1.RSSIZE.

SUM(RELOADS)/SUM(PINS) HITRATIO FROM V$LIBRARYCACHE . 18. 17. Tuning: library cache Glossary: pins = # of time an item in the library cache was executed reloads = # of library cache misses on execution Goal:get hitratio to be less than 1 Tuning parm: adjust SHARED_POOL_SIZE in the initxx. Tuning: buffer cache Calculation: buffer cache hit ratio = 1 . constraint_name. increasing by small increments SELECT SUM(GETS) HITS. SUM(GETMISSES) LIBMISS.ora file.table_name.ora file. position END IF. Constraint columns 16.'CONSISTENT GETS'. SUM(RELOADS)MISSES. SUM(GETMISSES)/SUM(GETS) RCRATIO FROM V$ROWCACHE . VALUE FROM V$SYSSTAT WHERE NAME IN ('DB BLOCK GETS'.ora file.(phy reads/(db_block_gets + consistent_gets)) Goal: get hit ratio in the range 85 . 8 Page 15. column_name FROM dba_cons_columns WHERE table_name = TNAME ORDER BY table_name.'PHYSICAL READS'). . increasing by small increments SELECT NAME. increasing by small increments SELECT SUM(PINS) EXECS. Tuning: data dictionary cache Glossary: gets = # of requests for the item getmisses = # of requests for items in cache which missed Goal: get rcratio to be less than 1 Tuning parm: adjust SHARED_POOL_SIZE in the initxx.90% Tuning parm: adjust DB_BLOCK_BUFFERS in the initxx.SELECT constraint_name.

A Simple Monitoring Tool This tool loops a specified number of times. 21. Tuning: sorts Goal: Increase number of memory sorts vs disk sorts Tuning parm: adjust SORT_AREA_SIZE in the initxx.COUNT FROM V$WAITSTAT WHERE CLASS LIKE '%UNDO%' .archived. 22. .PHYWRTS FROM V$DATAFILE DF. increasing by small increments SELECT NAME.FILE#=FS. displaying memory usage along with user process counts for a specific username. VALUE FROM V$SYSTAT WHERE NAME LIKE '%SORT%'. status from v$logfile . try to reduce counts SELECT CLASS. member.ora file. 24. Tuning: rollback segments Goal: Try to avoid increasing 'undo header' counts Tuning method: Create more rollback segments.FILE# . V$FILESTAT FS WHERE DF.status from v$log . Archive Log Mode Status /* Status of Archive Log Subsystem */ ARCHIVE LOG LIST /* log mode of databases */ SELECT name. List log file information These queries list the status / locations of the redo log files. PHYRDS. SELECT NAME.9 Page 19.thread#. 20. 23. /* log mode of instance */ SELECT archiver FROM v$instance. select group#. log_mode FROM v$database. Tuning: physical file placement Informational in checking relative usages of the physical data files. select group#.

10 Page --================================================= --. 'HH:MM:SS PM'). / show errors . date1 varchar(20) .sleep(5) . msg := msg || '. 5 sec duration -----================================================= set serveroutput on . List Space Allocated by Table .2) into memory1 from sys. dbms_lock. free mb = ' || memory1 . end loop . dbms_output.proc_ora_monitor --.parm1: username to count -. ' || user1 || ': ' || usercount1 . end. begin i := 0 . while ( i <> ' || to_char(SYSDATE.2) into memory1 from sys. create or replace procedure proc_ora_monitor ( user1 in varchar.v_$session where username = user1 . msg varchar(99) . i := i + 1 . reps1 in integer )is i number . msg := msg || '.parm2: number of loops. select round(sum(bytes)/1024/1024 .v_$sgastat where pool = 'shared pool' and name = 'processes' . processes mb = ' || memory1 . select round(sum(bytes)/1024/1024 .put_line(msg) . memory1 number . usercount1 number . execute proc_ora_monitor('SILVERUSER'. exit 25.2) . msg := msg || '.v_$sgastat where pool = 'shared pool' and name = 'free memory' . select count(1) into usercount1 from sys.

tablespacename order by segmentname. COUNT(*). COL operation FORMAT A30 COL options FORMAT A15 COL object_name FORMAT A20 /* -----. if the recycle bin (10g only) is not cleared. 26. tablespacename . options. 27.Your SQL here ------*/ EXPLAIN PLAN set statement_id = '9999' for select count(1) from asia_monthly_pricing_data where order_id > 5000 / /*----------------------------*/ select operation. Tablespace types.sid. STATUS FROM DBA_TABLESPACES.tablespace_name='RBS'). . Check the extents for a given segment SELECT TABLESPACE_NAME. 28. List sessions with active transactions SELECT s. column segmentname format a35 select segmentname.xidusn=r. and availability of data files SELECT TABLESPACE_NAME. sum(bytes/(1024*1024) ) "MB" from dbasegments where owner='HOLTDW' and segmentname not like 'BIN' group by segmentname. s. object_name from plan_table where statement_id = '9999' start with id = 0 connect by prior id=parent_id and prior statement_id = statement_id. commit.saddr in (SELECT t. 30. SUM(BLOCKS) FROM DBA_FREE_SPACE GROUP BY TABLESPACE_NUMBER . CONTENTS. tablespacename. Explain Plan: syntax Below is sample syntax for explain plan ( getting output from the optimizer ) delete from plan_table where statement_id = '9999'.set pagesize 500 set linesize 77 11 Page For partitioned tables.serial# FROM v$session s WHERE s. you may see more than one tablespace assigned to the table name. Tuning: dynamic extension SELECT NAME. dba_rollback_segs r WHERE t.ses_addr FROM V$transaction t. Note that phantom usage will appear.segment_id AND r. MAX(BLOCKS). 29. VALUE FROM V$SYSSTAT WHERE NAME='RECURSIVE CALLS' .

It determines the compatibility of the database with a certain version of Oracle. the database features that will be enabled and available will as of Oracle version 10. What is a role and explain a benefit of creating a role. On similar lines. The process that must be started on the server side to listen for incoming client connection requests in the listener process. 6. What is the System Global Area? The System Global Area (SGA) is a structure created in memory when the Oracle instance is started. If you set the compatibility of a database to say 10. command. Redo Log buffer and Streams Pool. You can add privileges to a role by using the GRANT privilege TO rolename.ora and SQLnet. Roles contain privileges. That is. if you wish to revoke a privilege from a group of users. The library cache. Without the privilege a user will be displayed an "insufficient privileges" error. When creating a user what does the DEFAULT TABLESPACE clause indicate? The default tablespace for a user. The listener should be started and listening on behalf of certain databases. 4. The execution plan determines the steps that will be followed to obtain the requested data. 8. sequences etc in the database. What does the Library cache contain? The library cache is a part of the shared pool. Java Pool. Networking files found on the client side include Tnsnames. Name some networking files that may be found on the client-side. Oracle already has the parse code and execution plan available. the table will automatically be in the default tablespace assigned to the user. If many users require the same set of privileges. when a user creates say a table without mentioning explicitly the tablespace in which it must be created. 2. you can grant the privileges to the role. 5. is the tablespace in which all objects created by the user will reside in. Initially when created. This is done. 3. a parse tree and execution are created. instead of issuing GRANT statements to grant the privileges to the users. stored recently executed SQL statements (the SQL Text). A role is an object that may be created to simplify privilege management. This can speed the process of statement execution. the parse code and execution plans. .1. A user must be granted the required system privileges by the DBA in order to create objects in the database. When users issue statements in the database. Database Buffer Cache. so that when similar statements are repeated. It consists of individual memory structures called the Shared Pool.12 Page exit / 6. and then grant the role to the user.1. What does the Compatibility parameter determine. For client-server connectivity to work. which process must be started on the server side for a remote client connection such as " connect scott/tiger@sales " to work. procedures. What does a user need to be able to create objects such as tables. a role has a name and does not contain any privileges.DBA-BASIC QUESTIONS 1. revoking it from the role will in a single command revoke it from all users who possessed that role. Large Pool.ora 7.

As long as it is in the recycle bin you can restore the table by issuing the FLASHBACK TABLE tablename TO BEFORE DROP command. Oracle block size is defined by the DB_BLOCK_SIZE initialization parameter. what happens when a table is dropped? When a table is dropped in Oracle 10g it is transferred to a recycle bin. Segments are made up of extents. static sizes that could cause insufficient memory errors or over allocation does not occur. Such memory structures are called auto-tuned and are the Shared Pool.13 Page 9. What is the shared memory management feature in Oracle 10g? The Oracle Shared memory management allows Oracle to dynamic size many of the memory structures in the System Global Area (SGA). Segments are objects of the database. An extent is a unit of space allocation. Database Buffer cache. To logically separate these types of data you may create a tablespace. without re-creating the database. Tablespaces are made up of segments. This structure is not visible at an operating system level. This datafile can be very large depending on the block size. 14. This features simplifies memory management. The logical structure of a database is a structure defined only within the Oracle database. The logical structure. to permanently delete the data from a table. A scheduled job is performed by the scheduler every night and during the weekends. A tablespace is a means of separating the different types of data in a database. If for example a user(s) are performing actions that require more large pool size. The command that permanently deletes a table without giving you the ability to rollback is the TRUNCATE TABLE command. an index is an index segment and so on. what is a BIGFILE tablespace? The BIGFILE tablespace feature was introduced in Oracle 10g. The advantage being the number of datafiles that have to be managed would be fewer. Extents in turn are made up of Oracle blocks. depending on the need at that instance. For example a database may contain permanent.Why is it necessary and important to analyze tables? How has analyzing become simpler in Oracle 10g? Analyzing is the process of generating statistics on objects of the database. Space is allocated to segments in the form of extents. Streams Pool and Java Pool. In Oracle 10g. This is a Data Definition Language command that cannot be undone. A BIGFILE tablespace can at a physical level be associated with only a single datafile. The data in a block grows in a bottom-up manner. Every block has a header containing identifying information. LOB data etc. 12. What is an Oracle block? An Oracle block is the smallest unit of read/write or I/O in a database. . a table is a data segment. temporary. In Oracle 10g. undo. statistics gathering is automatically performed by Scheduler. Explain briefly the logical structure of a database. Oracle blocks are the smallest unit of input/output in a database. Oracle will dynamically increase the size of the large pool. 15. This parameter is constant and cannot be modified once set. without having the ability to rollback the action. The Oracle block size should be a multiple to the Operating system block size. 11. 10. The sizes of these memory structures may vary during database operation. indicates that a database is made up of tablespaces. in that . What command can you issue. Large Pool. In Oracle 10g. by decreasing another auto-tuned memory structure that is not in need of this space. Statistics help the optimizer in determining optimal execution plans. 13. For eg.

ASM removes many of these menial tasks.write the command to take a tablespace online/offline? 10. It is a feature introduce in Oracle 10g to manage the physical files of the database more efficiently. This statistical data can be in the form of raw will you drop a permanent datafile?Give two methods. The files created in ASM are called ASM files.Is it possible to make a temporary tablespace as Autoallocate? 9. The contents of the repository are used by the components of the "Common Manageability Infrastructure".How will you find the datafiles of a temporary tablespace? 7. required manual administering such as looking out for hotspot files. because changes made to the database need to be available in the event of media recovery.Page 14 16. by allowing Oracle automatically manage the physical files of the disk. 60.Is it possible for multiple users/transactions to share single temporary extent? 6. temporary segment. Archiving can be performed automatically by the ARCH background process or can be done manually by the DBA. namely Automatic Database Diagnostic Monitor(ADDM). files when created on a filesystem.How will you find the current users who are using temporary tablespace segments ? 4. Briefly the ASM feature in Oracle 10g. 12.How will you drop a temporary datafile? 11. Advisory Framework etc. Segments are created in a tablespace and are part of a users schema. The tablespace is created with a non-standard block size using the BLOCKSIZE keyword. 20. Without these changes complete recovery will not be possible. LOB segment etc.Is it possible for multiple users/transactions to share single temporary segment? 5.All locally managed temporary tablespaces are of uniform size.What is the meant by tablespaces with a non-standard blocksize? Name one purpose for this functionality.How will you convert an existing dictionary managed permanent tablespace to temporary tablespace? 13. 19. metrics.How will you allocate non-standard block size for a table in a tablespace? And what is its pre-requisite? . undo segment. Statistical data gathered in memory is periodically transferred by a background process called MMON to repository tables on disk. Archiving is mandatory in a production environment. What is the Automatic Workload Repository (AWR)? Statistical data about the current and previous state of the database is monitored constantly and statistical data gathered by the Oracle database. The feature was introduced to facilitate the transportable tablespace features that allows the movement of tablespaces across databases.How will you create a locally managed temporary tablespace? 2. you must configure a corresponding buffer pool to hold the blocks that are read from the objects of this tablespace. The disks that belong to a diskgroup in ASM are called ASM disks. will you create dictionary managed temporary tablespace? 3. A tablespace whose block size is different from the default blocksize for the database (defined by the DB_BLOCK_SIZE initialization parameter) is called a tablespace of non-standard block size.true or false? 8. moving files around on the disks to avoid I/O contention etc. ASM stands for Automatic Storage Manager. To be able to create such a tablespace. 18. These repository tables that hold statistical information are collectively called the Automatic Workload Repository.TABLESPACES n DATAFILES-INTERVIEW ORIENTED PRACTICE QUESTIONS 1. A segment can be a data segment. active session history. Explain archiving. The DBA is responsible for grouping a number of disks together (called a diskgroup). These disks would then be utilized by the ASM feature. SQL statistics. ensuring striping and mirroring. Prior to Oracle 10g. Server Generated Alerts. it is important in a production environment? Archiving is the process of transferring the contents of the redo log file into an offline file called the "archive log file".What is a segment? A segment is an object of the database. undo segment . This is done before the contents of the redo log file can be overwritten.

How will you drop a tablespace? 21.what are the options (write commands) you have to deal with it? 34.How will you convert a tablespace as read only? is in transactional read-only mode.How will you convert the locally managed tablespace to dictionay managed?What are the limitations? 26.Is there any relationship between pctfree.If you are given a database.minextent=initial=next and pctincrease=0? 39.If you have given command to make a tablespace offline normal.minextent=initial=next and pctincrease=2? 40.Write command to make all datafiles of a tablespace offline without making the tablspace offline itself.Is it possible to make system and temporary tablespace with non-standard blocksize? 46.How will you check if a datafile is Autoextinsible? 33.If you make a tablespace offline immediate and that particular redo log get corrupted.How will you know which temporaray tablepsace is allocated to which user? 50.Which parameter define the max number of datafile in database? will you know whether it is locally managed or dictionary managed? 48. which tablespace is used for sorting purpose for a user who is not allocated any temporary tablespace? 30.what will happen if you give storage parameter as. What is the relation between db_files and maxdatafiles parameters? 35.Is it possible to create dictionary managed tablespace in 10g? 29.If the system tablespace is locally managed.How will you drop all the datafiles of a tablespace without dropping the tablespace itself?(HInt:see if there is any relationship between tablespace dropping and OMF .How will you take system and temporary tablespace offline? will you find tha system wide 1)default permanent tablespace 2)default temporary tablespace 3) Database time zone (write two methods) 44. will it affect the procedure to make that tablespace online? 45.Is it possible to make undo tablespace offline? 37. How will you find which are the transactions which are preventing theconversion? 20.initial extent and pctincrease? 42.If you are given a database with locally managed system tablespace. can a tablespace exist without any dayafile?) 24.While creating locally manmaged tablespace.What is the common column between dba_tablespaces and dba_datafiles? .While creating locally manmaged tablespace. next extent.If you drop a tablespace containing 4 datafiles.Is media recovery requird if a tablespace is taken offline immediate? 18.In 10g.What is the relationship between initial extents.Page 15 14.pctused and pctincrease? 43.can any user tablespacebe dictinary managed? 27. 36.How will you drop all the datafiles of a tablespace along with dropping the tablespace itself? 23.If database is not in OMF.but its not happening.Write two parameters you have to give to make OMF dadafiles and logfiles in a database? 51.How will you check the redo generated for temporatry tablespace? it sure that there is no dictinary managed tablespace in the database? 28. how many datafiles will be droped at a time by giving a single drop tablespace command? 22.Is it possible to make tempfiles as read only? 41.what are the views to check the free spaces in database? 15.Can a single datafile be allocated to two tablespaces?Why? 32.If a databse is created without default temporary will you know how many datafiles each tablespace contain? 49.what will happen if you give storage parameter as .If you are given a databse.If database is not in OMF.How will you convert a dictionary managed tablespace to locally managed? 25.If you find that a certain tablepsace is 90% full.How to allocate more than one temporary tablespace as default temporary tablespace to a single user? 38.How will you list all the tablespaces and their status in a database? 47.

Also consider proper scheduling of batch tasks after peak working hours. it is no good increasing the buffer cache if you can reduce I/O by rewriting a SQL statement. When designing. one needs to remember than you cannot tune a Buick into a Ferrari. aggregation tables for decision support systems. system swapping and paging.16 Page 62. full table scans. read the related Oracle FAQ dealing with your specific os. I/O and memory utilization. Also look for frequent disk sorts. Although this site is not overly concerned with hardware issues.  Enable your system to keep-up with the speed business is conducted.  Eliminate Database Contention: Study database LOCKS. data fragmentation. etc.  Database Design (if it's not too late): Poor system performance usually results from a poor database design. log buffer. You may also want to pin large objects into memory to prevent frequent reloads.  Tune the Operating System: Monitor and tune operating system CPU. For example.  Memory Tuning: Properly size your database buffers (shared_pool. and  Optimize hardware usage to save money (companies are spending millions on hardware). One should generally normalize to the 3NF. One should do performance tuning for the following reasons:  The speed of computing might be wasting valuable human time (users waiting for response). buffer hit ratios. The Oracle RDBMS is highly tunable and allows the database to be monitored and adjusted to increase its performance. The order in which steps are listed needs to be maintained to prevent tuning side effects. always keep the "data access path" in mind. Where should the tuning effort be directed? Consider the following areas for tuning.  Application Tuning: Experience showed that approximately 80% of all Oracle system performance problems are resolved by coding optimal SQL.LATCHESand wait events carefully and eliminate where possible. Also look at proper data partitioning. Selective denormalization can provide valuable performance improvements. For more information. . row chaining.  Disk I/O Tuning: Database files needs to be properly sized and placed to provide maximum disk subsystem throughput. etc. missing indexes.ORACLE 10g DATABASE-Performance Tuning FAQ Why and when should one tune? One of the biggest responsibilities of a dba is to ensure that the oracle database is tuned properly. etc. etc) by looking at your wait events. buffer cache. data replication.

After executing the procedure. The $ORACLE_HOME/rdbms/admin/catio. it won't help much to just have the larger tables analyzed. and OPTIMIZER DYNAMIC SAMPLING isn't performed. How can one optimize %XYZ% queries? It is possible to improve %XYZ% (wildcard search) queries by forcing the optimizer to scan all the entries from the index instead of the table.sql script creates a sample_ioprocedure and table to gather the required information. they do not show which tables in the tablespace has the most I/O operations. For more details. Where can one find I/O statistics per table? The STATSPACK and UTLESTAT reports show I/O per tablespace.sql script. the CBO can change the execution plan when you:  Change statistics of objects by doing an ANALYZE. db_file_multiblock_read_count). This can be done by specifying hints. My query was fine last week and now it is slow.17 Page What tools/utilities does Oracle provide to assist with performance tuning? Oracle provide the following tools/ utilities to assist with performance monitoring and tuning:  ADDM (Automated Database Diagnostics Monitor) introduced in ORACLE10G  Tkprof  statspack  Oracle Enterprise Manager -Tuning Pack (cost option)  Old UTLBSTAT. However. If one table involved in a statement does not have statistics. Usually the previous plan is not available. one can do a simple SELECT * FROM io_per_object.SQL and UTLESTAT.  Change some initialization parameters (for example: hash_join_enabled.Begin and end stats monitoring When is cost based optimization triggered? It's important to have statistics on all tables for the CBO(Cost Based Optimizer) to work correctly. sort_area_size. Some factors that can cause a plan to change are: . to extract the required information. Generate a current explain plan of the offending query and compare it to a previous one that was taken when the query was performing well. So you really want for all tables to have statistics right away.SQL . Why? The likely cause of this is because the execution plan has changed. If the index is physically smaller than the table (which is usually the case) it will take less time to scan the entire index than to scan the entire table. look at the header comments in the catio. Generally. Oracle has to revert to rule-based optimization for that statement.

no rows selected SQL> SELECT table_name. Index created. SQL> ALTER INDEX t1_idx MONITORING USAGE.ORA?  Has the DEGREE of parallelism been defined/changed on any table?  Have the tables been re-analyzed? Were the tables analyzed using estimate or compute? If estimate. monitoring. Here is an example: SQL> CREATE TABLE t1 (c1 NUMBER). Table created. TABLE_NAME INDEX_NAME MON USE -----------------------------. monitoring. SQL> SQL> SELECT table_name.ORA parameter SORT_AREA_SIZE been changed?  Have any other INIT. what percentage was used?  Have the statistics changed?  Has the SPFILE/ INIT. used FROM v$object_usage. SQL> CREATE INDEX t1_idx ON t1(c1). one can query the v$object_usage to see if the index is being used or not. Oracle still needs to scan through all the blocks to see it they contain data. Index altered. index_name.ORA parameter DB_FILE_MULTIBLOCK_READ_COUNT been changed?  Has the INIT. It can also happen because of a very high high water mark. When the MONITORING USAGE property is set for an index.--.Which tables are currently analyzed? Were they previously analyzed? (ie. Does Oracle use my index or not? One can use the index monitoring feature to check if indexes are used by an application or not. but now only contains a couple of records. Typically when a table was big. index_name.-----------------------------. TABLE_NAME INDEX_NAME MON USE . Was the query using RBO and now CBO?)  Has OPTIMIZER_MODE been changed in INIT. used FROM v$object_usage.--T1 T1_IDX YES NO SQL> SELECT * FROM t1 WHERE c1 = 1.ORA parameters been changed? Page 18  What do you think the plan should be? Run the query with hints to see if this produces the required performance.

This column defines the number of distinct values the column holds. As the NUM_DISTINCT decreases.each invocation of this command creates a single row in the INDEX_STATS view. When should one rebuild an index? You can run the ANALYZE INDEX VALIDATE STRUCTURE command on the affected indexes . disable index monitoring and re-enable it: ALTER INDEX indexname NOMONITORING USAGE. How does one tune Oracle Wait event XYZ? Here are some of the wait events from V$SESSION_WAIT and V$SYSTEM_EVENT views:  db file sequential read: Tune SQL to do less I/O. the rows are ordered. you may decide that index should be rebuilt if more than 20% of its rows are deleted: select del_lf_rows * 100 / decode(lf_rows. Obtain an explain plan of the query either using TKPROF with TIMED_STATISTICS. This row is overwritten by the next ANALYZE INDEX command.  USER_INDEXES. try specifying an index hint.CLUSTERING_FACTOR . it is unlikely that index entries in the same leaf block will point to rows in the same data blocks.--- To reset the values in the v$object_usage view.-----------------------------. Why is Oracle not using the damn index? This problem normally only arises when the query plan is being generated by the Cost Based Optimizer (CBO).1.NUM_DISTINCT . but sometimes the above can help to show why an index is not being used by the CBO. the cost of using an index increase thereby making the index less desirable.lf_rows) from index_stats where name = 'index_ name'. the rows are randomly ordered. ALTER INDEX indexname MONITORING USAGE.--. or with AUTOTRACE to see the statistics.  USER_TABLES.This defines how ordered the rows are in the index.19 T1 T1_IDX YES YES Page -----------------------------.If NUM_DISTINCT = NUM_ROWS then using an index would be preferable to doing a FULL TABLE SCAN. If CLUSTERING_FACTOR approaches the number of blocks in the table. Make sure all objects are analyzed.A higher value will make the cost of a FULL TABLE SCAN cheaper. so copy the contents of the view into a local table after each ANALYZE.ORA parameter DB_FILE_MULTIBLOCK_READ_COUNT . Redistribute I/O across disks.NUM_ROWS . For example. Remember that you MUST supply the leading column of an index. Compare this to the explain plan when not using an index. for the index to be used (unless you use a FAST FULL SCAN or SKIP SCANNING). Fundamental things that can be checked are:  USER_TAB_COLUMNS. If from checking the above you still feel that the query should be using an index.  Decrease the INIT. The usual cause is because the CBO calculates that executing a Full Table Scan would be faster than accessing the table via the index. The 'badness' of the index can then be judged by the ratio of 'DEL_LF_ROWS' to 'LF_ROWS'. There are many other factors that affect the cost. If it approaches the number of rows in the table. . so that one can see the CPU utilization.0. In such a case.

V$BH  log buffer space: Increase LOG_BUFFER parameter or move log files to faster disks  log file sync: If this event is in the top 5. data from full table scans could be fitted into a contiguous buffer area. and 1000's of a second for Oracle 9i and above. SQL> show parameters log_buffer NAME TYPE value -----------------------------------. The following query shows average wait time for sequential versus scattered reads: prompt "AVERAGE WAIT TIME FOR READ REQUESTS" select a. In general.average_wait "SEQ READ".v_$system_event b where a. but can be multiple blocks).----------. db file sequential read: A sequential read operation reads data into contiguous memory (usually a single-block read with p3=1.ORA file. these waits would then show up as sequential reads instead of scattered reads. This is a static parameter and its size cannot be modified after instance startup. Most people confuse these events with each other as they think of how data is read from disk. How does one tune the Redo Log Buffer? The size of the redo log buffer is determined by the LOG_BUFFER parameter in your SPFILE/INIT. whichever is greater. b. Time is reported in 100's of a second for Oracle 8i releases and below. Instead they should think of how data is read into the SGA buffer cache. you are committing too often (talk to your developers)  Page 20  log file parallel write: deals with flushing out the redo log buffer to disk. This event is also used for rebuilding the controlfile and reading datafile headers (P2=1).event = 'db file sequential read' and b.-----------------------------log_buffer integer 262144 .event = 'db file scattered read'.buffer busy waits: Increase DB_CACHE_SIZE (DB_BLOCK_BUFFERS prior to 9i)/ Analyze contention from SYS. Your disks may be too slow or you have an I/O bottleneck. db file scattered read: Similar to db file sequential reads. this event is indicative of disk contention on index reads. What is the difference between DBFile Sequential and Scattered Reads? Both "db file sequential read" and "db file scattered read" events signify time waited for I/O read requests to complete.average_wait "SCAT READ" from sys. Single block I/Os are usually the result of using indexes. The default setting is normally 512 KB or (128 KB * CPU_COUNT). Rarely. except that the session is reading multiple data blocks and scatters them into different discontinuous buffers in the SGA.v_$system_event a. sys. This statistic is NORMALLY indicating disk contention on full table scans.

Larger LOG_BUFFER values reduce log file I/O. If this value is continuously increasing.STEPS TO MIGRATION ASM-NON ASM INSTANCE VICE VERSA Steps To Migrate Database From Non-ASM to ASM And Vice-Versa This article describes the steps to migrate a database from Non-ASM to ASM and vice-versa.---------redo buffer allocation retries 3 redo log space wait time 0 Statistic "REDO BUFFER ALLOCATION RETRIES" shows the number of times a user process waited for space in the redo log buffer. values between the default and 1 to 3MB are optimal. if you set this parameter to a value beyond 10M.ctl'. Nevertheless. value 2 FROM SYS. so monitor it over a period of time while your application is running. you may want to make it bigger to accommodate bulk data loading.Page 21 When a transaction is committed. NAME value ---------------------------------------------------------------. In general.v_$sysstat 3 WHERE NAME in ('redo buffer allocation retries'. you should think twice about what you are doing. or  When a DBWn process writes modified buffers to disk (checkpoint). However.g. . This value is cumulative. the following conditions will trigger LGWR to write the contents of the log buffer to disk:  Whenever the log buffer is MIN(1/3 full. SQL> SELECT name. Step 1: Edit your init. your log buffer size is most likely adequate. 1 MB) full. "REDO LOG SPACE WAIT TIME" shows cumulative time (in 10s of milliseconds) waited by all processes waiting for space in the log buffer.ora to point the new control_file location to ASM E. or to accommodate a system with fast CPUs and slow disks. info in the redo log buffer is written to a Redo Log File. : if your disk group name say '+ASM_Disk_group'. 63. but may increase the time OLTP users have to wait for write operations to complete. In addition to this. or  Every 3 seconds. consider increasing your LOG_BUFFER (but only if you do not see checkpointing and archiving problems). If this value is low. Control_file="+ASM_Disk_group" Step 2: Startup the database in nomount state SQL> Startup nomount Step 3: From RMAN session copy the control file from old location to new location RMAN> RESTORE CONTROLFILE FROM '/u01/TST/control01. 4 'redo log space wait time').

Step 8: Do the following maintenance SQL> ALTER DATABASE DROP LOGFILE ’’ SQL> ALTER DATABASE ADD LOGFILE '+ASM_Disk_group'. Page Here /u01/TST/control01. allocate channel c2 type disk. Step 7: Open database in resetlogs. repeat for *all* online redo log members. Start your database with ASM.1'. RMAN> BACKUP AS COPY DATABASE format '/u01/roy1out/%U'. copy datafile '+DATABASE_DG/roy/datafile/users..ctl is the old location of control file. allocate channel c3 type disk. copy datafile '+DATABASE_DG/roy/datafile/sysaux.1' to '/u01/roy1out/system.1'.256.269. Edit pfile to reflect controlfile name in file system location. . SQL> ALTER DATABASE SWITCH LOGFILE.dbf' to '/u01/roy1out/example01. 5. 7.256. 3. RMAN> RESTORE CONTROLFILE FROM 'file>. .1' to '/u01/roy1out/undotbs1.1' to '/u01/roy1out/sysaux.257. using the following command RMAN> SWITCH DATABASE TO COPY.1'. SQL> alter database mount. 4. allocate channel c1 type disk.1'. SQL> Startup nomount.259. Use RMAN to copy the control file from ASM to NON-ASM. 6.1'.257.258. Create pfile from spfile.265. copy datafile '+DATABASE_DG/roy/datafile/system. Step 5: Using RMAN copy the datafile from NON-ASM to ASM RMAN>BACKUP AS COPY DATABASE FORMAT '+ASM_Disk_group'. STEP of MIGRATION from ASM to NON-ASM 1.265. copy datafile '+DATABASE_DG/roy/datafile/undotbs2. Step 6: Using RMAN rename the datafile . copy datafile '+DATABASE_DG/roy/datafile/asm_ts.1' to '/u01/roy1out/asm_ts.269.1'. SQL> ALTER DATABASE OPEN RESETLOGS.dbf'. Use RMAN to copy the database from ASM to NON-ASM. SQL> ALTER DATABASE DROP LOGFILE ''.258.259.1' to '/u01/roy1out/undotbs2. copy datafile '+DATABASE_DG/roy/example01.22 Step 4: From SQL session mount the database SQL> ALTER DATABASE MOUNT.. copy datafile '+DATABASE_DG/roy/datafile/undotbs1.1' to '/u01/roy1out/users. 2. SQL> ALTER DATABASE ADD LOGFILE '+ASM_Disk_group'.

.The who utility can list the user's name.change login password and password attributes 3. 2. date . Page 8. reads each file in sequence and writes it on the standard output. Recreate the redo logs as before. ls .pwd writes an absolute path name of the current working directory to standard output. By default. elapsed time since activity occurred on the line. one screenful at a time. whoami .The date utility writes the date and time to standard output or attempts to set the system date and time. man prints an error message. It normally pauses after each screenful.. the current date and time will be written.The cd utility will change the working directory of the current shell execution environment. cd . cat . ls repeats its name and any other information requested. 64. 11. a calendar for the current month is written. for each file that is an ordinary file. more . who . 10.The mkdir command creates the named directories in mode 777 (possibly altered by the file mode creation mask umask(1) . 9. If no operands are specified. passwd . 8. From RMAN 9. and the processID of the command interpreter (shell)for each current UNIX system user. If no manual page is located. man . terminal line. or by the name of an associated file (-f). 7. See step 8: Do the following maintenance in the above.The more utility is a filter that displays the contents of a text file on the terminal. 12.) who am i -> on SUN 6. 5. pwd . a calendar for that year is written.For each file that is a directory.If the year operand is specified. cal . mkdir . It displays complete manual pages that you select by name or one-line summaries selected either by keyword (-k).23 RMAN> SWITCH DATABASE TO COPY.lists who you are (HP.COMMON USED UNIX COMMANDS FOR DBA'S Common UNIX Commands Available on Most UNIX Platforms ====================================================== 1. ls lists the contents of the directory. AIX.manual pages The man command displays information from the reference manuals.The cal utility writes a Gregorian calendar to standard output.login time.

17. ps . wc . cp . 22.The rm utility removes the directory entry specified by each file argument. df . or mounted resources. It uses a compact nondeterministic algorithm. 16.change the permission of a file.The rm utility removes the directory entry specified by each file argument. $ df / (/dev/md/dsk/d0 ): 1816668 blocks 1683304 files /proc (/proc ): 0 blocks 3721 files . rm . 21. writes the number of newline characters. Ex: find . Ex: kill -9 (signal will always be caught) 23.If no user operand is provided. directories. chmod .The cp utility will copy the contents of source_file to the destination path named by "target_file".In the first synopsis form. grep . by default. mv . words and bytes contained in each input file to the standard output. the amount of used and available space. Ex: chmod +x tempfile (add execute permission) chmod u+x tempfile (add execute for user only) chmod 6755 oracle (set the setuid bit on) 18. 19. id .The df command displays the amount of disk space occupied by mounted or unmounted file systems.The ps command prints information about active processes. find . ps prints information about processes associated with the controlling terminal. -name sqlplus -print (find the full pathname of sqlplus starting from the current directory) find .send a signal to terminate a process. and how much of the file system's total capacity has been used. kill .search for files.The grep utility searches files for a pattern and prints all lines that contain that pattern. the mv utility moves the file named by the source operand to the destination specified by the "target_file".Page 24 13. the id utility will write the user and group IDs and the corresponding user and group names of the invoking process to standard output: $ id uid=1017(oracle7) gid=101(dba) 24.The wc utility reads one or more input files and. rmdir . Source and "target_file" may not have the same name.Without options. -name '*sql*' -print (find the full pathname of file where 'sql' is in its name) 20. 15. 14.

The ar utility maintains groups of files combined into a single archive file... semaphores or shared memory identifiers.. -q Print information about active message queues../oravw 26. Its main use is to create and update library files. du .. lpr prints files (file) and associated information. uname -a (list all info) SunOS supsunm3 5... The information that is displayed is controlled by the options supplied. lpr .. ipcrm . 29.The utility ipcs prints information about active interprocess communication facilities. symbols representing one or more system characteristics will be written to the standard output. and the size of the file space allocated to each subdirectory of... /usr/ccs/bin/ar -t [ -sVv ] archive [file.] /usr/ccs/bin/ar -x [ -CsTVv ] archive [file.6 Generic_105181-08 sun4u sparc SUNW. .ipcrm removes one or more messages. -m shmid Remove the shared memory identifier shmid from the system.] 30. -m Print information about active shared memory segments.collectively called a print request.Ultra-5_10 28./u02 (/dev/dsk/c1t2d0s0 ): 2981898 blocks 4108008 files 25 /u01 (/dev/dsk/c1t1d0s0 ): 3207990 blocks 4099598 files Page /dev/fd (fd ): 0 blocks 0 files 25.The du utility writes to standard output the size of the file space allocated to.The uname utility prints information about the current system on the standard output. Ex.. ipcs . /usr/ccs/bin/ar -p [ -sVv ] archive [file./oravw/install 216 .The nm utility displays the symbol table of each ELF object file that is specified by file.. The shared memory segment and data structure associated with it are destroyed after the last detach. 31. -s Print information about active semaphores. /usr/ccs/bin/ar -d [ -Vv ] archive file. /usr/ccs/bin/ar -r [ -abciuVv ] [ posname ] archive file. uname .] /usr/ccs/bin/ar -q [ -cVv ] archive file...The lpr utility submits print requests to a destination. nm . the file hierarchy rooted in each of the specified files. $ du 214 . ar . 27. When options are specified. /usr/ccs/bin/ar -m [ -abiVv ] [ posname ] archive file.

34. newgrp . The standard input and output are used by default..Page 26 -q msqid Remove the message queue identifier msqid from the system and destroy the message queue and data structure associated with it. such as one of the following: (umask 002) nohup umask . 33.the ln utility creates a new directory entry (link) for the file specified by source_file at the destination path specified by target. chgrp . on each file listed in ffile in an attempt to classify it. 32. without arguments. it reports the settings of certain options. diff . -exec umask . optionally. This mask affects the initial value of the file permission bits of subsequently created files.The diff utility will compare the contents of file1 and file2 and write to standard output a list of changes necessary to convert file1 into file2.The newgrp command logs a user into a new group by changing a user's real and effective group ID. the link is made in the current directory.The chgrp utility will set the group ID of the file named by each file operand to the group ID specified by the group operand. ln . find .The stty command sets certain terminal I/O options for the device that is the current standard input. 41. dd . If target is not specified. 38.dd copies the specified input file to the specified output with possible conversions.The file utility performs a series of tests on each file supplied by file and. umask . allows one to become another user without logging off. optionally. -s semid Remove the semaphore identifier semid from the system and destroy the set of semaphores and data structure associated with it. file . 40.The chown utility will set the user ID of the file named by each file to the user ID specified by owner and. The default user name is root (super user). Ex: dd if=myfile of=newfile conv=ucase (converts to uppercase) 39. su . 37. -parity . will set the group ID to that specified by group.. Ex: $ stty speed 38400 baud.The umask utility sets the file mode creation mask of the current shell execution environment to the value specified by the mask operand. it does not affect the file mode creation mask of the caller's environment. Ex: newgrp dba (switch group to dba) 35. The user remains logged in and the current directory is unchanged.. stty . If umask is called in a subshell or separate utility execution environment. chown .

swap -l swap provides a method of adding. t . If there are no arguments. cpio .The cpio command copies files into and out from a cpio archive. -o. deleting. 53. If telnet is invoked without arguments. telnet . NOTE: vmstat statistics are only supported for certain devices.The tty utility writes to the standard output the name of the terminal that is open as standard input. indicated by its prompt telnet>. The -i. disk. it accepts and executes its associated commands. it may have dependencies of its own. logname . and -p options select the action to be performed. 54. tty . and monitoring the system swap areas used by the memory manager. env . ulimit . but it can be any file. modifies it according to its arguments. The cpio archive may span multiple volumes. depending on the function letter used. 50. The make utility executes a list of shell commands associated with each target. then invokes the utility named by the utility operand with the modified environment. makefile contains entries that describe how to bring a target up to date with respect to those on which it depends. Only a process with appropriate privileges can increase the limit.(att) .this is a command generator. typically to create or update a file of the same name.echo echoe echok echoctl echoke iexten 27 brkint -inpck icrnl -ixany imaxbel onlcr tab3 Page swtch = .telnet communicates with another host using the TELNET protocol. The key is a string of characters containing exactly one function letter (c. The name that is used is equivalent to the string that would be returned by the ttyname(3C) function. Ex: cpio -icBdvmu < /dev/rmt0 44.vmstat delves into the system and reports certain statistics kept about process.rlogin establishes a remote login session from your terminal to the remote machine named hostname. 46. or x) and zero or more function modifiers (letters or digits).The ulimit utility sets or reports the file-size writing limit imposed on files written by the shell and its child processes (files of any size may be read). 47. make . A tarfile is usually a magnetic tape. it enters command mode. 49. rlogin . In this mode. 42. which are called dependencies. 48. 51. to the standard output. separated by BLANKs and terminated by a NEWLINE. tar . All executables used in ORACLE are generated from makefiles. tar's actions are controlled by the key argument.The tar command archives and extracts files to and from a single file called a tarfile. trap and CPU activity. only the NEWLINE character will be written. echo . u. Ex: tar xvt /dev/rmt0 45.The env utility obtains the current environment. Use the commands listed below for the associated operating system: SUN Solaris #/usr/sbin/swap -l HP 9000 Series HP-UX # /etc/swapinfo . r. virtual memory. vmstat .The echo utility writes its arguments. Ex: tty /dev/pts/0 43.The logname utility will write the user's login name to standard output. Since each dependency is a target.

and does not report users last known to be logged into that machine 63 sed . When the command is invoked. -n Suppress the default output. If the user types a RETURN.28 IBM RS/6000 AIX % /etc/lsps -a Page Digital UNIX % /usr/sbin/swapon -s 55.The rwho command produces output similar to who(1). talk .The talk utility is a two-way. 5 and 15 minutes.The hostid command prints the identifier of the current host in hexadecimal.. script_file consists of editing commands. If there is just one -e option and no -f options. 58. as given before the login prompt.The sed utility is a stream editor that reads one or more text files. the flag -e may be omitted. 60. 64.e $ whatis man man man (1) . See USAGE below for more information on the format of script. hostname . talk: connection requested by your_address talk: respond with: talk your_address to the specified address. The nohup utility can be used when it is known that command will take a long time to run and the user wants to logout of the terminal. hostid . At this point..The pg command is a filter that allows the examination of filenames one screenful at a time on a CRT. when a shell exits. but for all machines on your network. If a variable is specified. 61. another page is displayed. only its value is printed. 59. and writes the results to standard output -e script script is an edit command for sed. whatis (/usr/ucb/whatis) commands -> looks up one or more commands in the on-line man pages. -f script_file Take the script from script_file. the recipient of the message can reply by typing: 65. printenv . pg . i. This numeric value is likely to differ when hostid is run on a different machine. 62. 57. rwho . nohup arranges for the SIGHUP signal to be ignored by the process.macros to format Reference Manual pages 56. Files can be up to 1024 KB. uptime . rwho assumes the machine is down. If no report has been received from a machine for 5 minutes. When first invoked. and the average number of jobs in the run queue over the last 1. nohup . talk sends a message similar to: Message from TalkDaemon@ her_machine at time. All stopped.The uptime command prints the current time. one per line.The hostname command prints the name of the current host. Read a large file. The superuser can set the hostname by giving an argument. bfs [option] file -> big file scanner. the system sends its children SIGHUP signals. using ed-like sysntax. if their invocation is preceded by the nohup command or if the process programmatically has chosen to ignore SIGHUP.printenv prints out the values of the variables in the environment. which by default cause them to be killed. and background jobs will ignore SIGHUP and continue running. the length of time the system has been up. other possibilities are listed below. screen-oriented communication program. makes editing changes according to a script of editing commands. and display a brief description.The nohup utility invokes the named command with the arguments supplied.find and display reference manual pages man man (5) . . running.

which takes a list of names and looks for the files which would be executed had these names been given as commands. 00 Page example% uptime 66. and operates the database all day in NOARCHIVELOG mode. The kernel is loaded into memory by the PROM monitor. shutdown . It is possible to use the command mode of ex from within vi and to use the command mode of vi from within ex.26.7.. Both aliases and path are taken from the user's . John realized that he had lost a datafile that contained all the user data. and shuts it down at 5 P. This section gives all the possible alternatives to recover the database for a specified failure. 1 user. log files and control files to tape.1. shutdown(1M) is normally used first to warn all users logged in of the impending loss of service. Although reboot can be run by the super-user at any time.M. He uses a stand-alone UNIX machine running Oracle 8. or every Sunday by copying all the datafiles. Johns starts the database up in the morning at 8A.BACKUP-SCENARIOS Case Studies for Oracle Backup and Recovery Scenario : The scenario presents the kinds of backups taken at the site. and searched for along the user's path. reboot .shutdown is executed by the super-user to change the state of the machine. Once every week. shutdown brings the system to a state where only the console has access to the operating system. he runs a batch job to insert. How would he resolve this problem? How much data would you lose? Write down the steps you would perform to recover your database. 0. CASE 1 : Scenario : John uses an Oracle Database to maintain the inventory of his grocery store. (visual) is a display-oriented text editor based on an underlying line editor ex.dbf' He realized that he had accidentally deleted one of the data files while trying to free some space on the disk. In most cases. it is used to change from the multi-user state (state 2) to another state. He takes an offline backup (cold backup) of the database once a week. 67. which . This state is called single-user. Its primary role is to create processes from information stored in the file /etc/inittab. Problem: This section describes the kind of failure that occurred or the situation the DBA is facing while operating the database.3/bin/svrmgrl 68. their frequency and other background information. 69. update and delete data in his database. init is a general process spawner. By default. 70.cshrc file Ex: $ which svrmgrl /u01/app/oracle/product/7.M. which transfers control to the loaded kernel.29 10:47am up 27 day(s). ORA-01157 :cannot identify data file 4 . Problem : On a Wednesday morning. load average: 0. Solution. 50 mins. vi .Each argument is expanded if it is aliased.file not found ORA-01110: data file 4: '/home/oracle/orahome1/oradata/ora1/users01. . including version of the database.reboot restarts the kernel.. He tried to start up the database using the STARTUP OPEN command got the following error.18.

SQL> alter database open.dbf' offline. 30 Case 2 : Dropping datafiles in NOARCHIVELOG mode Problem : The disk crashed and one of the datafiles was lost. .Page Scenario : Same as in Case 1. that require sorting of data. ORA-01145: offline immediate disallowed unless media recovery is enabled (this option can be used only in ARCHIVELOG mode) SQL> alter database datafile '/home/oracle/orahome1/oradata/ora1/temp. Solution : The TEMPORARY tablespace is used by Oracle to do the intermediate work while executing certain commands. SQL> host rm /home/oracle/orahome1/oradata/ora1/temp.dbf (deleting a file to simulate a loss) SQL>startup mount. Simulation : SQL> connect internal SQL> startup mount. you need to use the 'ALTER DATABASE DATAFILE datafilename OFFLINE DROP. Any other data files that belong to this tablespace are online and can be used. In this case. SQL> shutdown abort. To drop the datafile.dbf' SQL> alter database datafile '/home/oracle/orahome1/oradata/ora1/temp. SQL> archive log list. Note that after opening the database. SQL> alter database noarchivelog. ORA-01157 :cannot identify data file 6 : file not found ORA-01110 :datafile 6 : '/home/oracle/orahome1/oradata/ora1/temp. it is okay to drop the datafile and start up the database. the data file belonged to a temporary tablespace. SQL> alter system switch logfile. SQL> alter system switch logfile.dbf' offline drop. Oracle re-commends re-creating the tablespace. SQL> alter database open. SQL> alter database open. If no permanent objects are stored in this datafile. the tablespace is online but the data file is offline.

1. Note that if a disk crash has damaged several data files then all the damaged data files need to be restored from the online backup. Moe had to keep the down time to a minimum and open the database as soon as possible. a non-system data file is lost due to the disk crash.7 on a VAX/VMS system and takes an online backup of the database every night. Problem : Let's assume that instead of a system data file. losing the SYSTEM tablespace residing on the disk. As this happened at the peak processing time.m. CASE 4 : Scenario : Use the same scenario for Case 3 again. a batch job runs a command procedure that puts the tablespaces in hot backup mode. Problem: One afternoon a disk crashed.31 SQL> drop tablespace temp including contents.m and 9 p. Solution : The only solution here is to restore the SYSTEM datafile from the night's online backup. and then issues the alter tablespace end backup command. He uses Oracle 8.m. When he tried to open the database he got the following error: ORA-01147 : SYSTEM tablespace file 1 is offline How would you solve this problem.. SQL> insert into case4 values(3). and then perform database recovery. The database needs to be mounted and the RECOVER DATABASE command issued before it could be opened. SQL> insert into case4 values (3). (Which mode of the database would he be running in ?) The total database size is 50GB and the real-time call tracking system is a heavy OLTP system primarily with the maximum activity between 9 a. SQL> host rm /home/oracle/orahome1/oradata/ora1/users01. Simulation: SQL> connect internal SQL> create table case4 ( c1 number) tablespace users. SQL> commit. He wanted to start the database first and then restore the datafile that was lost.dbf SQL> shutdown abort.dbf' size 1M. Identify three ways in which you could solve this problem. CASE 3: Page SQL> create tablespace temp datafile '/home/oracle/orahome1/oradata/ora1/temp. At 9 p. so he took the SYSTEM data file offline. everyday. We also assume that this data file doesn't contain any active rollback segments. takes the backup of all the data files to tape at the operating system level. SQL> alter system switch logfile. . Scenario : Moe is the DBA of a real-time call-tracking system.

c) The third method is to use the RECOVER TABLESPACE command which requires the tablespace to be offline and the database to be open. SQL> host cp /home/oracle/backup/users01. but not open.dbf' offline. This requires the database to be mounted.dbf' online.dbf' . SQL> alter database open. SQL> host cp /home/oracle/backup/users01. Here the datafile needs to be offline but the database can be open ormounted. SQL> select * from case4. b) The second method. SQL> recover database.dbf SQL>startup open ORA-01113 file 4 needs media recovery . SQL> alter database datafile '/home/oracle/orahome1/oradata/ora1/users01.dbf /home/oracle/orahome1/oradata/ora1/users01. SQL> alter database open. SQL> select * from case4.32 How do you determine when to use data file recovery versus tablespace recovery? Page Solution : When a non-system data file is lost.dbf SQL>startup open ORA-01113 file 4 needs media recovery SQL> startup mount. there are three methods by which the data file can be recovered. SQL> alter database datafile '/home/oracle/orahome1/oradata/ora1/users01.dbf /home/oracle/orahome1/oradata/ora1/users01. SQL> recover datafile '/home/oracle/orahome1/oradata/ora1/users01.dbf SQL>startup open ORA-01113 file 4 needs media recovery SQL> startup mount. which means offline recovery needs to be recovered.dbf /home/oracle/orahome1/oradata/ora1/users01. a) The RECOVER DATABASE command can be used. is to use the RECOVER DATABASE command. SQL> host cp /home/oracle/backup/users01.

She stores all the user data in the USERS tablespace. so she decided to do an online recovery. Page SQL> alter database datafile '/home/oracle/orahome1/oradata/ora1/users01.) Simulation: SQL> connect internal. Once she took the datafile offline and opened the atabase. It was the beginning of the week and a lot of applications needed to be run against the database. all the data files that belong to the rollback segment tablespace RBS was lost.dbf' offline. She administers an Oracle 8. (error will be generated) SQL> alter tablespace users online. CASE 5 Scenario : Anita is a DBA in a banking firm. she takes an export once a month of all the important tables in the database. she has an automated procedure to take online backups every night.1. In addition. index data in the INDEXES tablespace. and all the rollback segments in the RBS tablespace. SQL> select * from case5. SQL> alter database open. she tried to select from a user table and got the following error: ORA-00376 : file 2 cannot be read at this time (File 2 happens to be one of the datafiles that belong to the rollback segment tablespace. Problem: On Monday morning. SQL> alter tablespace users offline. SQL> select * from case4. due to a media failure.7 database on a Unix Server. (Note: while doing tablespace recovery all the datafiles belonging to the tablespace should be offline). she has other tablespaces to store data for various banking applications. .33 SQL> startup mount. In addition. SQL> recover tablespace users . SQL> set transaction use rollback segment r01. SQL> commit. SQL> insert into case5 values (5). SQL> select * from case4 . SQL> create table case5 (c1 number) tablespace users. Since the database operates 24*7.

SQL> alter database open.dbf Solution for case 5: An important step you need to perform is modify the initialization file and comment out the ROLLBACK_SEGMENTS parameter. (error indicating file cannot be read at this time) SQL> select segment_name.dbf /home/oracle/orahome1/oradata/ora1/rbs01. If this is not done. SQL> alter database datafile '/home/oracle/orahome1/oradata/ora1/rbs01. No rows selected SQL>select segment_name. To take of this issue) SQL> alter rollback segment r01 online. (the segments continue to show that that they need recovery. She decided to mirror the control files but not the online redo logs. (some of the rollback segments will indicate they need recovery) SQL> host cp /home/oracle/backup/rbs01.dbf' offline. status from dba_rollback_segs. SQL>select * from case5. How would you perform a recovery ? Page SQL> host rm /home/oracle/orahome1/oradata/ora1/rbs01.dbf SQL>recover tablespace rbs. status from dba_rollback_segs. She created a 500MB database. Oracle will not be able to find the rollback segments and will not be able to open the database. so created the database with three log groups with one member each. (Bring online all rollback segments that indicate that they need recovery). Her backup strategy includes taking online backups twice a week and a full database export once a week.34 SQL> shutdown abort. SQL> startup mount. SQL>select * from case5 . SQL> alter rollback segment r02 online . SQL>alter tablespace rbs online. . CASE 6 : Scenario : Sara works in a software company as a DBA to administer a small development database on a UNIX machine.

Each log file is 10MB. he tried to start the database and Oracle asked for media recovery starting from log sequence number 2300. This is required for normal operation of the database). and maintains one of the company's most crucial databases. Kevin needed to bring the database up as fast as possible. CASE 7 Scenario : Kevin is one of the DBAs of a Fortune 500 Financial Company. which means 35 log files needed to be applied before the database could be opened. crash recovery cannot be performed and instead media recovery needs to be performed. Problem : On Friday afternoon. Between issuing the BEGIN BACKUP and END BACKUP oracle generates about 50 archive log files.Page 35 Problem: A power surge caused the database to crash and also caused a media failure. The current online log file has a sequence number 2335.log Solution to Case 6 : You would need to perform a Cancel base Incomplete recovery Restore all the datafiles: $cp /home/oracle/orahome1/backup/*. Simulation: SQL> shutdown abort. Simulation: SQL>connect internal . after the crash they cannot be used because instance recovery cannot be performed (since all the log files are lost). A UNIX machine is used to store a 500 gigabyte database using Oracle 8. while taking hot backups.1.dbf /home/oracle/orahome1/oradata/ora1/ SQL>connect internal SQL> startup mount. The database operates 24*7 with 200 to 250 concurrent users on the system at any one time. As this is a mission critical workshop. losing all the online log files. There are 250 tablespaces and the backup procedure involves keeping the tablespaces in hot backup mode and taking an online backup. SQL>shutdown SQL>exit $ls (The online redo logs will be automatically created by Oracle as part of the database open. SQL>recover database until cancel. All the data files and the current control files are intact. Although the data files are OK. the machine crashed bringing the database down. Once the machine was booted.6.If any of the unarchived log files are lost. SQL> host rm /home/oracle/orahome1/oradata/ora1/*. (Cancel the recovery when oracle asks to apply the redo logs that are lost) SQL>alter database open resetlogs.

she copied the backup control file and tried to start up the database. with automatic archiving enabled) SQL>alter tablespace test begin backup.36 SQL>archive log list Page SQL>startup (Database is in archivelog mode. SQL>shutdown abort. SQL> insert into case7 values (7). SQL> alter database open. status. CASE 8 Scenario : Jane uses an Oracle 8i database for windows on her PC for her home business.dbf /home/oracle/hbackup/test1. While copying the database. She maintains only one copy of the control file and doesn't mirror the control file because she thinks mirroring the control file doesn't make sense since she has only one hard disk. Oracle complained that an old control file was being used. enabled from v$datafile. SQL> alter system switch logfile. Problem : Jane accidentally deleted her control file. SQL>commit. {Error : indicating file 5 needs recovery } Solution : How would you solve this problem ? Solution to Case 7 Alter database datafile '/home/oracle/orahome1/oradata/ora1/test1. Simulation : SQL> connect internal SQL> startup open. SQL>host cp /home/oracle/orahome1/oradata/ora1/test1. Name .dbf' end backup. log files and control file to floppy disks. SQL> startup mount. SQL> select name. Since she didn't have a copy of the control file. Her backup procedure involves shutting down the database and copying the data files.dbf SQL> create table case 7 (c1 number) tablespace test. She maintains a small 20MB database and takes regular cold backups.

.dbf /home/oracle¼/test1.dbf 37 /home/oracle¼/system01.dbf /home/oracle¼/temp. SQL> commit. SQL>alter system switch logfile.dbf Page ------- /home/oracle¼/tools01.dbf /home/oracle¼/users01. SQL> insert into case8 values (8).dbf Status ---------SYSTEM ONLINE ONLINE ONLINE ONLINE ONLINE Enabled -------------------READ WRITE READ WRITE READ WRITE READ WRITE READ ONLY READ WRITE SQL> create table case8 (c1 number) tablespace users./home/oracle¼/rbs01.

SQL>select * from case8. C1 ---6 CASE 9 Scenario : Matt. ORA-01589 : must use the RESETLOGS or NORESETLOGS for database open. the system .cannot recover using backup control file ORA-01110 : data file 5 : '/home/oracle/orahome1/oradata/ora1/test1. Every night. Page SQL>alter system switch logfile.dbf' offline. Solution : How would you recover your database ? Solution to Case 8 SQL> host cp /home/oracle/hbackup/control01.SQL>shutdown abort. ORA-00283 : Recovery session cancelled due to errors ORA-01233 : file 5 is read only . the DBA of a financial firm administers a 100GB database on an IBM mainframe running Oracle 8. {Error : indicating correct syntax must be used } SQL> recover database using backup controlfile. SQL>recover database using backup controlfile.7. SQL>alter database open resetlogs.1. 38 SQL>alter system switch logfile.ctl SQL> startup mount. {Error : indicating that an old control file is being used } SQL> recover database. Matt operates the database in ARCHIVELOG mode. SQL>alter database open. release 8. SQL> alter database open.ctl /home/oracle/orahome1/oradata/ora1/control01.dbf' SQL>alter database datafile '/home/oracle/orahome1/oradata/ora1/test1.

SQL> connect internal. As part of this backup. c) Rebuild the tablespace (This method involves dropping the tablespace to which the offline datafile belongs and re-creating it) Write down the steps you would issue in all the three cases. an offline backup of the database was taken. He didn't want to add another datafile. Every day. and once a week she shuts the database down. then decided that he really needed more space. In this method. Matt added a small datafile to a tablespace. he got the error: ORA-00376 : file 6 cannot be read at this time (file 6 is the same datafile that he had taken offline and deleted earlier) Solution : Identify three methods in which you could recover from this problem. Nancy runs the database in ARCHIVELOG mode. and one week's worth of archived log files are kept online on disk. He deleted the datafile at the OS level. you can apply one of the following three methods. she connects the third mirror to the double mirror. . SQL>archive log list. She uses Oracle 8. Since a datafile cannot be dropped. about 100 archive log files are generated. Problem : On Sunday. She also keeps a copy of the database on a separate set of disk drives. b) If no backups exist. assuming Oracle would never need the file since he hadn't added any data to it. you would require all the log files that were generated since the time the datafile was created.dbf' resize 1M. but instead decided to replace the smaller datafile with a new.7 on a Unix server and takes weekly offline backups of the database. She then uses tape drives to copy the database files onto the tape. An automated process copies the archived log files to tape at regular intervals. SQL>startup mount. bigger datafile. unlinks one of the mirrors and starts up the database. The control files and online log files are multiplexed. and also because it was offline. CASE 10 Scenario :Nancy administers a large database of 150 GB at a factory. Problem : One day. Shortly after he started running an application. At this point the database is double mirrored. Appropriate solution to the problem Matt faced is. The Oracle database is shutdown before the backups are taken. SQL> alter database datafile '/home/oracle/orahome1/oradata/ora1/users02.1. all Oracle database files are copied from DASD to tape.dbf' size 40k. a) Restore the datafile that was taken offline from a backup and do a data file recovery. SQL>alter tablespace users add datafile '/home/oracle/orahome1/oradata/ora1/users02. She triple mirrors her disk drives.Page 39 manager takes an OS backup of the system. while doing space management. SQL>alter database open. What would have been the most appropriate solution to the problem Matt had? Solution to Case 9 When you take a datafile offline and open the database. Once the copying is done. he merely took the new datafile offline and added a larger datafile to the same tablespace. create a datafile using the 'alter database create datafile' command and then recover it. Matt takes a full database export every three months and incremental exports once a month.

restore the data files from the offline backup from Sunday and roll forward. all the way from when the backup was taken. SQL>archive log list. Since all the archived log files were in the archive destination. Once the database was open. she realized that Oracle asked for recovery starting from log sequence number 100.Page 40 Nancy observed that the current log sequence number was 100. she decided to bring tablespace TS1 online. Oracle asked for recovery for all the data files that belong to the tablespace TS1. one of the tablespaces (TS1) was taken offline and the current log sequence number was at that time was 450. Nancy issued the recover database command and applied around 400 archived log files. Simulation: SQL>connect internal SQL>startup open. The current log sequence number at the time of the failure was 500. She restored all the data files from the cold backup and used the current control file to do the database recovery. Database log mode ARCHIVELOG Automatic archival ENABLED . SQL>archive log list. On Thursday afternoon. some of the data files were lost. SQL>alter system switch logfile. Nancy issued the auto command and Oracle automatically applied all 400 archived log files. Nancy expected Oracle to ask for recovery starting at log sequence number 450. SQL>alter tablespace users offline. due to a disk controller problem. since that's when the tablespace was taken offline. Nancy decided to delete all the data files. Database log mode ARCHIVELOG Automatic archival ENABLED Archival destination /home/oracle/orahome1/archives Oldest online log sequence 60 Next log sequence to archive 62 Current log sequence 62 SQL>alter system switch logfile. Thursday morning. The recovery took about 13 hours and Nancy could finally bring the database to normal operation. However when she issued the recover tablespace command. SQL>alter system switch logfile.

dbf /home/oracle/orahome1/oradata/ora1 (Restoring all the datafiles) Solution : How would you recover from the above problem. Name .dbf' SQL> recover tablespace users. The second method is a better way of doing recovery. SQL> select name. (Applying the logs) SQL>alter database open. status. Method 1 SQL>startup mount. and is recommended by Oracle since the log file(s) need to be applied only once.dbf (Simulates a loss of all datafiles) SQL>host cp /home/oracle/orahome1/backup/*. SQL>alter tablespace users online. Solution to CASE 10 We present two recovery methods. ORA-01113 : file 4 needs media recovery ORA-01110 : data file 4 : '/home/oracle/orahome1/oradata/ora1/users01. The first method is the recovery procedure used by Nancy in this example. SQL> recover database. SQL>select * from v$datafile. enabled from v$datafile. Method 2 SQL> startup mount. (Reapplying all the logfiles) SQL>alter tablespace users online./home/oracle/orahome1/archives Oldest online log sequence 63 Next log sequence to archive 65 Current log sequence 65 Page 41 Archival destination SQL>shutdown abort SQL>host rm /home/oracle/orahome1/oradata/ora1/*.

dbf SQL> alter database datafile Status ---------SYSTEM ONLINE ONLINE OFFLINE ONLINE ONLINE Enabled -------------------READ WRITE READ WRITE READ WRITE DISABLED READ ONLY READ WRITE '/home/oracle/orahome1/oradata/ora1/users01. SQL>recover database.dbf 42 /home/oracle¼/system01./home/oracle¼/rbs01.dbf' online. status.dbf /home/oracle¼/test1.dbf /home/oracle¼/users01. SQL> select name. enabled from v$datafile.dbf /home/oracle¼/temp.dbf Page ------- /home/oracle¼/tools01. .

dbf /home/oracle¼/users01. Status ---------SYSTEM ONLINE ONLINE ONLINE ONLINE ONLINE Enabled -------------------READ WRITE READ WRITE READ WRITE DISABLED READ ONLY READ WRITE SQL>select tablespace_name. status from dba_tablespaces./home/oracle¼/system01.dbf 43 ------- Page Name /home/oracle¼/rbs01. .dbf /home/oracle¼/tools01.dbf /home/oracle¼/temp.dbf Datafile is online) SQL> alter database open.dbf /home/oracle¼/test1.

SYSTEM 44 ------------------------------ Page TABLESPACE_NAME RBS TOOLS USERS TEST TEMP STATUS ----------ONLINE ONLINE ONLINE OFFLINE ONLINE ONLINE SQL>create table case10 (c1 number) tablespace users. SQL>create table case10 (c1 number) tablespace users. SQL> alter tablespace users online. 2) listner should up and running. 2) client software should be installed on client machine.FREE DBA&APPSDBA PRACTICE INTERVIEW QUESTIONS THESE ARE THE ANSWERS FOR POST NO: 67. . cannot allocate space in it. In case of remote connection. Table created. ORA-01542 : tablespace users is offline. 70. [oracle listiner starts up a dedicated server process and passes the server protocal adress to client using that address the clients connect to the server. CHECK IT OUT 1)What are the prerequisites for connecting to a database > 1) oracle net services should be available in both server and client. Once the connection is established the listiner connection is terminated] *********************************************************************** [AND] 1) check wether database server is installed on server or not.

. sysoper SYS can do only startup.resource to . SELECT_CATALOG_ROLE. SCHEDULER_ADMIN. in the os level] 6)Can you connect remotely as a user on DB Server.(with the help of ping 4) ensure thar oracle listiner is up and running 5) connect to server using server protocal address 2) Create a User "TESTAPPS" identified by "TESTAPPS" > create user identified by . SYSTEM donot use startup and shutdown options. AQ_ADMINISTRATOR_ROLE. AQ_USER_ROLE. OEM_ADVISOR ***PRIVILAGES****[select privileges from dba_sys_privs where grantee='SYS'....] CREATE ANY RULE CREATE ANY EVALUATION CONTEXT MANAGE ANY QUEUE EXECUTE ANY PROCEDURE ALTER ANY RULE CREATE RULE SET EXECUTE ANY EVALUATION CONTEXT INSERT ANY TABLE SELECT ANY TABLE LOCK ANY TABLE UPDATE ANY TABLE DROP ANY RULE SET ENQUEUE ANY QUEUE EXECUTE ANY TYPE CREATE RULE ALTER ANY EVALUATION CONTEXT CREATE EVALUATION CONTEXT ANALYZE ANY EXECUTE ANY RULE DROP ANY EVALUATION CONTEXT . HS_ADMIN_ROLE.. 8)What is the difference between "SYS" & "SYSTEM" Schema > SYS is a super most user..Page 45 3) check database and client are running on the same network or not. how? > /@ [with the help of connecting string] 7) Do you need to acess to DB Server to connect to a system schema? > NO. CONNECT. shudown options > SYSTEM schema has owns certain additional data dictonary tables. just knowing the username&password u connect from the client. 3) Connect to DB using TESTAPPS from DB Node and MT Node > first give grant options to the user.. If so. EXP_FULL_DATABASE. DBA. in the os level] 5)How do you identify local connections on a DB Server > ps -ef|grep -i local [where local=yes it is a local connection... EXECUTE_CATALOG_ROLE. DELETE_CATALOG_ROLE. RECOVERY_CATALOG_OWNER. RESOURCE. LOGSTDBY_ADMINISTRATOR. grant connect. SYS has additional roles sysdba... GATHER_SYSTEM_STATISTICS..... OEM_MONITOR. 4)How do you identify remote connections on a DB Server > ps -ef|grep -i local [where local=no it is a remote connection. 9)What are the roles/priviliges for a "SYS" Schema >***ROLES***[select granted_role from dba_role_privs where grantee='SYS'] IMP_FULL_DATABASE.

18)How do you verify whether a init.value. 14)From MT connect to db using "connect / as sysdba" > /as sysdba cannot connect to database from MT .] AQ_ADMINISTRATOR_ROLE DBA >**PRIVILEGES*** [select privilege from dba_sys_privs where grantee='SYSTEM'. its show false .V_$. static & dynamic .ISINSTANCE_MODIFIABLE from v$parameter.ora parameter is modifiable or not. V$ .ISSES_MODIFIABLE... > v$. > desc v$parameter select name.. V_$ are the temporary views which exist during the run time...ora parameter > Two ways . 13)How do you verify whether your DB is a single node or Multinode > sho parameter cluster.46 Page EXECUTE ANY RULE SET ALTER ANY RULE SET DEQUEUE ANY QUEUE DELETE ANY TABLE DROP ANY RULE CREATE ANY RULE SET SELECT ANY SEQUENCE 10)What are the role/privileges for a SYSTEM Schema > **ROLES** [select granted_role from dba_role_privs where grantee='SYSTEM'.....ISSYS_MODIFIABLE. or u can connect to DB from MT by creating password file 15)Is a Listener required to be up and running for a Local Connection > NO 16)Is a Listener required to be up and running for a remote Connection > YES 17)How do you verify the Background processes running from the Database > desc v$bgprocess select * from v$bgprocess.] GLOBAL QUERY REWRITE CREATE MATERIALIZED VIEW CREATE TABLE UNLIMITED TABLESPACE SELECT ANY TABLE 11)What is the difference between SYSDBA & DBA > SYSDBA has startup and shutdown options > DBA has no startup and shutdown options 12)What is the difference between X$ ..means single node..GV$ > X$ is permenent views > GV$ are used in RAC environment. 19)What are the various ways to modify an init.

. What are the data dictionary objects that can be viewed > normal users cannot connect to database.. dynamic.... 29)Startup an instance.. PMON started with pid=2... memory structures values.object type. using these parameters instance is created 27)What are the files essential to start an instance > init.ora file... Connect as user Testapps.. of objects available in an apps database with respect to a 12. OS id=4490 CKPT started with pid=7. normal users cannot connect the database. OS id=4488 LGWR started with pid=6.. 25)What is the difference between instance and Database > INSTANCE is group of memory structures and background processes.ora file..... defining the parameters values...status 23)When an DB is being started where is the information being recorded > Alert logfile. alter system set = scope=both (or) scope=spfile (or) scope=memory.. server process reads the inti.... parametrs values.. 30)After completing step 31. OS id=4498 MMNL started with pid=11... OS id=4482 PSP0 started with pid=3. Verify the data dictionary table dba_data_files... OS id=4492 SMON started with pid=8. 24)What is the information that is being recorded at the time of db Start . > DATABASE is physical memory.. > if its remote connection needs init. R. exit out of sql session.. to connect the database in nomunt & mount stages. 28)While the instance is being created can users connect to Database. > NO.[memory structures] defining the control files location. editing text in the init... 32)When the database is mounted how many Unix processes are created and how do you view them > ps -ux or alert logfile. and internally its parameters. Page 47 static...orafile & password file. ....... OS id=4500 ten background process and one server and cleint process.... or alert log file..ora file.....20)Why is init.. OS id=4486 DBW0 started with pid=5. 21)Why is a DB required to be in archive Log > To recover the database 22)List the total No.... its a volatile memory.. OS id=4484 MMAN started with pid=4... OS id=4494 RECO started with pid=9. connect as "apps" 31)When the instance is created how many Unix processes are created and how do you view them > startup nomount ps -ux..... D files. and its internally reads the SGA allocated size. only sys user can connect > normal users has no privileges. 26)How is an instance created > when ever issue the startup command..ora file required > For starting instance. collection of C. OS id=4496 MMON started with pid=10.

34 78. ..Assign the DEFAULT profile to the users > MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set > SMON: enabling cache recovery > Successfully onlined Undo Tablespace 1 > SMON: enabling tx recovery > Database Characterset is US7ASCII > Completed: alter database open **************************************************************************** No answer qus: 13. with mount id 4186671158 > Database mounted in Exclusive Mode > Completed: alter database mount 34) What are the data dictionary objects that can be viewed in a mount stage. 33)How do you mount a database after an instance is created.Create a new profile with CPU restrictions and assign it to the users D..Set the RESOURCE_LIMIT parameter to TRUE in the parameter file C.The Oracle kernel will be placed in this location.Revoke the DBA role and grant CONNECT and RESOURCE role to the users Answer: B QUESTION NO:12 You work as a database administrator for Certkiller . Which action would you take to ensure that resources limits are imposed on these users? A. What are the messages recorded while changing to mount stage > alter database mount > Setting recovery target incarnation to 1 > Successful mount of redo thread 1. B. Which objective will be achieved by this setting? A. You find that users with DBA role are using more CPU resources than what is allocated in their profiles.Specify the users as members of the DEFAULT_CONSUMER_GROUP 22.. In your Oracle database 10g installation you have set ORACLE_BASE to /u01/app/oracle.FREE ONLINE LATEST OCA DUMPS 1Z0 042 QUESTION NO 11 TO 30 QUESTION NO: 11 You work as a database administrator for Certkiller .The Oracle software will be placed in this location.48 Page > In mount stage (alter database mount) no extra process are not created. 35)How do you open a database after an instance is mounted. > Successful open of redo files. What are the messages recorded while changing to open stage > alter database open > opening redolog files. 30. 29.

Oracle install timestamp D. available in any location on the host machine from an application. Oracle homes and flag for auto startup Answer: G QUESTION NO:14 You work as a database administrator for Certkiller .3 hours B. E.until the database is shut down and the memory erased Answer: A QUESTION NO:15 In your Certkiller .until last year Answer: F QUESTION NO:13 The operating system filecratabin the Linux platform gets updated whenever you create a new database on the same host machine.You want to flash back a table that was created last year.The database files will be placed in this location. UNDO_RETENTION is set to 3 hours. How far back can the flashback query go? A. You want to restrict the database users to access files in a specific location on the host machine. if not specified explicitly.OracleSIDsonly B. Your database is configured for automatic undo management.6 months C.Oracle database creation timestamp F. What could do to achieve this? .The location will be considered for the base of Oracle Managed Files (OMF). you find that the database users are able to create and read files with unstructured data.OracleSIDsand Oracle homes only G.until last commit E.OracleSIDs. What kind of information is stored is stored in this file? A.Oracle homes only C.49 C.Oracle inventory pointer files E.until the point when the undotablespacewas refreshed F.The server parameter file (SPFILE) will be placed in this location.The location will be considered for the base of Optimal Flexible Architecture (OFA). Page D. production database.

User session data and Cursor state are stored inLargepool and Stack space is stored Shared pool. D.User session data and Cursor state are stored outside the System Global Area (SGA) and Stack space is stored inside the SGA. B.User session data is stored in Shared pool and Stack space and Cursor state are stored inLargepool. After inspecting the alert log file. B.PMON coordinates instance recovery. and grant read and write privilege on the directory object to the database users Answer: A QUESTION NO:16 Your boss at Certkiller . C.50 A. . C. What statement about the Shared Server configuration is valid? A. you execute the STARTUP command in SQL*Plus to bring the instance up.Grant read and write privilege on the operating system path to the database users wants you to clarify Oracle 10g. you find the database instance aborted.SMON coordinates instance recovery.Program Global Area (PGA) is stored in Shared pool.Create a directory object referring to the operating system path. Answer: D QUESTION NO:17 You work as a database administrator for Certkiller .Modify the value for the UTL_FILE_DIR parameter in the parameter file Page E.Undo Advisor would roll back all uncommitted transactions. What statement is true? A.Modify the value for the PLSQL_NATIVE_LIBRARY_DIR parameter in the parameter file E. D.User session data and Cursor state are stored inLargepool and Stack space is stored outside the System Global (SGA). On a Monday morning.Modify the value for the LDAP_DIRECTORY_ACCESS parameter in the parameter file D.PMON coordinates media recovery.

The compiled PL/SQL code will be stored in interpreted byte code.fubar.67. Which two URLs would you use to access the Database Control? (Choose F.162.http://162.europe.67.http:// Certkiller 13.http://www.fubar.fubar.17. D. Certkiller . C. Certkiller 13. *NATIVE PL/SQL library units (with the possible exception of top-level anonymous PL/SQL blocks) will be compiled to native (machine) code. Answer: A. Which object would be achieved by the setting? A.http://www. Such modules will be executed natively without incurring any interpreter overhead QUESTION NO:19 Exhibit: You work as a database administrator for Certkiller .) G.123:5500/em C. Answer: C PLSQL_CODE_TYPE specifies the compilation mode for PL/SQL library units. Values: *INTERPRETED PL/SQL library units will be compiled to PL/SQL bytecode format.QUESTION NO:18 Page Answer: B 51 E. You have started the database instance and you want to manage your database remotely with Enterprise Manager through a Web database server the parameter PLSQL_CODE_TYPE has been set to NATIVE.SQL*PLUS reports an error with the message asking you to perform instance recovery.123:5500/em B. In your Certkiller .http://fubar. Certkiller .17. C QUESTION NO:20 .The source PL/SQL code will be stored in native machine D.The source PL/SQL code will be stored in interpreted byte code.europe.The compiled PL/SQL code will be stored in native machine code.123:5500/em E. Certkiller . Certkiller .http:// Certkiller 13. Such modules are executed by the PL/SQL interpreter engine.162.http:// Certkiller 13.europe.

What would you do to overcome this problem? A. you would receive a constraint violation error. automatically the corresponding rows are deleted from the dept table. you find the following error message in the output log: ORA-01653 unable to extend table HR. E. and undo retention has been set to PROD database complain about the slow response of transactions.Truncate the Certkiller STAFF table and run the job C. While investigating the reason you find that the transactions are waiting for the undo segments to be available.When you delete a row from the dept table.When you delete a row from theemptable. automatically the corresponding rows are updated with null values in theemptable.Increase the size of the USERStablespacethe and run the job E.When you delete a row from the dept table. Answer: D QUESTION NO:22 You work as a database administrator for Certkiller .Increase the size of the undotablespace Answer: D .Increase the size of the database default permanenttablespaceand run the job Answer: D QUESTION NO:21 Exhibit Which statement regarding thedeptandemptables are true? A. B.Delete all rows from the Certkiller STAFF table and run the job D.Increase the undo return B.When you delete a row from theemptable. Certkiller STAFF by 8 intablespaceUSERS Which task would you perform to load the data successfully without affecting the users who are accessing the table? A. automatically the corresponding rows are deleted from theemptable. you find the status of the job as automatically the corresponding rows are updated with null values in the dept table.When you delete a row from the dept table.Page 52 You work as a database administrator for Certkiller .com.When you delete a row from theemptable. you would receive a constraint violation error. F. While loading data into the Certkiller STAFF table using Oracle Enterprise Manager 10g Database Control. D. Users in the Certkiller . On further investigation.Create another undotablespace D. C.Restart the database instance and run the job B.Create more undo segments C.

to the productiondatagbase. B. resulting in loss of all the control files in your Certkiller . D. error You work as a database administrator for Certkiller . View Exhibit #1 to see the source and targetdatabase. .uk. The codefailsandproduces the error displayed in Exhibit #3.comoption in the command F.Remove thedumpfileoptions and add thenetwork_link= devdb.comoption in the command E. to the schemas option in the command D.You want to import schema objects of the HR user using Oracle Data Pump from the development database.Add the user. What would you do to overcome the error? A.Remove thedumpfileoption in the command B. Certkiller .Remove theflashback_timeoption in the command C.comoption in the command Answer: F QUESTION NO:25 You work as a database administrator for Certkiller .l You execute the code in Exhibit #2.Which statement regarding the database instance is true in this scenario? A. Certkiller . The database is open. How can reduce the recovery time? Choose two.53 QUESTION NO:23 Page You are working on a test database where instance recovery takes a considerable amount of time.By setting the UNDO_RETENTION parameter to a higher value Answer: C. command Exhibit #3.Add thenetwork_link= devdb.By multiplexing the control files B.The instance would be in the open state. You have created a database link. Certkiller .uk. instance would abort in such cases.By configuring mean time to recover (MTTR) to a lower value E.Remove the schemasoptions and add thenetwork_link= devdb. D QUESTION NO:24 Exhibit #1 Exhibit #2. PRODDB.The instance needs to be shut down. C.By multiplexing the redo log files C. A media failure has occurred.SYSTEM.By decreasing the size of redo log files D. devdb. between the database PRODDB and instance would hang. A.

Answer: E QUESTION NO:27 You are working on the Certkiller database. What is the default name of the alert log file in this database? A.log F.trace_alert_ Certkiller . To which type of object would you refer to determine the cause of the slow response? A. but all the background processes will be restarted.The operating system log fields E.use enterprise manager B.The fixed views C. Certkiller _alert_log.The instance would in the open instance would be in the open and invalid state.log D.use DBMS_SQL package .log Answer: A QUESTION NO:28 You work as a database administrator for Certkiller .The dynamic performance views. users complain about the slow response time when accessing the database.The data dictionary views Certkiller .alert_ Certkiller . You have set the retention period for Automatic Repository (AWR) statistics to four days and collection interval to 15 minutes.log E.log B.log_alert_: Certkiller .log C. Which two methods would you use to view the AWR statistics? Choose two A. You want to view the statistics collected and stored in AWR snapshot. You have not optimized the memory usage of the Oracle instance and you suspect the problem to be with the memory. QUESTION NO:26 You work as a database administrator for Certkiller .54 E.The trace file B.alert_log_ Certkiller . In a production environment. Answer: D Page F.

E. which contains about ten thousand rows.The modified data are not available on disk. F QUESTION NO:29 You work as a database administrator for Certkiller . As a result of performance analysis. C. B. Which is the modified value invisible to Bill? A. the new value is invisible to Bill. D.query the AWR snapshot repository objects 55 D.Jack has not committed the changes after modifying the value. Later.E. Answer: D .A leaf row in the index will be deleted and inserted. D.use DBMS_AWR package F. C. Jack and Bill.The modified rows of the Certkiller STAFF table have been locked. are accessing the Certkiller STAFF table of the Certkiller DB database. How does this change affect the index? A.The modified data have been flushed out from memory.The index becomes invalid when you make any updates Answer: D QUESTION NO:30 Two database users.use PRVT_WORKLOAD package Page C. When Jack modifies a value in the table. E. you created an index on theprod_namecolumn of the Certkiller index will be updated automatically at commit.A leaf will be marked as invalid.An update in a leaf row takes place. B. you updated a product name in the table.Both users are accessing the database from two different machines.use DBMS_WORKLOAD_REPOSITORY package Answer: A.

Page 56 .