dba

29
ORACLE DATABASE INTERVIEW QUESTIONS =================================== 1) What are the components of physical database structure of Oracle database? 1. Control files 2. Init file 3 log files 4 redo/archive log files 5 data files ------------------------------------------------------------ 2) What are the components of logical database structure of Oracle database? Oracle logical structure follows the order like Tablespace Segments Extents Datablocks ---------------------------------------------------------- 3) What is a Tablespace? A tablespace in Oracle database is logical grouping of physical datafiles. ----------------------------------------------------------- 4) What is system tablespace and when it is created? IN 10g there are two system table spaces called system and sysaux(auxillary) tablespace. These system tablespaces are backbone of database and data base will not function at all without these tablespaces. They created at the time of creation and contained meta data of the database. The meta data is the data about data. The system tablespace also contain data dictionary. ------------------------------------------------------------ 5) Explain the relationship among database, tablespace and data file.What is schema? Databases tablespaces and datafiles are closely related but they have important differences:

Transcript of dba

ORACLE DATABASE INTERVIEW QUESTIONS

===================================

1) What are the components of physical database structure of Oracle database?

1. Control files

2. Init file

3 log files

4 redo/archive log files

5 data files

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

2) What are the components of logical database structure of Oracle database?

Oracle logical structure follows the order like

Tablespace

Segments

Extents

Datablocks

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

3) What is a Tablespace?

A tablespace in Oracle database is logical grouping of physical datafiles.

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

4) What is system tablespace and when it is created?

IN 10g there are two system table spaces called system and sysaux(auxillary) tablespace. These system tablespaces are backbone of database and data base will not function at all without these tablespaces. They created at the time of creation and contained meta data of the database. The meta data is the data about data. The system tablespace also contain data dictionary.

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

5) Explain the relationship among database, tablespace and data file.What is schema?

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

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

--- Each Table space in an Oracle database consists of one or more files called datafiles.

--- A database's data is collectively stored in the datafiles that constitute each tablespace of the database.

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

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

6) What are schema objects?

When a database user is created a corresponding schema with the same name is created for that user.

A schema is a named collection of objects that include Tables Triggers constraints Indexes Views Sequences clusters procedures and packages that are associated with a particular user etc..

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

7) Can objects of the same schema reside in different tablespaces?

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

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

8) Can a tablespace hold objects from different schemas?

It can be the only required option is that your tablespace have quota assigned to any user that want to store objects in it.

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

9) Does a view contain data?

The answer depends on the type of view. in case of normal view the ans is NO it only contains query based on a base table but in case of materialized view YES it does contain data and for the updated data in the base table it needs to be refreshed.

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

10)What is an Oracle sequence?

A sequence is a database object created by a user that can be used to generate unique integers. A typical usage of sequences is to generate primary key values which are unique for each row.

It is generated and incremented (or decremented) by an internal Oracle routine. It can be used by multiple users and for multiple tables too. A sequence can be used instead of writing an application code for sequence-generating routine.

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

11) What is a synonym and their types?

Synonym as the name suggests is an alternative name for an object. It can be used for simplifying names that are lenghy or complex for e.g you can use a simple synonym for accessing objects of other users for which you had to prefix username to the object.

1- a private synonym is defined in the schema of a user and is available only to the user.

2- a public synonym is usually created by dba and is available for use by any database user.

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

12) What are synonyms used for?

Synonyms are used to: Mask the real name and owner of an object.

Provide public access to an object

Provide location transparency for tables views or program units of a remote database.

Simplify the SQL statements for database users.

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

13) How are the Indexes updated in oracle?

Indexes can be updated by either Dropping and recreating them or Rebuilding them online.

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

14) Explain what are Oracle Catalog and Oracle Archive log?

System Created Tables Which Contain Statistics and Useful Data Collected Automatically by the Database Engine to Help the Administrator or the regular users.

There Are Several Kinds Of Catalogs :

V$_Catalog

dba_Catalog

User_Catalog

RMAN Catalog:

Catalog Created By Rman manually After Enabling Archive Log Which Contain Data Regarding The BackUp/Recovery Process.

Archive Log: Member Of The Archive Group Contain all committed data is very essential in recovering database to the last minute before disaster.

DataBase Archiver: Responsible For Creating Archive Log Files .

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

15) What are PCT Free and PCT Used? What is PCT increase parameter in segment? What is growth factor? PCTFREE and PCTUSED are the block storage parameters.

1. PCTFREE- This parameter is used to specify how much space should be left in the block for updates.For eg. If The PctFree for a block is 30, then Oracle keeps on adding new rows to the block until the block is 70 % full. It leaves the 30 % for future updates. That is, in case, any row is updated and requires some more space, it is taken out from the 30 % remaining in the Block. U should specify the Value of this parameter HIGH if future updates in the rows of the table are going to need more space. In case ur table is less prone to updates, then this value can be specified LOW.

PCTUSED: As I have mentioned above, Oracle stops INSERTING new Rows in a table when the space usage reaches the PCTFREE limit. Now consider this ---- When should Oracle start inserting new rows in the Block? PctUSED parameter is taken into consideration for the answer of the above question.Suppose you have specified PCTUSED as 40 % and PCTFREE as 20 %.

1. Oracle will keep on inserting new rows till the space is 80 % used. It will reserve the remaining 20% for future updates.2. To start adding new rows again to the block, Oracle will check the space in the Block and the PCTUSED parameter.3. When the space falls below 40 %, Oracle will start adding new rows to the block.

