database administrator (dba) interview questions and answers

Upload: such-deva

Post on 10-Apr-2018

235 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    1/66

    DATABASE Administrator (DBA) Interview Questions

    y What is a DBA?

    y What DBA activities did you to do today?

    y

    What are the different modes of mounting a Database with the Parallel Server?

    y What are the advantages of operating a database in ARCHIVELOG mode over

    operating it in NO ARCHIVELOG mode?

    y Do you consider yourself a development DBA or a production DBA and why?

    y What are the Large object types suported by Oracle?

    y Diffrence between a where clause and a having claus

    y Shall we create procedures to fetch more than one record?

    y Do View contain Data?

    y What are the Referential actions supported by FOREIGN KEY integrity constraint?

    y What are the type of Synonyms?

    y Where would you look for errors from the database engine?

    y Compare and contrast TRUNCATE and DELETE for a table.

    y Give the reasoning behind using an index.

    y Give the two types of tables involved in producing a star schema and the type of data

    they hold.

    y What type of index should you use on a fact table?

    y What is a Segment?

    y A table is classified as a parent table and you want to drop and re-create it. How would

    you do this without affecting the children tables?

    y Explain the difference between ARCHIVELOG mode and NOARCHIVELOG mode and

    the benefits and disadvantages to each.

    y What is a Sequence?

    y Give the stages of instance startup to a usable state where normal users may access it.

    y What is a Synonym?

    y How would you go about generating an EXPLAIN plan?

    y How would you go about increasing the buffer cache hit ratio?

    y Explain an ORA-01555

    y Explain the difference between $ORACLE_HOME and $ORACLE_BASE.

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    2/66

    y How would you determine the time zone under which a database was operating?

    y Explain the use of setting GLOBAL_NAMES equal to TRUE.

    y What command would you use to encrypt a PL/SQL application?

    y Explain the difference between a FUNCTION, PROCEDURE and PACKAGE.

    y Explain the use of table functions.

    y Name three advisory statistics you can collect.

    y Where in the Oracle directory tree structure are audit traces placed?

    y Explain materialized views and how they are used.

    y What does a Control file Contain?

    y What is difference between UNIQUE constraint and PRIMARY KEY constraint?

    y What is the effect of setting the value ALL_ROWS for OPTIMIZER_GOAL parameter of

    the ALTER SESSION command?

    y Describe what redo logs are.

    y How would you force a log switch?

    y What are the different Parameter types?

    y What does coalescing a tablespace do?

    y What is the difference between a TEMPORARY tablespace and a PERMANENT

    tablespace?

    y Name a tablespace automatically created when you create a database.

    y When creating a user, what permissions must you grant to allow them to connect to the

    database?

    y How do you add a data file to a tablespace?

    y How do you resize a data file?

    y What view would you use to look at the size of a data file?

    y What view would you use to determine free space in a tablespace?

    y

    How would you determine who has added a row to a table?y How can you rebuild an index?

    y Explain what partitioning is and what its benefit is.

    y You have just compiled a PL/SQL package but got errors, how would you view the

    errors?

    y How can you gather statistics on a table?

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    3/66

    y How can you enable a trace for a session?

    y What is the difference between the SQL*Loader and IMPORT utilities?

    y What is a Schema?

    y What is a cluster Key?

    y What?s the command to change the SQL prompt name?

    y What is Parallel Server?

    y How do I eliminate the duplicate rows ?

    y How do I display row number with records?

    y Display the records between two range

    y I know the nvl function only allows the same data type(ie. number or char or date

    Nvl(comm, 0)), if commission is null then the text ?Not Applicable? want to display,

    instead of blank space. How do I write the query?

    y Oracle cursor : Implicit & Explicit cursors

    y Explicit Cursor attributes

    y Implicit Cursor attributes

    y Find out nth highest salary from emp table

    y To view installed Oracle version information

    y Display the number value in Words

    y Display Odd/ Even number of records

    y Which date function returns number value?

    y Any three PL/SQL Exceptions?

    y What are PL/SQL Cursor Exceptions?

    y Other way to replace query result null value with a text

    y What are the more common pseudo-columns?

    y What is the output of SIGN function?

    y What is the maximum number of triggers, can apply to a single table?

    y What is a database instance? Explain.

    y What is Parallel Server?

    y What is a schema?

    y What are the options available to refresh snapshots?

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    4/66

    y What is a SNAPSHOT LOG?

    y What is Distributed database?

    y What are the basic element of base configuration of an Oracle database?

    y What is a deadlock? Explain.

    y What is Privilege Auditing?

    y What is Object Auditing?

    y Physical DB Structure

    y Logical DB Structure

    y Tablespaces

    y Online & Offline TS

    y Schema

    y Index Clusters

    y Database Links

    y Data Blocks

    y For a field in a repeating frame, can the source come from the column which does not

    exist in the data group which forms the base for the frame?

    y Can a field be used in a report without it appearing in any data group?

    y The join defined by the default data link is an outer join yes or no?

    y What UNIX command will control the default file permissions when files are created?

    y Explain the read, write, and execute permissions on a UNIX directory.

    y the difference between a soft link and a hard link?

    y Give the command to display space usage on the UNIX file system.

    y Explain iostat, vmstat and netstat.

    y What is new_form built-in?

    y What is the LOV of Validation Property of an item? - What is the use of it?

    y What is the diff. when Flex mode is mode on and when it is off?

    y What is ROWID?

    y What is a correlated subquery?

    y Explain UNION, MINUS, UNION ALL and INTERSECT?

    y What are the types of SQL statement?

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    5/66

    y What is a pseudo column. Give some examples?

    y What is difference between CHAR and VARCHAR2?

    y What do you know about subqueries?

    y What is a database link?

    y How to drop the index ?

    y What are the different types of SQL statements?

    y What are the uses of rollback segment?

    y What is a deadlock and Explain?

    y State any three mouse events system variables?

    y What other parts of your organization do you interact with and how?

    y How do you display console on a window?

    y 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?

    y What are the different types of joins?

    y How will you copy the structure of a table without copying the data?

    y What is a VIEW? How to get script for a view?

    y What is a trigger?

    y Explain the difference between a hot backup and a cold backup and the benefitsassociated with each.

    y What cursor type do you use to retrieve multiple recordsets?

    y What is the difference among dropping a table, truncating a table and deleting all

    records from a table.

    y Difference between ORACLE and MICROSOFT ACCESS databases.

    y How to remove duplicate records from a table?

    y Are you a nuts-n-bolts DBA or a tools-n-props DBA

    y How to create a database link?

    y What is SQL*Loader?

    y How to run SQL script from a Unix Shell?

    y Talk about Exception Handling in PL/SQL?

    y Give some examples of Analytical functions

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    6/66

    y What is Log Switch?

    y What is On-line Redo Log?

    y Which parameter specified in the DEFAULT STORAGE clause of CREATE

    TABLESPACE cannot be altered after creating the tablespace?

    y What are the steps involved in Database Startup?

    y What are the steps involved in Instance Recovery?

    y Can Full Backup be performed when the database is open?

    y You have just had to restore from backup and do not have any control files. How would

    you go about bringing up this database?

    y What are the steps involved in Database Shutdown?

    y What is Archived Redo Log?

    y What is Restricted Mode of Instance Startup?

    y What is Partial Backup?

    y What is Mirrored on-line Redo Log?

    y What is Full Backup?

    y Can a View based on another View?

    y Can a Tablespace hold objects from different Schemes?

    y Can objects of the same Schema reside in different tablespaces?

    y What is the use of Control File?

    y What is your typical day like?

    y How do you switch from an init.ora file to a spfile?

    y Explain the difference between a data block, an extent and a segment.

    y Give two examples of how you might determine the structure of the table DEPT.

    y What is a Redo Log?

    y What is an Index Segment?

    y Explain the relationship among Database, Tablespace and Data file.?

    y What are the different type of Segments?

    y What are Clusters?

    y What is an Integrity Constrains?

    y What is an Index?

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    7/66

    y What is an Extent?

    y What is a View?

    y What is Table?

    y What column differentiates the V$ views to the GV$ views and how?

    y What command would you use to create a backup control file?

    y Give two examples of referential integrity constraints.

    y What is schema?

    y Describe Referential Integrity?

    y What is Hash Cluster?

    y What is a Private Synonyms?

    y What is Database Link?

    y What is a Tablespace?

    y What is Rollback Segment?

    y What are the Characteristics of Data Files?

    y How to define Data Block size?

    y When a user process fails, what background process cleans up after it?

    y What background process refreshes materialized views?

    y How would you determine what sessions are connected and what resources they are

    waiting for?

    y What is the effect of setting the value CHOOSE for OPTIMIZER_GOAL, parameter of

    the ALTER SESSION Command?

    y What is the function of Optimizer?

    y What is Execution Plan?

    y What are the different approaches used by Optimizer in choosing an execution plan?

    y What does ROLLBACK do?

    y What is SAVE POINT?

    y What are the values that can be specified for OPTIMIZER MODE Parameter?

    y What is COST-based approach to optimization?

    y What does COMMIT do?

    y What is RULE-based approach to optimization?

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    8/66

    y What are the values that can be specified for OPTIMIZER_GOAL parameter of the

    ALTER SESSION Command?

    y Define Transaction?

    y What is Read-Only Transaction?

    y What is a deadlock?

    y Name two files used for network connection to a database.

    y What?s the command to see the current user name?

    y How do you switch to DOS prompt from SQL prompt?

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

    y What is clusters?

    y What is an Index? - How it is implemented in Oracle Database?

    y What is a Database instance?

    y What is the use of ANALYZE command?

    y What is default tablespace?

    y What are the system resources that can be controlled through Profile?

    y What is Tablespace Quota?

    y What are the different Levels of Auditing?

    y What is Statement Auditing?

    y What are the database administrators utilities available?

    y How can you enable automatic archiving?

    y What are roles?

    y How can we implement roles?

    y What are the use of Roles?

    y Auditing

    y Audit Trial

    y What is Auditing?

    y What are the responsibilities of a Database Administrator?

    y What is a trace file and how is it created?

    y What is a profile?

    y How will you enforce security using stored procedures?

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    9/66

    y What are the dictionary tables used to monitor a database spaces?

    y What are the roles and user accounts created automatically with the database?

    y What are the minimum parameters should exist in the parameter file (init.ora)?

    y How can we specify the Archived log file name format and destination?

    y What is user Account in Oracle database?

    y What dynamic data replication?

    y What is Two-Phase Commit?

    y How can you Enforce Referential Integrity in snapshots?

    y What is a SQL * NET?

    y What is a SNAPSHOT?

    y What is the mechanism provided by ORACLE for table replication?

    y What is snapshots?

    y What are the various type of snapshots?

    y Describe two phases of Two-phase commit?

    y What is snapshot log?

    y What are the benefits of distributed options in databases?

    y What is an index? How it is implemented in Oracle database?

    y What are clusters?

    y What is a cluster key?

    y How can we reduce the network traffic?

    y Differentiate simple and complex, snapshots?

    y What are the Built-ins used for sending Parameters to forms?

    y Can you have more than one content canvas view attached with a window?

    y Is the After report trigger fired if the report execution fails?

    y Does a Before form trigger fire when the parameter form is suppressed?

    y Is it possible to split the print reviewer into more than one region?

    y Is it possible to center an object horizontally in a repeating frame that has a variable

    horizontal size?

    y How do you list the files in an UNIX directory while also showing hidden files?

    y How do you execute a UNIX command in the background?

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    10/66

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    11/66

    y Is it possible to disable the parameter from while running the report?

    y When a form is invoked with call_form, Does oracle forms issues a save point?

    y Can a property clause itself be based on a property clause?

    y What is a timer?

    y What are the two phases of block coordination?

    y What are Most Common types of Complex master-detail relationships?

    y What is a text list?

    y What is term?

    y What is use of term?

    y What is pop list?

    y What is the maximum no of chars the parameter can store?

    y What are the default extensions of the files created by library module?

    y What are the Coordination Properties in a Master-Detail relationship?

    y What is an index and How it is implemented in Oracle database?

    y Lot of users are accessing select sysdate from dual and they getting some millisecond

    differences. If we execute SELECT SYSDATE FROM EMP; what error will we get. Why?

    y Give two methods you could use to determine what DDL changes have been made.

    y What are the types of calculated columns available?

    y Explain about stacked canvas views?

    y What are the built_ins used the display the LOV?

    y What is the difference between SHOW_EDITOR and EDIT_TEXTITEM?

    y What are the built-ins that are used to Attach an LOV programmatically to an item?

    y How do you call other Oracle Products from Oracle Forms?

    y What is the main diff. bet. Reports 2.0 & Reports 2.5?

    y What are the different file extensions that are created by oracle reports?

    y What is strip sources generate options?

    y What is the basic data structure that is required for creating an LOV?

    y What is the Maximum allowed length of Record group Column?

    y Which parameter can be used to set read level consistency across multiple queries?

    y What are the different types of Record Groups?

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    12/66

    y From which designation is it preferred to send the output to the printed?

    y what are difference between post database commit and post-form commit?

    y What are the different display styles of list items?

    y Which of the above methods is the faster method?

    y With which function of summary item is the compute at options required?

    y What are parameters?

    y What are the three types of user exits available?

    y How many windows in a form can have console?

    y If the maximum record retrieved property of the query is set to 10 then a summary value

    will be calculated?

    y What are the two repeating frame always associated with matrix object?

    y What are the master-detail triggers?

    y What are the different objects that you cannot copy or reference in object groups?

    y What is an OLE?

    y Is it possible to modify an external query in a report which contains it?

    y Does a grouping done for objects in the layout editor affect the grouping done in the data

    model editor?

    y Can a repeating frame be created without a data group as a base?

    y If a break order is set on a column would it affect columns which are under the column?

    y Is it possible to set a filter condition in a cross product group in matrix reports?

    y Do user parameters appear in the data modal editor in 2.5?

    y Can you pass data parameters to forms?

    y Is it possible to link two groups inside a cross products after the cross products group

    has been created?

    y What are the different modals of windows?

    y

    What are modal windows?y What are the different default triggers created when Master Deletes Property is set to

    Non-isolated?

    y What are the different default triggers created when Master Deletes Property is set to

    isolated?

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    13/66

    y What are the different default triggers created when Master Deletes Property is set to

    Cascade?

    y What is the diff. bet. setting up of parameters in reports 2.0 reports2.5?

    y What are the difference between lov & list item?

    y What is the advantage of the library?

    y What is lexical reference?

    y What is system.coordination_operation?

    y What is synchronize?

    y What use of command line parameter cmd file?

    y What is a Text_io Package?

    y What is forms_DDL?

    y How is link tool operation different bet. reports 2 & 2.5?

    y What are the different styles of activation of ole Objects?

    y How do you reference a Parameter?

    y What is the difference between object embedding and linking in Oracle forms?

    y Name of the functions used to get/set canvas properties?

    y What are the built-ins that are used for setting the LOV properties at runtime?

    y What are the built-ins used for processing rows?

    y What are built-ins used for Processing rows?

    y What are the built-in used for getting cell values?

    y What are the built-ins used for Getting cell values?

    y A tleast how many set of data must a data model have before a data model can be base

    on it?

    y To execute row from being displayed that still use column in the row which property can

    be used?

    y

    What are different types of modules available in oracle form?y What is the remove on exit property?

    y What is WHEN-Database-record trigger?

    y What is a difference between pre-select and pre-query?

    y What are built-ins associated with timers?

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    14/66

    y What are the built-ins used for finding object ID functions?

    y What are the built-ins used for finding Object ID function?

    y Any attempt to navigate programmatically to disabled form in a call_form stack is

    allowed?

    y Use the Add_group_row procedure to add a row to a static record group 1. true or false?

    y Use the add_group_column function to add a column to record group that was created at

    a design time?

    y What are the various sub events a mouse double click event involves?

    y How can a break order be created on a column in an existing group?

    y What is the use of place holder column?

    y What is the use of hidden column?

    y What is the use of break group?

    y What is an anchoring object and what is its use?

    y What are the various sub events a mouse double click event involves?

    y What are the default parameter that appear at run time in the parameter screen?

    y What are the built-ins used for Creating and deleting groups?

    y What are different types of canvas views?

    y What are the different types of Delete details we can establish in Master-Details?

    y What is relation between the window and canvas views?

    y What is a User_exit?

    y How is it possible to select generate a select set for the query in the query property

    sheet?

    y How can values be passed between precompiler exits & Oracle call interface?

    y How can a square be drawn in the layout editor of the report writer?

    y How can a text file be attached to a report while creating in the report writer?

    y

    How can I message to passed to the user from reports?y How is possible to restrict the user to a list of values while entering values for

    parameters?

    y How can a button be used in a report to give a drill down facility?

    y How can a cross product be created?

    y What are different types of images?

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    15/66

    y What is the difference between boiler plat images and image items?

    y What is bind reference and how can it be created?

    y What are the triggers available in the reports?

    y Give the sequence of execution of the various report triggers?

    y Why is a Where clause faster than a group filter or a format trigger?

    y Why is it preferable to create a fewer no. of queries in the data model?

    y Where is the external query executed at the client or the server?

    y Where is a procedure return in an external pl/SQL library executed at the client or at the

    server?

    y What is coordination Event?

    y What is the difference between OLE Server & OLE Container?

    y What is an object group?

    y What is an LOV?

    y At what point of report execution is the before Report trigger fired?

    y What are the built -ins used for Modifying a groups structure?

    y What is an user exit used for?

    y What is the User-Named Editor?

    y What are the Built-ins to display the user-named editor?

    y What is a Static Record Group?

    y What is a record group?

    y How many number of columns a record group can have?

    y What is a Query Record Group?

    y What is a property clause?

    y What is a physical page? What is a logical page?

    y What does the term panel refer to with regarda to pages?

    y What is a master detail relationship?

    y What is a library?

    y How can a group in a cross products be visually distinguished from a group that does

    not form a cross product?

    y What is the frame & repeating frame?

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    16/66

    y What is a combo box?

    y What are three panes that appear in the run time pl/SQL interpreter?

    y What are the two panes that Appear in the design time pl/SQL interpreter?

    y What are the two ways by which data can be generated for a parameters list of values?

    y What are the various methods of performing a calculation in a report?

    y What are the default extensions of the files created by menu module?

    y It is possible to use raw devices as data files and what is the advantages over file

    system files?

    y What are disadvantages of having raw devices?

    y What is the significance of having storage clause?

    y What is the use of INCTYPE option in EXP command?

    y What is the use of FILE option in IMP command?

    y What is a Shared SQL pool?

    y What is hot backup and how it can be taken?

    y List the Optional Flexible Architecture (OFA) of Oracle database? How can we organize

    the tablespaces in Oracle database to have maximum performance?

    y How to implement the multiple control files for an existing database?

    y What is advantage of having disk shadowing/ Mirroring?

    y How will you force database to use particular rollback segment?

    y Give one method for transferring a table from one schema to another

    y What is the purpose of the IMPORT option IGNORE? What is it?s default setting?

    y You have a rollback segment in a version 7.2 database that has expanded beyond

    optimal, how can it be restored to optimal?

    y If the DEFAULT and TEMPORARY tablespace clauses are left out of a CREATE USER

    command what happens? Is this bad or good? Why?

    y What are some of the Oracle provided packages that DBAs should be aware of?

    y What happens if the constraint name is left out of a constraint clause?

    y What happens if a tablespace clause is left off of a primary key constraint clause?

    y What is the proper method for disabling and re-enabling a primary key constraint?

    y What happens if a primary key constraint is disabled and then enabled without fully

    specifying the index clause?

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    17/66

    y (On UNIX) When should more than one DB writer process be used? How many should

    be used?

    y You are using hot backup without being in archivelog mode, can you recover in the

    event of a failure? Why or why not?

    y What causes the "snapshot too old" error? How can this be prevented or mitigated?

    y How can you tell if a database object is invalid?

    y A user is getting an ORA-00942 error yet you know you have granted them permission

    on the table, what else should you check?

    y A developer is trying to create a view and the database won?t let him. He has the

    "DEVELOPER" role which has the "CREATE VIEW" system privilege and SELECT

    grants on the tables he is using, what is the problem?

    y If you have an example table, what is the best way to get sizing data for the production

    table implementation?

    y How can you find out how many users are currently logged into the database? How can

    you find their operating system id?

    y A user selects from a sequence and gets back two values, his select is:

    y How can you determine if an index needs to be dropped and rebuilt?

    y A tablespace has a table with 30 extents in it. Is this bad? Why or why not.

    y How do you set up tablespaces during an Oracle installation?

    y

    You see multiple fragments in the SYSTEM tablespace, what should you check first?y What are some indications that you need to increase the SHARED_POOL_SIZE

    parameter?

    y What is the general guideline for sizing db_block_size and db_multi_block_read for an

    application that does many full table scans?

    y What is the fastest query method for a table?

    y Explain the use of TKPROF? What initialization parameter should be turned on to get full

    TKPROF output?

    y When looking at v$sysstat you see that sorts (disk) is high. Is this bad or good? If bad -How do you correct it?

    y When should you increase copy latches? What parameters control copy latches?

    y Where can you get a list of all initialization parameters for your instance? How about an

    indication if they are default settings or have been changed?

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    18/66

    y Describe hit ratio as it pertains to the database buffers. What is the difference between

    instantaneous and cumulative hit ratio and which should be used for tuning?

    y Discuss row chaining, how does it happen? How can you reduce it? How do you correct

    it?

    y When looking at the estat events report you see that you are getting busy buffer waits. Is

    this bad? How can you find what is causing it?

    y If you see contention for library caches how can you fix it?

    y If you see statistics that deal with "undo" what are they really talking about?

    y If a tablespace has a default pctincrease of zero what will this cause (in relationship to

    the smon process)?

    y If a tablespace shows excessive fragmentation what are some methods to defragment

    the tablespace? (7.1,7.2 and 7.3 only)

    y How can you tell if a tablespace has excessive fragmentation?

    y You see the following on a status report: redo log space requests 23; redo log space

    wait time 0; Is this something to worry about? What if redo log space wait time is high?

    How can you fix this?

    y What can cause a high value for recursive calls? How can this be fixed?

    y If you see a pin hit ratio of less than 0.8 in the estat library cache report is this a

    problem? If so, how do you fix it?

    y If you see the value for reloads is high in the estat library cache report is this a matter for

    concern?

    y You look at the dba_rollback_segs view and see that there is a large number of shrinks

    and they are of relatively small size, is this a problem? How can it be fixed if it is a

    problem?

    DataBase Administrator (DBA) Interview Questions and Answers

    What is a DBA?

    A DBA is a Database Administrator, and this is the most common job that you find a database specialist doing. Thereare Development DBAs and Production DBAs.

    A Development DBA usually works closely with a team of developers and gets more involved in design decisions,giving advice on performance and writing good SQL.That can be satisfying at a human level because you are part of a team and you share the satisfaction of the team'saccomplishments.

    A Production DBA (on the other hand) is responsible for maintaining Databases within an organisation, so it is a verydifficult and demanding job. He or she, often gets involved when all the design decisions have been made, and hassimply to keep things up and running.

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    19/66

    Therefore, of course, it is also a rewarding job, both financially and in terms of job satisfaction. But it's a more 'lonely'job than being a Development DBA.

    1. What DBA activities did you to do today?This is a loaded question and almost begs for you to answer it with "What DBA activities do you LIKE to do on a dailybasis?." And that is how I would answer this question. Again, do not get caught up in the "typical" day-to-dayoperational issues of database administration. Sure, you can talk about the index you rebuilt, the monitoring ofsystem and session waits that were occurring, or the space you added to a data file, these are all good and great andyou should convey that you understand the day-to-day operational issues. What you should also throw into thisanswer are the meetings that you attend to provide direction in the database arena, the people that you meet and talkwith daily to answer adhoc questions about database use, the modeling of business needs within the database, andthe extra time you spend early in the morning or late at night to get the job done. Just because the question stipulates"today" do not take "today" to mean "today." Make sure you wrap up a few good days into "today" and talk aboutthem. This question also begs you to ask the question of "What typical DBA activities are performed day to day withinX Corporation?"

    2. What are the different modes of mounting a Database with the Parallel Server?Exclusive Mode If the first instance that mounts a database does so in exclusive mode, only that Instance can mountthe database. Parallel Mode If the first instance that mounts a database is started in parallel mode, other instancesthat are started in parallel mode can also mount the database.

    3. What are the advantages of operating a database in ARCHIVELOG mode over operating it in NOARCHIVELOG mode?Complete database recovery from disk failure is possible only in ARCHIVELOG mode. Online database backup ispossible only in ARCHIVELOG mode.

    4. Do you consider yourself a development DBA or a production DBA and why?You take this as a trick question and explain it that way. Never in my database carrier have I distinguished between"development" and "production." Just ask your development staff or VP of engineering how much time and money is

    lost if development systems are down. Explain to the interviewer that both systems are equally important to theoperation of the company and both should be considered as production systems because there are people relying onthem and money is lost if either one of them is down. Ok you may be saying, and I know you are, that we lose moremoney if the production system is down. Ok, convey that to the interviewer and you won't get anyone to disagree withyou unless your company sells software or there are million dollar deals on the table that are expecting the nextrelease of your product or service.

    5. What are the Large object types suported by Oracle?

    Answer11)bfile - Up to 4 gigabytes > File locators that point to a read-only binary object outside of the database2)blob - Up to 4 gigabytes. > LOB locators that point to a large binary object within the database3)clob - Up to 4 gigabytes. > LOB locators that point to a large character object within the database4)nclob - Up to 4 gigabytes. >LOB locators that point to a large NLS character object within the database

    Answer2These are the large object type supported by oracle CLOB and LONG for large fixed-width character data NCLOB for large fixed-width national character set data BLOB and LONG RAW for storing unstructured data BFILE for storing unstructured data in operating system files

    6. Diffrence between a where clause and a having claus

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    20/66

    Answer1The order of the clauses in a query syntax using a GROUP BY clause is as follows:select where..group byhavingorder byWhere filters, group by arranges into groups, having applies based on group by clause. Having is applied with groupby clause.

    Answer2

    In SQL Server, procedures and functions can return values. (In Oracle, procedures cannot directly return a value).The major difference with a function is that it can be used in a value assignment. Such as:system functionDeclare @mydate datetimeSet @mydate = getdate()

    user function (where the user has already coded the function)Declare @My_areaSet @My_area = dbo.fn_getMy_area(15,20)

    Answer31.where is used to filter records returned by Select2.where appears before group by clause3.In where we cannot use aggrigate functions like where count(*) >2 etc4.having appears after group by clause

    5.having is used to filter records returned by Group by2 etc there are two more

    7. Shall we create procedures to fetch more than one record?Yes. We can create procedures to fetch more than a row. By using CURSOR commands we could able to do that.Ex:CREATE OR REPLACE PROCEDURE myprocedure ISCURSOR mycur IS select id from mytable;new_id mytable.id%type;BEGINOPEN mycur;LOOPFETCH mycur INTO new_id;

    exit when mycur%NOTFOUND;do some manipulationsEND LOOP;CLOSE mycur;END myprocedure;In this example iam trying to fetch id from the table mytable. So it fetches the id from each record until EOF.

    (EXIT when mycur%NOTFOUND-is used to check EOF.For further informations, refer CURSORS.

    8. Do View contain Data?

    Views do not contain or store data.

    9. What are the Referential actions supported by FOREIGN KEY integrity constraint?UPDATE and DELETE Restrict - A referential integrity rule that disallows the update or deletion of referenced data.DELETE Cascade - When a referenced row is deleted all associated dependent rows are deleted.

    10. What are the type of Synonyms?There are two types of Synonyms Private and Public

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    21/66

    11. Where would you look for errors from the database engine?In the alert log.

    12. Compare and contrast TRUNCATE and DELETE for a table.Both the truncate and delete command have the desired outcome of getting rid of all the rows in a table. The

    difference between the two is that the truncate command is a DDL operation and just moves the high water mark andproduces a new rollback. The delete command, on the other hand, is a DML operation, which will produce a rollbackand thus take longer to complete.

    13. Give the reasoning behind using an index.Faster access to data blocks in a table.

    14. Give the two types of tables involved in producing a star schema and the type of data they hold.Fact tables and dimension tables. A fact table contains measurements while dimension tables will contain data thatwill help describe the fact tables.

    15. What type of index should you use on a fact table?A Bitmap index.

    16. What is a Segment?

    A segment is a set of extents allocated for a certain logical structure.17. A table is classified as a parent table and you want to drop and re-create it. How would you do thiswithout affecting the children tables?Disable the foreign key constraint to the parent, drop the table, re-create the table, enable the foreign key constraint.

    18. Explain the difference between ARCHIVELOG mode and NOARCHIVELOG mode and the benefits and

    disadvantages to each.ARCHIVELOG mode is a mode that you can put the database in for creating a backup of all transactions that haveoccurred in the database so that you can recover to any point in time. NOARCHIVELOG mode is basically theabsence of ARCHIVELOG mode and has the disadvantage of not being able to recover to any point in time.NOARCHIVELOG mode does have the advantage of not having to write transactions to an archive log and thusincreases the performance of the database slightly.

    19. What is a Sequence?A sequence generates a serial list of unique numbers for numerical columns of a databases tables.

    20. Give the stages of instance startup to a usable state where normal users may access it.STARTUP NOMOUNT - Instance startupSTARTUP MOUNT - The database is mountedSTARTUP OPEN - The database is opened

    21. What is a Synonym?A synonym is an alias for a table, view, sequence or program unit.

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    22/66

    22. How would you go about generating an EXPLAIN plan?Create a plan table with utlxplan.sql.Use the explain plan set statement_id = 'tst1' into plan_table for a SQL statementLook at the explain plan with utlxplp.sql or utlxpls.sql

    23. How would you go about increasing the buffer cache hit ratio?Use the buffer cache advisory over a given workload and then query the v$db_cache_advice table. If a change wasnecessary then I would use the alter system set db_cache_size command.

    24. Explain an ORA-01555You get this error when you get a snapshot too old within rollback. It can usually be solved by increasing the undoretention or increasing the size of rollbacks. You should also look at the logic involved in the application getting theerror message.

    25. Explain the difference between $ORACLE_HOME and $ORACLE_BASE.

    ORACLE_BASE is the root directory for oracle. ORACLE_HOME located beneath ORACLE_BASE is where theoracle products reside.

    26. How would you determine the time zone under which a database was operating?select DBTIMEZONE from dual;

    27. Explain the use of setting GLOBAL_NAMES equal to TRUE.Setting GLOBAL_NAMES dictates how you might connect to a database. This variable is either TRUE or FALSE andif it is set to TRUE it enforces database links to have the same name as the remote database to which they arelinking.

    28. What command would you use to encrypt a PL/SQL application?WRAP

    29. Explain the difference between a FUNCTION, PROCEDURE and PACKAGE.A function and procedure are the same in that they are intended to be a collection of PL/SQL code that carries asingle task. While a procedure does not have to return any values to the calling application, a function will return asingle value. A package on the other hand is a collection of functions and procedures that are grouped togetherbased on their commonality to a business function or application.

    30. Explain the use of table functions.Table functions are designed to return a set of rows through PL/SQL logic but are intended to be used as a normaltable or view in a SQL statement. They are also used to pipeline information in an ETL process.

    31. Name three advisory statistics you can collect.Buffer Cache Advice, Segment Level Statistics, & Timed Statistics

    32. Where in the Oracle directory tree structure are audit traces placed?In unix $ORACLE_HOME/rdbms/audit, in Windows the event viewer

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    23/66

    33. Explain materialized views and how they are used.Materialized views are objects that are reduced sets of information that have been summarized, grouped, oraggregated from base tables. They are typically used in data warehouse or decision support systems.

    34. What does a Control file Contain?

    A Control file records the physical structure of the database. It contains the following information. Database NameNames and locations of a databases files and redolog files. Time stamp of database creation.

    35. What is difference between UNIQUE constraint and PRIMARY KEY constraint?A column defined as UNIQUE can contain Nulls while a column defined as PRIMARY KEY cant contain Nulls.47.What is Index Cluster? - A Cluster with an index on the Cluster Key 48.When does a Transaction end? - When it iscommitted or Rollbacked.

    36. What is the effect of setting the value ALL_ROWS for OPTIMIZER_GOAL parameter of the ALTERSESSION command?What are the factors that affect OPTIMIZER in choosing an Optimization approach? - Answer TheOPTIMIZER_MODE initialization parameter Statistics in the Data Dictionary the OPTIMIZER_GOAL parameter of the

    ALTER SESSION command hints in the statement.

    37. Describe what redo logs are.Redo logs are logical and physical structures that are designed to hold all the changes made to a database and areintended to aid in the recovery of a database.

    38. How would you force a log switch?ALTER SYSTEM SWITCH LOGFILE;

    39. What are the different Parameter types?Text ParametersData Parameters

    40. What does coalescing a tablespace do?Coalescing is only valid for dictionary-managed tablespaces and de-fragments space by combining neighboring freeextents into large single extents.

    41. What is the difference between a TEMPORARY tablespace and a PERMANENT tablespace?A temporary tablespace is used for temporary objects such as sort structures while permanent tablespaces are usedto store those objects meant to be used as the true objects of the database.

    42. Name a tablespace automatically created when you create a database.The SYSTEM tablespace.

    43. When creating a user, what permissions must you grant to allow them to connect to the database?Grant the CONNECT to the user.

    44. How do you add a data file to a tablespace?

    ALTER TABLESPACE ADD DATAFILE SIZE

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    24/66

    45. How do you resize a data file?

    ALTER DATABASE DATAFILE RESIZE ;

    46. What view would you use to look at the size of a data file?DBA_DATA_FILES

    47. What view would you use to determine free space in a tablespace?DBA_FREE_SPACE

    48. How would you determine who has added a row to a table?Turn on fine grain auditing for the table.

    49. How can you rebuild an index?ALTER INDEX REBUILD;.

    50. Explain what partitioning is and what its benefit is.Partitioning is a method of taking large tables and indexes and splitting them into smaller, more manageable pieces.

    51. You have just compiled a PL/SQL package but got errors, how would you view the errors?SHOW ERRORS

    52. How can you gather statistics on a table?The ANALYZE command.

    53. How can you enable a trace for a session?Use the DBMS_SESSION.SET_SQL_TRACE orUse ALTER SESSION SET SQL_TRACE = TRUE;

    54. What is the difference between the SQL*Loader and IMPORT utilities?

    These two Oracle utilities are used for loading data into the database. The difference is that the import utility relies onthe data being produced by another Oracle utility EXPORT while the SQL*Loader utility allows data to be loaded thathas been produced by other utilities from different data sources just so long as it conforms to ASCII formatted ordelimited files.

    55. What is a Schema?The set of objects owned by user account is called the schema.

    56. What is a cluster Key?The related columns of the tables are called the cluster key. The cluster key is indexed using a cluster index and itsvalue is stored only once for multiple tables in the cluster.

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    25/66

    55. What?s the command to change the SQL prompt name?SQL> set sqlprompt ?database-1 > ?database-1 >database-1 >

    56. What is Parallel Server?Multiple instances accessing the same database (Only In Multi-CPU environments)

    57. How do I eliminate the duplicate rows ?SQL> delete from table_name where rowid not in (select max(rowid) from table group byduplicate_values_field_name);orSQL> delete duplicate_values_field_name dv from table_name ta where rowid SQL> select rownum, ename from emp;Output:1 Scott2 Millor3 Jiyo4 Smith

    Answer2select rownum ,ename from emp;Output:1 smith2 john3 king4 scott

    59. Display the records between two rangeselect rownum, empno, ename from emp where rowid in(select rowid from emp where rownum

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    26/66

    --------- --------- ----------1 7782 CLARK2 7788 SCOTT3 7839 KING4 7844 TURNER

    60. I know the nvl function only allows the same data type(ie. number or char or date Nvl(comm,0)), ifcommission is null then the text ?Not Applicable? want to display, instead of blank space. How do I write the

    query?

    SQL> select nvl(to_char(comm.),'NA') from emp;Output :NVL(TO_CHAR(COMM),'NA')-----------------------NA300500NA1400NANA

    61. Oracle cursor : Implicit & Explicit cursorsOracle uses work areas called private SQL areas to create SQL statements. PL/SQL construct to identify each andevery work are used, is called as Cursor. For SQL queries returning a single row, PL/SQL declares all implicitcursors. For queries that returning more than one row, the cursor needs to be explicitly declared.

    62. Explicit Cursor attributesThere are four cursor attributes used in Oracle cursor_name%Found, cursor_name%NOTFOUND,cursor_name%ROWCOUNT, cursor_name%ISOPEN

    63. Implicit Cursor attributesSame as explicit cursor but prefixed by the word SQLSQL%Found, SQL%NOTFOUND, SQL%ROWCOUNT, SQL%ISOPENTips :1. Here SQL%ISOPEN is false, because oracle automatically closed the implicit cursor after executing SQLstatements.2. All are Boolean attributes.

    64. Find out nth highest salary from emp tableSELECT DISTINCT (a.sal) FROM EMP A WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM EMP BWHERE a.sal select banner from v$version;

    66. Display the number value in Words

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    27/66

    SQL> select sal, (to_char(to_date(sal,'j'), 'jsp'))from emp;the output like,SAL (TO_CHAR(TO_DATE(SAL,'J'),'JSP'))--------- -----------------------------------------800 eight hundred1600 one thousand six hundred

    1250 one thousand two hundred fiftyIf you want to add some text like,Rs. Three Thousand only.SQL> select sal "Salary ",(' Rs. '|| (to_char(to_date(sal,'j'), 'Jsp'))|| ' only.'))"Sal in Words" from emp/Salary Sal in Words------- -------------------------------------------800 Rs. Eight Hundred only.1600 Rs. One Thousand Six Hundred only.1250 Rs. One Thousand Two Hundred Fifty only.

    67. Display Odd/ Even number of recordsOdd number of records:select * from emp where (rowid,1) in (select rowid, mod(rownum,2) from emp);135Even number of records:select * from emp where (rowid,0) in (select rowid, mod(rownum,2) from emp)246

    68. Which date function returns number value?

    months_between

    69. Any three PL/SQL Exceptions?Too_many_rows, No_Data_Found, Value_Error, Zero_Error, Others

    70. What are PL/SQL Cursor Exceptions?Cursor_Already_Open, Invalid_Cursor

    71. Other way to replace query result null value with a textSQL> Set NULL ?N/A?to reset SQL> Set NULL ??

    72. What are the more common pseudo-columns?SYSDATE, USER , UID, CURVAL, NEXTVAL, ROWID, ROWNUM

    73. What is the output of SIGN function?

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    28/66

    1 for positive value,0 for Zero,-1 for Negative value.

    74. What is the maximum number of triggers, can apply to a single table?12 triggers.

    75. What is a database instance? Explain.A database instance (Server) is a set of memory structure and background processes that access a set of databasefiles. The processes can be shared by all of the users.The memory structure that is used to store the most queried data from database. This helps up to improve databaseperformance by decreasing the amount of I/O performed against data file.

    76. What is Parallel Server?Multiple instances accessing the same database (only in multi-CPU environments)

    77. What is a schema?

    Answer1The set of objects owned by user account is called the schema.

    Answer2Schema is the complete design of the database or data objects.

    78. What are the options available to refresh snapshots?COMPLETE - Tables are completely regenerated using the snapshots query and the master tables every time thesnapshot referenced. FAST - If simple snapshot used then a snapshot log can be used to send the changes to thesnapshot tables. FORCE - Default value. If possible it performs a FAST refresh; Otherwise it will perform a completerefresh.

    79. What is a SNAPSHOT LOG?A snapshot log is a table in the master database that is associated with the master table. ORACLE uses a snapshotlog to track the rows that have been updated in the master table. Snapshot logs are used in updating the snapshotsbased on the master table.

    80. What is Distributed database?A distributed database is a network of databases managed by multiple database servers that appears to a user assingle logical database. The data of all databases in the distributed database can be simultaneously accessed andmodified.

    81. What are the basic element of base configuration of an Oracle database?It consists ofone or more data files.one or more control files.two or more redo log files.The Database containsmultiple users/schemasone or more rollback segmentsone or more tablespacesData dictionary tables

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    29/66

    User objects (table,indexes,views etc.,)The server that access the database consists ofSGA (Database buffer, Dictionary Cache Buffers, Redo log buffers, Shared SQL pool)SMON (System MONito)PMON (Process MONitor)LGWR (LoG Write)DBWR (Data Base Write)

    ARCH (ARCHiver)CKPT (Check Point)RECODispatcherUser Process with associated PGS

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

    83. What is Privilege Auditing?Privilege auditing is the auditing of the use of powerful system privileges without regard to specifically named objects.

    84. What is Object Auditing?Object auditing is the auditing of accesses to specific schema objects without regard to user.

    85. Physical DB StructureORACLE db consists of atleast one or more data files, two or more redo log files & one or more control files. The filesof a db provide the actual physical storage for db info.

    86. Logical DB StructureORACLE db consists of one or more tablespaces, the db schema??s objects (i.e. tables, views, indexes, clusters,sequences, sp). Tablespaces, Segments, Extents dictate how physical space of a db is used.

    86. TablespacesA db is divided into logical storage units called TS. TS is used to group related logical structures together. Each db islogically divided into one or more TS. One or more data files are explicitly created for each TS to physically store thedata of all logical structures in a TS. Combined size of the data file is the total storage capacity of TS. Combinedstorage capacity of the TS??s is the total storage capacity of the db.

    87. Online & Offline TS

    A TS can be online (accessible) or offline (not accessible). A TS can be offline to make portion of the db unavailablewhile allowing normal access for the remainder of the db to make administrative tasks easier.

    88. SchemaSchema is a collection of objects. Schema Objects are the logical structures that directly refer to the db??s data.Schema objects includes tables, views, sequences, synonyms, stored procedures, indexes, clusters & db links. Norelation between ts & schema. Objects in same schema can be in diff. ts & vice versa.

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    30/66

    89. Index ClustersIndex Clusters are group of one or more tables physically stored together because they share common columns &are often used together. The related columns of the tables in a cluster is called cluster key. The data in a cluster keyof an index cluster is store only once for multiple tables, so disk access time improves.

    90. Index ClustersHash Clusters : Also cluster table data in a manner similar to normal cluster. A row is stored in a hash cluster basedon the result of applying a hash function to the row??s cluster key value. All rows with the same hash key value arestored together on disk. Hash clusters are better than using indexed table or indexed clusters when a table is queriedwith equality queries. For such queries, the specified cluster key is hashed. The resulting hash key value pointsdirectly to the area on disk that stores the specified rows.

    91. Database LinksDatabase Links is a name object that describes a path from one db to another. DB links are implicitly used when areference is made to a global object name in a distributed db.

    91. Data BlocksAt the finest level of granularity, an ORACLE db??s data is stored in data blocks. One data block corresponds to aspecific number of bytes of physical db space on a disk. A data block size is specified when the db is created. A dbuses & allocates free db space in ORACLE data blocks.

    91. Data BlocksAt the finest level of granularity, an ORACLE db??s data is stored in data blocks. One data block corresponds to aspecific number of bytes of physical db space on a disk. A data block size is specified when the db is created. A dbuses & allocates free db space in ORACLE data blocks.

    Every DBA should know something about the operating system that the database will be running on. The questionshere are related to UNIX but you should equally be able to answer questions related to common Windows

    environments.92. For a field in a repeating frame, can the source come from the column which does not exist in the datagroup which forms the base for the frame?Yes

    93. Can a field be used in a report without it appearing in any data group?Yes

    94. The join defined by the default data link is an outer join yes or no?Yes

    95. What UNIX command will control the default file permissions when files are created?

    Umask

    96. Explain the read, write, and execute permissions on a UNIX directory.

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    31/66

    Read allows you to see and list the directory contents. Write allows you to create, edit and delete files andsubdirectories in the directory. Execute gives you the previous read/write permissions plus allows you to change intothe directory and execute programs or shells from the directory.

    97. the difference between a soft link and a hard link?A symbolic (soft) linked file and the targeted file can be located on the same or different file system while for a hardlink they must be located on the same file system.

    99. Give the command to display space usage on the UNIX file system.df -lk

    100. Explain iostat, vmstat and netstat.Iostat reports on terminal, disk and tape I/O activity. Vmstat reports on virtual memory statistics for processes, disk,tape and CPU activity. Netstat reports on the contents of network data structures.

    101. What is new_form built-in?When one form invokes another form by executing new_form oracle form exits the first form and releases its memorybefore loading the new form calling new form completely replace the first with the second. If there are changespending in the first form, the operator will be prompted to save them before the new form is loaded.

    102. What is the LOV of Validation Property of an item? - What is the use of it?When LOV for Validation is set to True, Oracle Forms compares the current value of the text item to the values in thefirst column displayed in the LOV. Whenever the validation event occurs. If the value in the text item matches one ofthe values in the first column of the LOV, validation succeeds, the LOV is not displayed, and processing continuesnormally. If the value in the text item does not match one of the values in the first column of the LOV, Oracle Formsdisplays the LOV and uses the text item value as the search criteria to automatically reduce the list.

    103. What is the diff. when Flex mode is mode on and when it is off?When flex mode is on, reports automatically resizes the parent when the child is resized.

    104. What is ROWID?Answer1For each row in the database, the ROWID pseudocolumn returns a rows address. ROWID values contain informationnecessary to locate a row:* which data block in the data file* which row in the data block (first row is 0)* which data file (first file is 1)

    Answer2

    .row id: A rowid is a pseudo-column that uniquely identifies a row in a table, but not within a data base.

    105. What is a correlated subquery?A correlated subquery is a SELECT statement nested inside another T-SQL statement, which contains a reference toone or more columns in the outer query

    106. Explain UNION, MINUS, UNION ALL and INTERSECT?

    The UNION command is used to select related information from two tables, much like the JOIN command. However,when using the UNION command all selected columns need to be of the same data type.The UNION ALL command

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    32/66

    is equal to the UNION command, except that UNION ALL selects all values.INTERSECT - Return only those rowsthat are in *both* SELECT statements.MINUS - Return the rows that are in the first SELECT but not the second.

    107. What are the types of SQL statement?4 TYPES OF SQL STATEMENTS ARE THERESelect (default)InsertUpdateDelete

    108. What is a pseudo column. Give some examples?pseudo columns are used to access object content and other informationexamples::rowidversions_xidversions_operationversions_startscnversions_endscnsysdatesystimestamprownumora_rowscn object_valuelevel (only in hierarchical queries with connect by user

    109. What is difference between CHAR and VARCHAR2?The difference between a CHAR and a VARCHAR is that a CHAR(n) will ALWAYS be N bytes long, it will be blankpadded upon insert to ensure this. A varchar2(n) on the other hand will be 1 to N bytes long, it will NOT be blankpadded

    110. What do you know about subqueries?A subquery is a query within a query. In Oracle, you can create subqueries within your SQL statements. Thesesubqueries can reside in the WHERE clause, the FROM clause, or the SELECT clause.

    111. What is a database link?It is a named object that describes a path from one database to another.

    112. How to drop the index ?drop index index-name;.

    113. What are the different types of SQL statements?SQL statements are divided into five categories:Data manipulation language (DML).Data definition language (DDL).Transaction control.Session control.System control

    114. What are the uses of rollback segment?

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    33/66

    If we find any problem after data manipulation and if we want to undo it, then we can use this ROLLBACK segment.SAVEPOINT is the command used to save the workdone. After saving data, if we want to perform insertion/deletionand we done it wrongly, then we can ROLLBACK it by using the SAVEPOINT.

    Ex:SAVEPOINT s1;ROLLBACK s1;

    115. What is a deadlock and Explain?Waiting for an event that never happens or processed.Ex : Say there are three process P1, P2, P3 and three resources R1, R2, R3.(1) P1 is started and it is using R1.(2) P2 is started and it is using R2.(3) P3 is started and it is using R3.

    To complete process P1 it needs resource R2 which is currently used by P2.To complete process P2 it needs resource R3 which is currently used by P3.To complete process P3 it needs resource R1 which is currently used by P1.

    In this case each and every process is waiting for unoccured events. This situation we called as DEADLOCK.To prevent this concept is there called DEADLOCK PREVENTION.

    116. State any three mouse events system variables?System.mouse_button_pressedSystem.mouse_button_shift

    117. What other parts of your organization do you interact with and how?Again, if you have exhausted question 1 and 2 you may never get to this question. But if you have been apprehensiveto opening up and explaining yourself, take note that you may have an issue and the interviewer might also bealready getting tired of the interview process. If you get to this question consider yourself in trouble. You really needto forget all your hang-ups and start explaining what it is that you like to do as a DBA, and why you want to work forthis particular company. You are going to have to reel this interviewer back into the interview process or you mightnot get to the true technical question part of the interview.

    118. How do you display console on a window?The console includes the status line and message line, and is displayed at the bottom of the window to which it isassigned. To specify that the console should be displayed, set the console window form property to the name of anywindow in the form. To include the console, set console window to Null.

    119. In exception handling we have some NOT_FOUND and OTHERS. In inner layer we have someNOT_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 anINNER_LOOP.

    120. What are the different types of joins?Different Types of Joins-Inner JoinOuter Join - Right Outer Join

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    34/66

    Left Outer JoinCross Join

    121. How will you copy the structure of a table without copying the data?Answer1create table xyzas ( select * from abc where 1=0)

    Answer2create table New_tbl as select * from Old_tbl where rownum

    Answer3select top 0 * into xyz from try

    122. What is a VIEW? How to get script for a view?Answer1View is a logical perspective of a Table. It is a predefined set of query on a table through which we can perform anykind of select queries instead of redefining the condition every time. Update or Insert Statements cannot beperformed through this.

    Answer2Update or Insert statements cannot be performed ON View. Answer3Update or Insert statements cannot be performed ON View is not correct.

    As I know, if a view meets certain criteria you can update it and such operation will be reflected in the original table.Also, if you are using materialized view, you can insert or update it.

    123. What is a trigger?

    Answer1Its a piece of sql that is activitied when a certain event happens.

    Answer2Trigger is also set of sql comments written together same as stored procedure but the difference is that trigger will beactivated each & everytime addition or deletion takes place.

    124. Explain the difference between a hot backup and a cold backup and the benefits associated with each.A hot backup is basically taking a backup of the database while it is still up and running and it must be in archive logmode. A cold backup is taking a backup of the database while it is shut down and does not require being in archivelog mode. The benefit of taking a hot backup is that the database is still available for use while the backup isoccurring and you can recover the database to any point in time. The benefit of taking a cold backup is that it istypically easier to administer the backup and recovery process. In addition, since you are taking cold backups thedatabase does not require being in archive log mode and thus there will be a slight performance gain as the databaseis not cutting archive logs to disk.

    125. What cursor type do you use to retrieve multiple recordsets?REF cursor in oracle

    126. What is the difference among dropping a table, truncating a table and deleting all records from atable.DROP..It will drop the table completely.(all values& table structure)TRUNCATEAll the values in the table will be deleted.(the structure wont be)DELETE.Can be use to delete particular row or all values i table.(structure wont be deleted)

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    35/66

    127. Difference between ORACLE and MICROSOFT ACCESS databases.Answer1ORACLE .can be use with a no of platform eg unix,windown,solaris.SQL that is use for retriving data from oracle isknown as Transact SQL.ORACLE is very big database compare with MSAcess.MSAcessCan be use with windows only.SQL use is known just as SQL.

    Answer2

    MSA support only in windows platforms. But oracle available in all platforms. No security and there is no conceprs ofschema,users,privilages in access. Aceess is used in small and medium organizations. Oracle is a collection of largeno database tools for mangaing data.

    128. How to remove duplicate records from a table?Answer1Sol. DELETE FROM table_name WHERE id=1 LIMIT 1;

    Answer2in Oracle:-delete from table_namewhere id = 1and rowid != (select max(rowid) from table_name where id = 1);

    Note - min() can be used in place of max(). max() will keep the latest record and min() will keep the oldest record.

    Answer3in Oracle:-delete from empwhere rowid not in (select max(rowid) from emp group by empno);

    129. Are you a nuts-n-bolts DBA or a tools-n-props DBAA nuts-n-bolts DBA is the type that likes to figure out every little item about how the database works. He/she is a DBAwho typically hates a GUI environment and prefers the command line to execute commands and accomplish tasks. Anuts-n-bolts DBA like to feel in control of the database and only feels comfortable at the command line and vi as aneditor. The tools-n-props DBA is mostly the opposite of a nuts-n-bolts DBA, they like the feel of a GUI, the ease atwhich things can be accomplished without knowing much about the database. They want to get the job done with theleast amount of intervention from having to figure out what everything is doing behind the scenes. Now the answer, Iwould explain myself as a combination of the two. I, having been in this business for over 20 years, have grown up ina command line era where the GUIs never seemed to work. There was high complexity in systems and not muchgood documentation on how things worked. Thus, I had to learn everything about most aspects of the databaseenvironment I was working in and thus became a nuts-n-bolts DBA. I was a true command line and vi bigot. Timeshave changed and the GUIs are very reliable, understand the environment they are installed on, and can generallyget the job done quicker for individuals new to database administration. I too am slowly slipping over to the dark sideof GUI administration. If you find yourself as a tools-n-props DBA, try to convey that you are aware of some tasks thatrequire you to be a nuts-n-bolts DBA.

    130. How to create a database link?A database link is an object in the local database that allows you to access objects on a remote database or to mounta secondary database in read-only mode.CREATE [PUBLIC] DATABASE LINK dblink[CONNECT TO user IDENTIFIED BY password][USING connect_string]

    131. What is SQL*Loader?SQL*Loader is a bulk loader utility used for moving data from external files into the Oracle database. One can loaddata into an Oracle database by using the sqlldr (sqlload on some platforms) utility.

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    36/66

    132. How to run SQL script from a Unix Shell?The below example shows how to interact oracle from Shell script sqlplus /nolog

    133. Talk about Exception Handling in PL/SQL?

    2 types of Exception In User-defined & Pre-defined.Any Error can be Handled by Pre-defined Exception Handler (Ex.no_data_found,too_many_rows etc.)In User-defined exception has to declare in Declaration section and any exception can be handled by that Exceptionname. Any types of Exception(User-defined & Pre-defined) can be Handled by When Others exception Handler.

    134. Give some examples of Analytical functionsrank,dense_rank,rollup,cube etc

    135. What is Log Switch?The point at which ORACLE ends writing to one online redo log file and begins writing to another is called a logswitch.

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

    137. Which parameter specified in the DEFAULT STORAGE clause of CREATE TABLESPACE cannot bealtered after creating the tablespace?

    All the default storage parameters defined for the tablespace can be changed using the ALTER TABLESPACEcommand. When objects are created their INITIAL and MINEXTENS values cannot be changed.

    138. What are the steps involved in Database Startup?Start an instance, Mount the Database and Open the Database.

    139. What are the steps involved in Instance Recovery?Rolling forward to recover data that has not been recorded in data files, yet has been recorded in the on-line redo log,including the contents of rollback segments. Rolling back transactions that have been explicitly rolled back or havenot been committed as indicated by the rollback segments regenerated in step a. Releasing any resources (locks)held by transactions in process at the time of the failure.Resolving any pending distributed transactions undergoing a two-phase commit at the time of the instance failure.

    140. Can Full Backup be performed when the database is open?No.

    141. You have just had to restore from backup and do not have any control files. How would you go aboutbringing up this database?I would create a text based backup control file, stipulating where on disk all the data files where and then issue therecover command with the using backup control file clause.

    142. What are the steps involved in Database Shutdown?

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    37/66

    Close the Database, Dismount the Database and Shutdown the Instance.

    143. What is Archived Redo Log?Archived Redo Log consists of Redo Log files that have archived before being reused.

    144. What is Restricted Mode of Instance Startup?An instance can be started in (or later altered to be in) restricted mode so that when the database is openconnections are limited only to those whose user accounts have been granted the RESTRICTED SESSION systemprivilege.

    145. What is Partial Backup?A Partial Backup is any operating system backup short of a full backup, taken while the database is open or shutdown.

    146. What is Mirrored on-line Redo Log?A mirrored on-line redo log consists of copies of on-line redo log files physically located on separate disks, changesmade to one member of the group are made to all members.

    147. What is Full Backup?A full backup is an operating system backup of all data files, on- line redo log files and control file that constituteORACLE database and the parameter.

    148. Can a View based on another View?Yes.

    149. Can a Tablespace hold objects from different Schemes?

    Yes.

    150. Can objects of the same Schema reside in different tablespaces?Yes.

    151. What is the use of Control File?When an instance of an ORACLE database is started, its control file is used to identify the database and redo log filesthat must be opened for database operation to proceed. It is also used in database recovery.

    152. What is your typical day like?If you spend enough time on question 1, this question will never be asked. It is really a continuation of question 1 totry and get you to open up and talk about the type of things you like to do. Personally, I would continue with thetheme of question 1 if you are cut short or this question is asked later in the interview process. Just note that thisquestion is not all geared toward the day-to-day operational issues you experience as a DBA. This question alsogives you the opportunity to see if they want to know about you as an individual. Since the question did not stipulate"on the job" I would throw in a few items like, I get up at 5:00am to get into work and get some quiet time to read upon new trends or you help coach your son/daughter's soccer team. Just test the waters to what is acceptable. If theinterviewer starts to pull you back to "job" related issues, do not go to personal. Also, if you go to the office of theinterviewer please notice the surroundings, if there are pictures of his/her family, it is probably a good idea to venture

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    38/66

    down the personal path. If there is a fly-fishing picture on the wall, do not say you like deep-sea fishing. You get thepicture.

    153. How do you switch from an init.ora file to a spfile?Issue the create spfile from pfile command.

    154. Explain the difference between a data block, an extent and a segment.A data block is the smallest unit of logical storage for a database object. As objects grow they take chunks ofadditional storage that are composed of contiguous data blocks. These groupings of contiguous data blocks arecalled extents. All the extents that an object takes when grouped together are considered the segment of thedatabase object.

    155. Give two examples of how you might determine the structure of the table DEPT.Use the describe command or use the dbms_metadata.get_ddl package.

    156. What is a Redo Log?The set of Redo Log files YSDATE,UID,USER or USERENV SQL functions, or the pseudo columns LEVEL orROWNUM.

    157. What is an Index Segment?

    Each Index has an Index segment that stores all of its data.

    158. Explain the relationship among Database, Tablespace and Data file.?Each databases logically divided into one or more tablespaces one or more data files are explicitly created for eachtablespace

    159. What are the different type of Segments?Data Segment, Index Segment, Rollback Segment and Temporary Segment.

    160. What are Clusters?Clusters are groups of one or more tables physically stores together to share common columns and are often usedtogether.

    161. What is an Integrity Constrains?An integrity constraint is a declarative way to define a business rule for a column of a table.

    162. What is an Index?An Index is an optional structure associated with a table to have direct access to rows, which can be created toincrease the performance of data retrieval. Index can be created on one or more columns of a table.

    163. What is an Extent?An Extent is a specific number of contiguous data blocks, obtained in a single allocation, and used to store a specifictype of information.

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    39/66

    164. What is a View?A view is a virtual table. Every view has a Query attached to it. (The Query is a SELECT statement that identifies thecolumns and rows of the table(s) the view uses.)

    165. What is Table?A table is the basic unit of data storage in an ORACLE database. The tables of a database hold all of the useraccessible data. Table data is stored in rows and columns.

    166. What column differentiates the V$ views to the GV$ views and how?

    The INST_ID column which indicates the instance in a RAC environment the information came from.

    167. What command would you use to create a backup control file?Alter database backup control file to trace.

    168. Give two examples of referential integrity constraints.A primary key and a foreign key.

    169. What is schema?A schema is collection of database objects of a User.

    170. Describe Referential Integrity?A rule defined on a column (or set of columns) in one table that allows the insert or update of a row only if the valuefor the column or set of columns (the dependent value) matches a value in a column of a related table (the referencedvalue). It also specifies the type of data manipulation allowed on referenced data and the action to be performed ondependent data as a result of any action on referenced data.

    171. What is Hash Cluster?A row is stored in a hash cluster based on the result of applying a hash function to the rows cluster key value. Allrows with the same hash key value are stores together on disk.

    172. What is a Private Synonyms?A Private Synonyms can be accessed only by the owner.

    173. What is Database Link?A database link is a named object that describes a path from one database to another.

    174. What is a Tablespace?A database is divided into Logical Storage Unit called tablespaces. A tablespace is used to grouped related logicalstructures together

    175. What is Rollback Segment?

    A Database contains one or more Rollback Segments to temporarily store undo information.

    176. What are the Characteristics of Data Files?

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    40/66

    A data file can be associated with only one database. Once created a data file cant change size. One or more datafiles form a logical unit of database storage called a tablespace.

    177. How to define Data Block size?A data block size is specified for each ORACLE database when the database is created. A database users andallocated free database space in ORACLE datablocks. Block size is specified in INIT.ORA file and cant be changedlatter.

    178. When a user process fails, what background process cleans up after it?PMON

    179. What background process refreshes materialized views?The Job Queue Processes.

    180. How would you determine what sessions are connected and what resources they are waiting for?Use of V$SESSION and V$SESSION_WAIT

    181. What is the effect of setting the value CHOOSE for OPTIMIZER_GOAL, parameter of the ALTERSESSION Command?The Optimizer chooses Cost_based approach and optimizes with the goal of best throughput if statistics for atleastone of the tables accessed by the SQL statement exist in the data dictionary. Otherwise the OPTIMIZER choosesRULE_based approach.

    182. What is the function of Optimizer?The goal of the optimizer is to choose the most efficient way to execute a SQL statement.

    183. What is Execution Plan?The combinations of the steps the optimizer chooses to execute a statement is called an execution plan.

    184. What are the different approaches used by Optimizer in choosing an execution plan?Rule-based and Cost-based.

    185. What does ROLLBACK do?

    ROLLBACK retracts any of the changes resulting from the SQL statements in the transaction.

    186. What is SAVE POINT?For long transactions that contain many SQL statements, intermediate markers or savepoints can be declared whichcan be used to divide a transaction into smaller parts. This allows the option of later rolling back all work performedfrom the current point in the transaction to a declared savepoint within the transaction.

    187. What are the values that can be specified for OPTIMIZER MODE Parameter?COST and RULE.

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    41/66

    188. What is COST-based approach to optimization?Considering available access paths and determining the most efficient execution plan based on statistics in the datadictionary for the tables accessed by the statement and their associated clusters and indexes.

    189. What does COMMIT do?COMMIT makes permanent the changes resulting from all SQL statements in the transaction. The changes made bythe SQL statements of a transaction become visible to other user sessions transactions that start only aftertransaction is committed.

    190. What is RULE-based approach to optimization?Choosing an executing plan based on the access paths available and the ranks of these access paths.

    191. What are the values that can be specified for OPTIMIZER_GOAL parameter of the ALTER SESSIONCommand?CHOOSE,ALL_ROWS,FIRST_ROWS and RULE.

    192. Define Transaction?A Transaction is a logical unit of work that comprises one or more SQL statements executed by a single user.

    193. What is Read-Only Transaction?A Read-Only transaction ensures that the results of each query executed in the transaction are consistent withrespect to the same point in time.

    193. What is a deadlock?Explain . Two processes waiting to update the rows of a table which are locked by the other process then deadlockarises. In a database environment this will often happen because of not issuing proper row lock commands. Poordesign of front-end application may cause this situation and the performance of server will reduce drastically. Theselocks will be released automatically when a commit/rollback operation performed or any one of this processes beingkilled externally.

    194. Name two files used for network connection to a database.

    TNSNAMES.ORA and SQLNET.ORA

    195. What?s the command to see the current user name?Sql> show user;

    196. How do you switch to DOS prompt from SQL prompt?SQL> host

    197. What are the basic element of Base configuration of an oracle Database?It consists of one or more data files. one or more control files. two or more redo log files. The Database containsmultiple 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 CacheBuffers, Redo log buffers, Shared SQL pool) SMON (System MONito) PMON (Process MONitor) LGWR (LoG Write)

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    42/66

    DBWR (Data Base Write) ARCH (ARCHiver) CKPT (Check Point) RECO Dispatcher User Process with associatedPGS

    198. What is clusters?Group of tables physically stored together because they share common columns and are often used together iscalled Cluster.

    199. What is an Index? - How it is implemented in Oracle Database?An index is a database structure used by the server to have direct access of a row in a table. An index isautomatically created when a unique of primary key constraint clause is specified in create table command (Ver 7.0)

    200. What is a Database instance?Explain A database instance (Server) is a set of memory structure and background processes that access a set ofdatabase files. The process can be shared by all users. The memory structure that are used to store most querieddata from database. This helps up to improve database performance by decreasing the amount of I/O performedagainst data file.

    201. What is the use of ANALYZE command?To perform one of these function on an index, table, or cluster: - To collect statistics about object used by theoptimizer and store them in the data dictionary. - To delete statistics about the object used by object from the datadictionary. - To validate the structure of the object.. - To identify migrated and chained rows off the table or cluster.

    202. What is default tablespace?The Tablespace to contain schema objects created without specifying a tablespace name.

    203. What are the system resources that can be controlled through Profile?The number of concurrent sessions the user can establish the CPU processing time available to the users sessionthe CPU processing time available to a single call to ORACLE made by a SQL statement the amount of logical I/Oavailable to the users session the amount of logical I/O available to a single call to ORACLE made by a SQLstatement the allowed amount of idle time for the users session the allowed amount of connect time for the userssession.

    204. What is Tablespace Quota?

    The collective amount of disk space available to the objects in a schema on a particular tablespace.

    205. What are the different Levels of Auditing?Statement Auditing, Privilege Auditing and Object Auditing.

    206. What is Statement Auditing?Statement auditing is the auditing of the powerful system privileges without regard to specifically named objects

    207. What are the database administrators utilities available?SQL * DBA - This allows DBA to monitor and control an ORACLE database. SQL * Loader - It loads data fromstandard operating system files (Flat files) into ORACLE database tables. Export (EXP) and Import (imp) utilitiesallow you to move existing data in ORACLE format to and from ORACLE database.

  • 8/8/2019 DataBase Administrator (DBA) Interview Questions and Answers

    43/66

    208. How can you enable automatic archiving?Shut the database Backup the database Modify/Include LOG_ARCHIVE_START_TRUE in init.ora file. Start up thedatabase.

    209. What are roles?Roles are named groups of related privileges that are granted to users or other roles.

    210. How can we implement roles?Roles are the easiest way to grant and manage common privileges needed by different groups of database users.Creating roles and assigning provides to roles.