PCTINCREASE integer -- Minimum value is 0. Default value is 50

Specify the percent by which the third and subsequent extents grow over the preceding extent. The minimum value is 0, meaning all extents after the first are the same size. The default value is 50, meaning that each subsequent extent is 50% larger than the preceding extent. If the value of the PCTINCREASE parameter is changed using the ALTER statement, SMON calculates the size of the next extent using the new value and the size of the most recently allocated extent. Setting PCTINCREASE to 0 will prevent SMON from coalescing extents and keep all extents the same size. Setting of 0 as a way to minimize fragmentation and avoid the

possibility of very large temporary segments during processing. PCTINCREASE cannot be specified and therefore is always 0 for rollback segments.

----------------------------------------------------------------------------------------16) What is dump destination? What are bdump, cdump and udump? Explain in detail.

UDUMP is specifying the user dump directory where all user error logs (trace files) will be placed.BDUMP is specifying the background dump directory where all database error logs (trace files) will be placed.CDUMP is specifying the core dump directory where all OS error logs (core dump files) will be placed.

Default location is (ORACLE_BASE/admin/<SID>)

Login as root:SYNTAX : sqlplus "/ as sysdba"

Then issue this commandSYNTAX : show parameters dump_destIt'll show you all the bdump cdump and udump directories wherever it is currently located.

You can change your parameters in init.ora by creating spfile from pfile.SYNTAX: Create SPFILE from PFILE

In 11g this concept has been replaced with diagnostic test!------------------------------------------------------------------------------------------------------------17) What are four performance bottlenecks that can occur in a database server and how are they detected?

18) What are four errors found in an alert (error) log that can ruin a DBA's appetite and how can you avoid them?

CPU bottlenecksUndersized memory structuresInefficient or high-load SQL statementsDatabase configuration issues

Can be avoided by:• Analyzing Optimizer Statistics

• Analyzing an Execution Plan

• Using Hints to Improve Data Warehouse Performance

• Using Advisors to Verify SQL Performance

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

19) Can you perform DML operations when the standby database is in read only in Standby Database?

In a nutshell One can do SELECTS only on a Physical/Logical Standby database. The basic principle behind Oracle Standby database is to provide protection against media failures. So no DMLs are allowed on the standby database and the most important things is that Standby databases can always be opened in READ-ONLY mode which won't allow DMLs.

---------------------------------------------------------------------------------------------------------------------20) What will you do if in any condition you do not know how to troubleshoot the error at all and there are no seniors or your co-workers around?

21) What are the different scenarios for rebuilding indexes?

If the blevel column in DBA_INDEXES is greater 4, it's time to rebuild the index. Make sure that you analyze the index before checking the blevel columns (analyze index owner.table_name estimate statistics sample 20 percent).

deleted entries represents 20 or more of the current entries, then its time to rebuild indexes.------------------------------------------------------------------------------------------------------------22) How to convert local management tablespace to dictionary managed tablespace?

Local to Dictionary managed tablespcaes:exec dbms_space_admin.Tablespace_Migrate_FROM_Local('tablespace');

Dictionary to locally managed tablespaces:exec dbms_space_admin.Tablespace_Migrate_to_Local('tablespace');---------------------------------------------------------------------------------------------------------------------

23) As a Oracle DBA what are all the UNIX file you should be familar with?

$ORACLE_HOME/dbs/etc/oratab/etc/system-----------------------------------------------------------------------------------------------

24) When the developer trying to compile the package. But the database gets hanged? What will you check?

the package is being used, look v$session_wait for library cache pin lock, ddl locks

-----------------------------------------------------------------------------------------------25) When yesterday developer gives the following command: select count(*) from [table name]it gives the output within minutes, today the same command takes hours? What will you check?

HWM (High Water Mark).-----------------------------------------------------------------------------------------------26) How will you rectify if one of the rollback segments gets corrupted?

The database should be in Archive Log Mode, then take the rollback segment offline and then one should go for a restore and Point In time recovery.----------------------------------------------------------------------------------------------27) When exporting using filesize parameter, if three files is generated. How the Oracle name these three files?

When Export reaches the value you have specified for the maximum FILESIZE Export stops writing to the current file opens another export file with the next name specified by the FILE parameter and continues until complete or the maximum value of FILESIZE is again reached. If you do not specify sufficient export filenames to complete the export Export will prompt you to provide additional filenames.---------------------------------------------------------------------------------------------28) Three users at a time giving the following command: alter database backup controlfile to trace; How can you differentiate the file using the filename itself?

When you issue the command alter database backup controlfile to trace ; a trace file will be created in the user_dump destination.

The default name of the trace file would look something similar to dbname_ora_5175.trc. The number 5175 is the unix process id of the user session which initiated this trace. As each user has their own unix pid you can identify the file created by that user.

Still want to double confirm open the trace files generated during that time and you will find the client information there.-----------------------------------------------------------------------------------------------------------------

29) When you execute: alter tablespace begin backup; How can Oracle engine can identify that the corresponding datafiles are in backupmode?

select * from v$backup; in this view you can check for status if it is ACTIVE that file is still in backup mode.----------------------------------------------------------------------------------------------------------------

30) What are the differences between database designing and database modeling?

31) If the large table contains thousands of records and the application is accessing 35% of the table which method to use: index searching or full table scan?

32) In which situation whether peak time or off peak time you will execute the ANALYZE TABLE command. Why?

33) How to check to memory gap once the SGA is started in Restricted mode?

34) If the SQL * Plus hangs for a long time, what is the reason?

35) How do you increase the performance of %LIKE operator?

36) Explain Dual table. Is any data internally stored in dual table. Lot of users are accessing select sysdate from dual and they getting some millisecond differences. If we execute SELECT SYSDATE FROM EMP;

37) In exception handling we have some NOT_FOUND and OTHERS. In inner layer we have some NOT_FOUND and OTHERS. While executing which one whether outer layer or inner layer will check first? Once you got inside the OUTER_LOOP it comes out only after the NOTFOUND statement.So OUTER_LOOP will be valuated first.Its similar to C language first OUTER_LOOP will valuated followed by an INNER_LOOP.-----------------------------------------------------------------------------------------------38) What are clusters?

A Cluster is made up of a table or group of tables that share the same data blocks which are grouped togather because they share common columns and are often used together.

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

39) What is cluster key?

The related columns of the tables in a cluster are called the cluster key. The cluster key is indexed so that rows of the cluster can be retrieved with a minimum amount of I/O.

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

40) What is index cluster?

An index cluster uses an index to maintain data within the cluster. The structure of a cluster index is similar to a normal index.

Although a normal index does not store NULL key values and index cluster can store it.

And a cluster index is likely to be smaller than a normal index because there is only one entry for each key value in the cluster index even if that is repeating.

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

41) What is hash cluster?

A hash cluster uses a hash algorithm which could either be system generated or user defined to calculate the location of a row both for retreival and for DML.

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

42) When can hash cluster used?

Hash clusters are useful in cases where :

(i) There is a uniform even and predictable no. of key values.

(ii) Queries using equality predicates.

(iii) The table is NOT growing constantly and the keys are rarely updated.

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

43)What is database link?

A database link (same as linked servers in SQL Server) is an object in one Oracle database that defines a path to another database. They allow you to query remote tables and execute remote procedures residing in an Oracle User on that remote Oracle database. That way you can use tables and other objects from that database in a SQL statement that you execute locally. Say for example that you had a table called USER_MASTER in a remote database (ABC) and that you wanted to access that data while connected to your local database (XYZ) and based on the information that you get from that table you need to decide what your processing logic is going to be. A database link is what you need. Before creating it you must collect the following information:

a) A net service name that your local database instance can use to connect to the remote instance and

b) A valid username and password on the remote database.

The net service name is necessary for every database link. The username and password that you specify when defining a database link are used to establish the connection to the remote instance.

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

44) What are the types of database links?

Oracle allows you to create private public and global database links.

Private Database Link: You can create a private database link in a specific schema of a database. Only the owner of a private database link or PL/SQL subprograms in the schema can use a private database link to access data and database objects in the corresponding remote database.

Public Database Link : You can create a public database link for a database. All users and PL/SQL subprograms in the database can use a public database link to access data and database objects in the corresponding remote database.

Global Database Link - When an Oracle network uses Oracle Names the names servers in the system automatically create and manage global database links for every Oracle database in the network. All users and PL/SQL subprograms in any database can use a global database link to access data and database objects in the corresponding remote database.

A private database link is more secure than a public or global link because only the owner of the private link or subprograms within the same schema can use the private link to access the specified remote database.

When many users require an access path to a remote Oracle database an administrator can create a single public database link for all users in a database.

When an Oracle network uses Oracle Names an administrator can conveniently manage global database links for all databases in the system. Database link management is centralized and simple.

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

45) What is row chaining?

if a datablock is not able to store a complete row due to its less size then a row is store in another blocks & address of that row is stored in the previous block.it degrade performance of a database & there r more IOS generated.

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

46) name various types of segments?

Table segments

Index segments

Undo segments

Temp segments

Rollback segments

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

47) What are the characteristics of data files?

Characteristics of a Data File :

- A Data file can be associated with only one tablespace.

- Once created a datafile can be increased or decreased in size with RESIZE

command. Example: ALTER database datafile '/u03/oradata/dev01/users_02.dbf'

RESIZE 150 MB ;

- Once created a datafile cannot be dropped. It can only be shrunk to an

insignificant size.

- One or more data files form a logical unit of database storage called a

Tablespace.

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

48) What is the function of redo log?

Redo Log is ment to trce or note the modifications that are applied to data buffer cache it will note on folloing situations

1)for every 3 seconds

2)when redo log buffer reaches to 1MB

3)before dbWR writes data to datafiles from DB_cache

4)when ever commited

5) When 1/3rd of Redo log buffer is full.

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

49) What does a control file contain?

The control files of a database store the status of the

physical structure of the database. The control file is

absolutely crucial to database operation. It contains (but is not limited to) the following types of information:

* Database information (RESETLOGS SCN and their time

stamp)

* Archive log history

* Tablespace and datafile records (filenames, datafile

checkpoints, read/write status, offline or not)

* Redo threads (current online redo log)

* Database's creation date

* database name

* current archive log mode

* Log records (sequence numbers, SCN range in each log)

* RMAN catalog

* Database block corruption information

* Database ID, which is unique to each DB

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

50) What is the use of Control files?

When an instance of an ORACLE database is started, its control file is used to identify the database and redo log files that must be opened for database operation to proceed. It is also used in database recovery.

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

51) What are the basic elements of base configuration of an Oracle database?

It consists of

one or more data files.

one or more control files.

two or more redo log files.

The Database contains

multiple users/schemas

one or more rollback segments

one or more tablespaces

Data dictionary tables

User objects (table,indexes,views etc.,)

The server that access the database consists of

SGA (Database buffer, Dictionary Cache Buffers,

Redo log buffers, Shared SQL pool)

SMON (System MONitor)

PMON (Process MONitor)

LGWR (LoG Writer)

DBWR (Data Base Writer)

ARCH (ARCHiver)

CKPT (Check Point)

RECO

Dispatcher

User Process with associated PGS

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

52. What is ORA_ROWSCN?

ORA_ROWSCN is a pseudo-column which is a new feature of oracle 10g.It returns the SCN for most recent changes made to a row, when it was read. This column is used to determine when the row was recently updated. Row level dependency tracking has to be enabled to start row level SCN tracking using ORA_SCN.It is done by using the ROWDEPENDENCIES keyword in the CREATE TABLE command. ----------------------------------------------------------------------------------------------53. What is virtual IP?

A virtual IP address eliminates a host's dependency upon individual network interfaces.Incoming packets are sent to the system's VIP address, but all packets travel through the real network interfaces.Previously, if an interface failed, any connections to that interface were lost. With VIPA on your system and routing protocols within the network providing automatic reroute, recovery from failures occurs without disruption to the existing user connections that are using the virtual interface as long packets can arrive through another physical interface. Systems running VIPA are more highly available because adapter outages no longer affect active connections. Because multiple physical adapters carry the system IP traffic, overall load is not concentrated on a single adapter and associated subnet.-----------------------------------------------------------------------------------------------54. What is bigrow id?

This returns for each row selected the unique internal row address for the physical row. The rowid of a row contains such information as the object_id, file_id, block_id, and row number that uniquely identifies a row in the table. Moreover, since index lookups only evaluate to a rowid and then go after the data, accessing a row by rowid is the fastest way to extract information. Probably the most famous use for the ROWID is to get rid of duplicates in a table.The ROWNUM pseudocolumn returns, for each row, a number that indicates the order in which the row was selected from the table

55. What is db_file_multiblock_read_count

DB_FILE_MULTIBLOCK_READ_COUNT is one of the parameters you can use to minimize I/O during table scans. It specifies the maximum number of blocks read in one I/O operation during a sequential scan. The total number of I/Os needed to perform a full table scan depends on such factors as the size of the table, the multiblock read count, and whether parallel execution is being utilized for the operation.

56. What is control_file_record_keep_time

CONTROL_FILE_RECORD_KEEP_TIME specifies the minimum number of days before a reusable record in the control file can be reused. In the event a new record needs to be added to a reusable section and the oldest record has not aged enough, the

record section expands. If this parameter is set to 0, then reusable sections never expand, and records are reused as needed.

57. What is pga_aggregate_target

PGA_AGGREGATE_TARGET specifies the target aggregate PGA memory available to all server processes attached to the instance.Setting PGA_AGGREGATE_TARGET to a nonzero value has the effect of automatically setting the WORKAREA_SIZE_POLICY parameter to AUTO. This means that SQL working areas used by memory-intensive SQL operators (such as sort, group-by, hash-join, bitmap merge, and bitmap create) will be automatically sized. A nonzero value for this parameter is the default since, unless you specify otherwise, Oracle sets it to 20% of the SGA or 10 MB, whichever is greater.Setting PGA_AGGREGATE_TARGET to 0 automatically sets the WORKAREA_SIZE_POLICY parameter to MANUAL. This means that SQL workareas are sized using the *_AREA_SIZE parameters.Oracle attempts to keep the amount of private memory below the target specified by this parameter by adapting the size of the work areas to private memory. When increasing the value of this parameter, you indirectly increase the memory allotted to work areas. Consequently, more memory-intensive operations are able to run fully in memory and less will work their way over to disk.When setting this parameter, you should examine the total memory on your system that is available to the Oracle instance and subtract the SGA. You can assign the remaining memory to PGA_AGGREGATE_TARGET.

58. What is optimizer_mode

59. what is statistics_level

60. what is undo_retention

61. what is latch

62. what is semaphores

63. what is baseline

64. what is difference between dbms and rdbms

65. what is enques

66. what is rman cloning

67. what is rman backups retaintion

68. what is rman backup limitation

69. what is – semaphores usage ipcs -sb |grep oracle user

70. what is export/import

71. what is grid?

72. what is datapump memory usage?

73. what is streams pool?

74. when Resumable space management occurs,out of space condition, max extents reached condition and space quota exceeded.

75. What is difference between AWR/Stats pack

76. Snapshot generation by MMON/MMONL default for 60min in SYAUX tablespace

77. More redo during backup? Compress in RMAN? why?

78. If no catalog where the info will be stored in RMAN

79. How to control RMAN backup during peak hours.80. What parameter is used to find space required by an export dump?

“ESTIMATE_ONLY “

81. mi-hr-dt-mh-wk of crontab

82. spfile file should be created before “OPEN” ing the database

83. migration/upgradation methods: advantages of data pump over export are ,direct path and writing/creating dump file on server side.

sessions_per_user=2 can be used only if resource_limit=true

update query working process….

84. difference between recursive/nonrecursive calls

85. database performance got slowed down after upgradation 9i to 10g which corrected by dbms_stored_outln tables have stored old execution plans which needs to be dropped and fresh statistics should be generated.

86. snapshot too old error

This occurs when stmt requires data that has been modified, committed and rollback data is not longer available.

This can be avoided by

87. Mutation of triggers

It is occurred when triggere accesses the same table on which it is based

It will not occur if single record is inserted in the table,only bulk insert will cause this issue

It will occurs for insert,update,deletes present in triggers

Don’t use the row level triggers for updation. spilt the logic and use multiple triggers

Use proper logic and avoid mutating triggers

88. Latch and lock

Latch,It is an oracle internal memory used to protect the data structure of SGA

Lock,it is the mechanisam to maintain the data consistency while allowing highest degree of concurrency this is managed by oracle server.

89. Space requirement by Undo,

Undospace = UR(UndoRetentions)*UBS(UndoBlocksusedperSecond)*OverHead

Semaphores, It is an OS facility used to control waiting

EXTEND,Whenever there is large transaction will be performing in small extent then extent size will be automatically

get enabled till trsansction gets over and shrink back to original position.

90. KOOLFROG, It builds web pages for oracle databases using DHTML,oracle appln server

91. DBDIFF, It is an ODBC utility that performs a comparison of two databases

ROWID => dataobject + datafile + datablock + row

92. 4 piece format in 9i and 3 piece format 10g

93. Row Migration, It occures whenever the pctfree set to low value which provides insuffiiceint space for rows during updation

94. Row Chaining, It occurs whenever too large row to fit into a block then row pieces of row will be stored in sepesrte blocks with necessary pointer to retrive.

pctfree + pstused should be less than or equal to 100

PCTFREE, minimum %age of data block to be reserverd for the possible updation

PCTUSED, minimum %age of data block that should be used before inserting rows.

Partitioning,it improves managibility, availability,performance,independent manage of partitions

95. Range partitioning, enable row movement is used to avoid the error caused due to an attempt made to insert a row.

95. Hash partitioning,We can’t merge,spilt,drop but add or coalsce

96. Composite, It is collection of both hash and range portioned tables portioned using range,subpartion using hash

97. List, It makes use of discrete value for partioning

98. Heap table,

IOT, It works on primary key access instead of rowid based

CLUSTER, It used to store the related data of different tables on same block

TEMP,This may be transaction specific or session specific

99.

Delete,It is DML,deletes particular info,generate redolog,can be rolled back,fire triggers

Drop,it will delete table staructure and data

Truncate,It deletes the row,recliams storage space,can’t be rolled back,can’t

generate redo,not fire triggers.

100. Snapshot Too Old Error, ORA-01555

“It occurs when stmt requires data that has been modified, committed and rollback is no longer available”

Index, BitMap -nonunique,low-cardinality,used for Dataware Housing

B-TREE,unique,high cardinality,used for OLTP transactions

System privileges, grant with admin options uses can grant and revoke from other users,

used to perform specific database operation for index,table,session,tablepace

101. Object privileges,grant with grant option,used to access particular object,alter,delete,insert,select,update

102. product_user_profile file is used to enable/disable command for a user.

103. What is Rebuild and coalesce

104. orapwd file=orapwd[Instancename] password = ***** entries=5

105. remote_login_services=exclusive/shared/none

106. Oracle 9i new features:

locally managed tablespaces,

resumable space management

undo tablespaces

dynamic SGA,spfile creation

non-standard block sizes

oracle managed files,unused column,flash back query

networking with oracle names server(names.ora),local naming(tnsnames.ora),Host Naming

data definition language (DDL) = create,drop,truncate,alter

data manipulation language (DML) = insert,update,delete,merge

data retrival language (DRL) = select

data transactional control (DTL) = commit,rollback

data control language (DCL) = grant,revoke

107. SQL Loader,This loads data into a table from external flat files,there are two ways.conventional path and direct path.

BadFile, It contains the records that are rejected by the SQL loader bcoz of invalid input format.

DiscardFile,It contains the records that were filtered out bcoz of did not match any record selection criteria.

Direct Loader,it will directly copy the data from one table to another within the samedatabase bypassing the

db buffer cache, this can be serial or parallel.

108. sqlnet.ora,used to control the behavior of net services

109. tnsanmes.ora,used to stores the net service names.

110. Logminer,It is a relational tool used to read,analyze,interpret online anarchived log files using SQL.

Provide information about any changes at any time

It also tracks the database changes, undoing databases, tuning the databases.

111. Creating dictionary file,

execute dbms_logmnr_d.build(directory name)

112. Adding file for analyze

execute dbms_logmnr_addlogfile

113 Initiate the analyze of file

execute dbms_logmnr_start.logmnr

114. Releasing the resources

execute dbms_logmnr_end.logmnr

115. DBVerify, it is an utility used to check the data blocks validity before being restored.

116. LRU Algorithms, It is an algorithms used to determine the which buffers

can be overwritten to accommodate new blocks in buffer cache.

117. ORACLE 8i new features,

RMAN commands,

Configure, used to configure persistent setting for RMAN

Show, used to display persistent setting set by configure command

List, used to produce detailed information backyup set and datafiles copies

Report, used to produce detailed analysis of repository

Crosscheck,

Change,

Tuning,

118. Library Cache Miss Ratio,

PINS, the no of times item was excuted in Library cache

RELOADS,the no of times item was requested

CACHE MISS RATIO=[sum(RELOADS)/sum(PINS)] * 100 < 1%

119. Data Dictionary Cache MISS Ratio,

GETS,the total no of requests for the particular item

GETMISSES,the total no of requests resulting in cache missing

CACHE MISS RATIO=[sum(GETMISSES)/sum(GETS)] * 100 < 10%

120. Database buffer cache Hit Ratio,

Physical Reads,This is total no of requests that resulted in a disk access

consistent gets & db_block_gets, total no of request for data

Cache Hit Ratio=1-[(physical reads/(dbblockgets+consistentsgets))] > 90

121. Sort Hit Ratio,

(Disk Sorting/Memory Sorting) * 100 < 5%

122. STATSPACK PROCESSING:

Installation of statspack

ORACLE_HOME/rdbms/admin/spcreate.sql

Collection of Statistics

Execute statspack.snap

Automatic Collection of Statistics

ORACLE_HOME/rdbms/admin/spauto.sql

Produce the report

ORACLE_HOME/rdbms/admin/spreport.sql

Delete the unwanted snapshot

ORACLE_HOME/rdbms/admin/sppurge.sql

And set TIMED_STATISTICS=TRUE to collect the timing info

Staspack Information contains,

db and instance name

top five events

SGA statistics

Latch, ROLL BACK segments

dictionary, library, instance statistics

123. Cloning/Renaming database,

backup control file to trace

shutdown the db using proper shutdown

copy the tracefile to *.sql file

edit the *.sql file with

create controlfile set database “NAME” resetlogs,noarchivelogs and mention mountpoints if any changes in location

edit the init.ora file to change the db_name

startup nomount

execute the *.sql file

124. How many memory layers are in the shared pool?Answer The shared pool portion of the SGA contains three major areas: library cache, dictionary cache, buffers for parallel execution messages, and control structures

125. How do you find out from the RMAN catalog if a particular archive log has been backed-up?

126. How can you tell how much space is left on a given file system and how much space each of the file system’s subdirectories take-up?Df –k(solaris)

127. Define the SGA and how you would configure SGA for a mid-sized OLTP environment? What is involved in tuning the SGA?

128. What is the cache hit ratio, what impact does it have on performance of an Oracle database and what is involved in tuning it?

129. Other than making use of the statspack utility, what would you check when you are monitoring or running a health check on an Oracle 8i or 9i database?

130. How do you tell what your machine name is and what is its IP address?

131. How would you go about verifying the network name that the local_listener is currently using?

132. You have 4 instances running on the same UNIX box. How can you determine which shared memory and semaphores are associated with which instance?

133. What view(s) do you use to associate a user’s SQLPLUS session with his o/s process?

134. What is the recommended interval at which to run statspack snapshots, and why?

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

136. Assuming today is Monday, how would you use the DBMS_JOB package to schedule the execution of a given procedure owned by SCOTT to start Wednesday at 9AM and to run subsequently every other day at 2AM.

137. How would you edit your CRONTAB to schedule the running of /test/test.sh to run every other day at 2PM?

138. What do the 9i dbms_standard.sql_txt() and dbms_standard.sql_text() procedures do?

139. In which dictionary table or view would you look to determine at which time a snapshot or MVIEW last successfully refreshed?

140. How would you best determine why your MVIEW couldn’t FAST REFRESH?

141. How does propagation differ between Advanced Replication and Snapshot Replication (read-only)?

142. Which dictionary view(s) would you first look at to understand or get a high-level idea of a given Advanced Replication environment?

DBA_REPSITES--------------------------------------------------------------------------------------------

143. How would you begin to troubleshoot an ORA-3113 error?There was a communication error that requires further investigation. First, check for network problems and review the SQL*Net setup. Also, look in the alert.log file for any errors. Finally, test to see whether the server process is dead and whether a trace file was generated at failure time.

------------------------------------------------------------------------------------------144. Which dictionary tables and/or views would you look at to diagnose a locking issue?

v$lock/v$locked_objects/v$enqueue_lock/dba_locks/dba_ddl_locks/dba_lock_internals.  x$kgllk,x$kglpn(library cache lock/pins).--------------------------------------------------------------------------------------------

145. An automatic job running via DBMS_JOB has failed. Knowing only that “it’s failed’, how do you approach troubleshooting this issue?

1) check the error no with alert_log. or jobq trace file.  2) check job parameters.

-----------------------------------------------------------------------------------------------146. How would you extract DDL of a table without using a GUI tool?

exp rows=n  imp indexfile=aaa.sql  select dbms_metadata.get_ddl('table_name','owner','TABLE') from dual;  just generate it from dba_tables/dba_tab_columns/dba_tab_partitions/dba_part_tables/...

147. You’re getting high “busy buffer waits’ - how can you find what’s causing it?

1) find the hot block. with the v$session_wait/trace file/v$bh  2) find the main sql statement .  3) tune it.---------------------------------------------------------------------------------------------

148. What query tells you how much space a tablespace named “test’ is taking up, and how much space is remaining?

dba_free_spaces, dba_extents----------------------------------------------------------------------------------------------

149. Database is hung. Old and new user connections alike hang on impact. What do you do? Your SYS SQLPLUS session IS able to connect.

1) . first view active sessions. and v$session_wait .  2). see the uptime and top processes of the system.  3) analyze the main reason. and tune it.

----------------------------------------------------------------------------------------------150. Database crashes. Corruption is found scattered among the file system neither of your doing nor of Oracle’s. What database recovery options are available? Database is in archive log mode.

Instance recovery.

151. Illustrate how to determine the amount of physical CPUs a Unix Box possesses (LINUX and/or Solaris).Solaris - prtdiag, Linux - cat /proc/cpuinfo------------------------------------------------------------------------------------------------------152. How do you increase the OS limitation for open files (LINUX and/or Solaris)?

Solaris - set rlim_fd_max/rlim_fd_cur in /etc/system, Linux - echo "16384" >> /proc/sys/kernel/file-max

-----------------------------------------------------------------------------------------------153. Provide an example of a shell script which logs into SQLPLUS as SYS, determines the current date, changes the date format to include minutes & seconds, issues a drop table command, displays the date again, and finally exits.

Create a file.sh using vi then type the following linesqlplus -s sys/*******@service_nameselect sysdate from dual;ALTER SESSION SET NLS_DATE_FORMAT='YYYY/MM/DD MI:SS'drop table xx;select sysdate from dual;exit;

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

154. Explain how you would restore a database using RMAN to Point in Time?

Shut down the target database if it is openMount the target databaseCheck the format of NLS_LANG & NLS_DATE_FORMAT variablesStart RMAN and connect to target databaserun{set until time ’specify the time u want to recover the databaseupto’;RESTORE DATABASE;RECOVER DATABASE;ALTER DATABASE OPEN RESETLOGS;}

----------------------------------------------------------------------------------------155. How does Oracle guarantee data integrity of data changes?Locking, Setting isolation levels, Row level locking, exclusive and shared locks.

---------------------------------------------------------------------------------------------156. Which environment variables are absolutely critical in order to run the OUI?

On UNIX: Oracle_Home , Path , ORA_NLS33 AND LD_LIBRARY_PATH-----------------------------------------------------------------------------------------------

157. What SQL query from v$session can you run to show how many sessions are logged in as a particular user account?

select count(*) from v$session where username like ''-----------------------------------------------------------------------------------------------

158. Why does Oracle not permit the use of PCTUSED with indexes?Index is a complex data structure that is not heap organised structure. In a heap organised structure seldom there is space for inserts but in case of indexes, space is always available for inserts, Moreover, PCTFREE

159. What would you use to improve performance on an insert statement that places millions of rows into that table?

Make segment error contention for parallel inserts. Multiple freelists needs to be defined to remove contention from table headers/ or use ASSM (automatic Segment Space management).Using Direct path inserts like /*+APPEND*/ hint or SQL loader direct path inserts, table will not generate redo but indexes will.

160. What would you do with an “in-doubt” distributed transaction?

Distributed transactions can become in-doubt in the following ways:

A server machine running Oracle Database software crashes

A network connection between two or more Oracle Databases involved in distributed processing is disconnected

An unhandled software error occurs

You should only need to resolve an in-doubt transaction in the following cases:

The in-doubt transaction has locks on critical data or undo segments.

The cause of the machine, network, or software failure cannot be repaired quickly.

Resolution of in-doubt transactions can be complicated. The procedure requires that you do the following:

Identify the transaction identification number for the in-doubt transaction.

Query the DBA_2PC_PENDING and DBA_2PC_NEIGHBORS views to determine whether the databases involved in the transaction have committed.

If necessary, force a commit using the COMMIT FORCE statement or a rollback using the ROLLBACK FORCE statement.

The RECO process automatically resolves in-doubt transactions when the machine, network, or software problem is resolved. Until RECO can resolve the transaction, the data is locked for both reads and writes. The database blocks reads because it cannot determine which version of the data to display for a query.

=============================================================161. What are the commands you’d issue to show the explain plan for “select * from dual’?

First runs the statement: select * from dual” and then run utlxplan.sql like:Cd $ORACLE_HOME/rdbms/admin@./utlxplan.sqlORSelect plan_table_output from table(dbms_xplan.display(‘MY_PLAN_TABLE’,’SQLID’,’TYPICAL’));===============================================================162. In what script is “snap$” created? In what script is the “scott/tiger” schema created?SQL> @?/rdbms/admin/sql.bsq==============================================================163. If you’re unsure in which script a sys or system-owned object is created, but you know it’s in a script from a specific directory, what UNIX command from that directory structure can you run to find your answer?

We can say:Grep *.<script_name>/ we can use find <string_name> name ===============================================================164. How would you configure your networking files to connect to a database by the name of DSS which resides in domain icallinc.com?

Oracle first goes to TNSNAMES.ora and then to SQLNET.ora. So in tnsnames.ora add:(SERVICE_NAME=DSS) and in SQLNET.ora:NAMES.DEFAULT_DOMAIN=domain icallinc.com.

===============================================================165. You create a private database link and upon connection, fail with: ORA-2085: connects to. What is the problem? How would you go about resolving this error?

This error says that database link name should be the same as the database you are connecting to; for this one has to set the GLOBAL_NAMES initialization parameter to FALSE, if it is false then db link name can be anything.===============================================================166. I have my backup RMAN script called “backup_rman.sh”. I am on the target database. My catalog username/password is rman/rman. My catalog db is called rman. How would you run this shell script from the O/S such that it would run as a background process?

Rman target/catalog rman/rman <<!Backup_rman.sh!!$this_script&===========================================================167. Explain the concept of the DUAL table.Answer: DUAL is a table owned by SYS user and can be accessed by all users. It has one column called DUMMY and one record ie X.

===========================================================168. What are the ways tablespaces can be managed and how do they differ?Locally managed and dictionary managed.

Locally managed tablespaces use bitmaps and stores all extent information in itself, and hence are faster and involve less I/O, whereas dictionary managed store the info in the data dictionaries and hence involve more I/O.===========================================================169. From the database level, how can you tell under which time zone a database is operating?

Select DBTIMEZONE from dual; (database level).Select SESSIONTIMEZONE from dual; (Session level).===========================================================170.What’s the benefit of “dbms_stats” over “analyze”?DBMS_STATS allows us to collect statistics in parallel, collect global statistics for partitioned objects and fine tune statistics collection as well. The CBO (cost based optimizer shall use only the statistics collected by it.

The conventional Analyse and DBMS_UTILITY are dangerous for SQL performance because they donot collect high quality information about tables and indexes.

Dbns_stats is used for large partitioned tables and choosing best execution plan.============================================================171. Typically, where is the conventional directory structure chosen for Oracle binaries to reside?Answer: $ORACLE_HOME/bin=============================================================172. You have found corruption in a tablespace that contains static tables that are part of a database that is in NOARCHIVE log mode. How would you restore the tablespace without losing new data in the other tablespaces?==============================================================173. How do you recover a datafile that has not been physically been backed up since its creation and has been deleted. Provide syntax example.

Assume that the file /u01/ORADATA/data/data01.dbf of tablespace DATA is damaged and you don't have a backup of the data file. • SVRMGRL> connect internal • connected • SVRMGRL> shutdown abort • Oracle Instance Aborted • SVRMGRL> startup mount • Oracle Instance Started • SVRMGRL> alter database create datafile /u01/ORADATA/data/data01.dbf; • Statement Processed • SVRMGRL> recover datafile /u01/ORADATA/data/data01.dbf; • Statement Processed • SVRMGRL> select * from v$datafile; • You will see a list of datafiles with their status. If the status of the concerned file has not been reset to ONLINE, issue the following command. • SVRMGRL> alter database datafile /u01/ORADATA/data/data01.dbf online; • Statement Processed • SVRMGRL> select * from dba_tablespaces; • If the status of the tablespace CASE is not ONLINE, then issue the following command. • SVRMGRL> alter tablespace CASE online; • Statement Processed • SVRMGRL> alter database open; Statement Processed==============================================================174. Oracle 10g New Features:

Flashback Enhancements -

Flashback Version Query, Flashback Transaction Query, LOB Handling with Flashback,

Setting up for Flashback, Flashback Table, Flashback Drop Table and Recycle Bin management.

Backup and Recovery Enhancements -

Flash Recovery Area, Flashback Database (setup, flashback logs and use), Restore Points,

Simplified Recovery through RESETLOGS, Compressed Backups, Change Tracking, Incrementally Updated Image Copies,

SWITCH DATABASE, New V$ Views, Encrypted Backups, DROP DATABASE, CATALOG, Oracle Secure Backup and more.

Automatic Storage Management -

An introduction to Oracle's new integrated file system and volume manager.

Examples illustrate the basic use of ASM, including creating disk groups, fail groups, and using ASMCMD.

Job Scheduler - Use the new DBMS_SCHEDULER package to schedule jobs, including OS scripts.

Examples illustrate creating and scheduling jobs in both a Linux and a Windows environment.

SQL Enhancements - Regular expressions, DML error logging, case-insensitive sort and search,

MERGE enhancements, MODEL queries, XQUERY and much more.

PL/SQL Enhancements -The new optimizing compiler, compiler warning messages, debugging improvements,

native compilation enhancements, UTL_MAIL and more.

Performance and Tuning Features - Automatic SGA Management, Automatic Workload Repository (AWR),

Advisors (ADDM, SQL Tuning Advisor, etc), Active Session History data, new performance statistics

(e.g. metrics and database time), Thresholds and Server-Generated Alerts, CBO Enhancements and much more.

Security and Auditing Enhancements - Changes to the CONNECT Role, FGAC Review, FGAC / VPD Enhancements,

FGA Review, Fine Grained Auditing Enhancements, Encryption Enhancements, DBMS_CRYPTO Package (R1) and

Transparent Data Encryption (R2).

Tablespace, Table and Segment Management - SYSAUX tablespace, BIGFILE and SMALLFILE tablespaces,

database-level default tablespace, database-level default temp tablespace, temp tablespace groups, multi-platform transportable tablespace,

renaming tablespaces, predicting object growth, online table redefinition enhancements and online segment shrink.

Utilities (Data Pump) - An example-based introduction to Data Pump, the next generation export / import utility.

Also covered: External Table and Logminer enhancements.

SQL*Plus Enhancements - New predefined variables, SPOOL command enhancements, AUTOTRACE enhancements and more.

Miscellaneous Enhancements - Guaranteed UNDO retention, ROLLBACK monitoring, Easy Connect (EZCONNECT) connections,

database high watermark recording, database feature usage tracking and new and deprecated initialization parameters.

Database Usage Statistics

Two new views have been added in Oracle 10g which allow you to monitor database usage statistics:

DBA_HIGH_WATER_MARK_STATISTICS - Displays high waternmark statistics (db_usage_hwm.sql).

DBA_FEATURE_USAGE_STATISTICS - Displays database feature usage statistics (feature_usage.sql).