7009909 DBA Fyicenter Faq

Embed Size (px)

Citation preview

  • 8/14/2019 7009909 DBA Fyicenter Faq

    1/39

  • 8/14/2019 7009909 DBA Fyicenter Faq

    2/39

    FAQ: DBA

    If you spend enough time on question 1, this question will never be asked. It isreally a continuation of question 1 to try and get you to open up and talk about

    the type of things you like to do. Personally, I would continue with the theme ofquestion 1 if you are cut short or this question is asked later in the interviewprocess. Just note that this question is not all geared toward the day-to-dayoperational issues you experience as a DBA. This question also gives you theopportunity to see if they want to know about you as an individual. Since thequestion did not stipulate "on the job" I would throw in a few items like, I get up at5:00am to get into work and get some quiet time to read up on new trends or youhelp coach your son/daughter's soccer team. Just test the waters to what isacceptable. If the interviewer starts to pull you back to "job" related issues, do notgo to personal. Also, if you go to the office of the interviewer please notice thesurroundings, if there are pictures of his/her family, it is probably a good idea to

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

    3. 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 thisquestion. But if you have been apprehensive to opening up and explainingyourself, 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 consideryourself in trouble. You really need to forget all your hang-ups and startexplaining what it is that you like to do as a DBA, and why you want to work for

    this particular company. You are going to have to reel this interviewer back intothe interview process or you might not get to the true technical question part ofthe interview.

    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 databasecarrier have I distinguished between "development" and "production." Just askyour development staff or VP of engineering how much time and money is lost ifdevelopment systems are down. Explain to the interviewer that both systems areequally important to the operation of the company and both should be consideredas production systems because there are people relying on them and money islost if either one of them is down. Ok you may be saying, and I know you are,that we lose more money if the production system is down. Ok, convey that to theinterviewer and you won't get anyone to disagree with you unless your companysells software or there are million dollar deals on the table that are expecting thenext release of your product or service.

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 2

  • 8/14/2019 7009909 DBA Fyicenter Faq

    3/39

    FAQ: DBA

    5. Are you a nuts-n-bolts DBA or a tools-n-props DBA

    A nuts-n-bolts DBA is the type that likes to figure out every little item about howthe database works. He/she is a DBA who typically hates a GUI environment andprefers the command line to execute commands and accomplish tasks. A nuts-n-bolts DBA like to feel in control of the database and only feels comfortable at thecommand line and vi as an editor. The tools-n-props DBA is mostly the oppositeof a nuts-n-bolts DBA, they like the feel of a GUI, the ease at which things can beaccomplished without knowing much about the database. They want to get the

    job done with the least amount of intervention from having to figure out whateverything is doing behind the scenes. Now the answer, I would explain myselfas a combination of the two. I, having been in this business for over 20 years,have grown up in a command line era where the GUIs never seemed to work.There was high complexity in systems and not much good documentation onhow things worked. Thus, I had to learn everything about most aspects of thedatabase environment I was working in and thus became a nuts-n-bolts DBA. Iwas a true command line and vi bigot. Times have changed and the GUIs arevery reliable, understand the environment they are installed on, and cangenerally get the job done quicker for individuals new to database administration.I too am slowly slipping over to the dark side of GUI administration. If you findyourself as a tools-n-props DBA, try to convey that you are aware of some tasksthat require you to be a nuts-n-bolts DBA.

    6. 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 andrunning and it must be in archive log mode. A cold backup is taking a backup ofthe database while it is shut down and does not require being in archive logmode. The benefit of taking a hot backup is that the database is still available foruse while the backup is occurring and you can recover the database to any pointin time. The benefit of taking a cold backup is that it is typically easier toadminister the backup and recovery process. In addition, since you are takingcold backups the database does not require being in archive log mode and thusthere will be a slight performance gain, as the database is not cutting archive

    logs to disk.

    7. You have just had to restore from backup and do not have any control files.How would you go about bringing up this database?

    I would create a text based backup control file, stipulating where on disk all thedata files where and then issue the recover command with the using backupcontrol file clause.

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 3

  • 8/14/2019 7009909 DBA Fyicenter Faq

    4/39

    FAQ: DBA

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

    Issue the create spfile from pfile command.

    9. 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. Asobjects grow they take chunks of additional storage that are composed ofcontiguous data blocks. These groupings of contiguous data blocks are calledextents. All the extents that an object takes when grouped together areconsidered the segment of the database object.

    10. Give two examples of how you might determine the structure of the tableDEPT.

    Use the describe command or use the dbms_metadata.get_ddl package.

    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 ofall the rows in a table. The difference between the two is that the truncatecommand is a DDL operation and just moves the high water mark and producesa now rollback. The delete command, on the other hand, is a DML operation,which will produce a rollback and 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 typeof data they hold.

    Fact tables and dimension tables. A fact table contains measurements while

    dimension tables will contain data that will help describe the fact tables.

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

    A Bitmap index.

    16. Give two examples of referential integrity constraints.

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 4

  • 8/14/2019 7009909 DBA Fyicenter Faq

    5/39

    FAQ: DBA

    A primary key and a foreign key.

    17. 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?

    Disable the foreign key constraint to the parent, drop the table, re-create thetable, enable the foreign key constraint.

    18. Explain the difference between ARCHIVELOG mode and NOARCHIVELOGmode 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 have occurred in the database so that you canrecover to any point in time. NOARCHIVELOG mode is basically the absence ofARCHIVELOG mode and has the disadvantage of not being able to recover toany point in time. NOARCHIVELOG mode does have the advantage of nothaving to write transactions to an archive log and thus increases the performanceof the database slightly.

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

    Alter database backup control file to trace.

    20. Give the stages of instance startup to a usable state where normal users mayaccess it.

    STARTUP NOMOUNT - Instance startupSTARTUP MOUNT - The database is mountedSTARTUP OPEN - The database is opened

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

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

    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 statement

    Look at the explain plan with utlxplp.sql or utlxpls.sql23. How would you go about increasing the buffer cache hit ratio?

    Use the buffer cache advisory over a given workload and then query thev$db_cache_advice table. If a change was necessary then I would use the altersystem set db_cache_size command.

    24. Explain an ORA-01555

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 5

  • 8/14/2019 7009909 DBA Fyicenter Faq

    6/39

    FAQ: DBA

    You get this error when you get a snapshot too old within rollback. It can usuallybe solved by increasing the undo retention or increasing the size of rollbacks.

    You should also look at the logic involved in the application getting the errormessage.

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

    ORACLE_BASE is the root directory for oracle. ORACLE_HOME locatedbeneath ORACLE_BASE is where the oracle products reside.

    26. How would you determine the time zone under which a database wasoperating?

    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. Thisvariable is either TRUE or FALSE and if it is set to TRUE it enforces databaselinks to have the same name as the remote database to which they are linking.

    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 acollection of PL/SQL code that carries a single task. While a procedure does nothave to return any values to the calling application, a function will return a singlevalue. A package on the other hand is a collection of functions and proceduresthat are grouped together based on their commonality to a business function orapplication.

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

    31. Name three advisory statistics you can collect.

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 6

  • 8/14/2019 7009909 DBA Fyicenter Faq

    7/39

    FAQ: DBA

    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

    33. Explain materialized views and how they are used.

    Materialized views are objects that are reduced sets of information that havebeen summarized, grouped, or aggregated from base tables. They are typicallyused in data warehouse or decision support systems.

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

    PMON

    35. What background process refreshes materialized views?

    The Job Queue Processes.

    36. How would you determine what sessions are connected and what resourcesthey are waiting for?

    Use of V$SESSION and V$SESSION_WAIT

    37. Describe what redo logs are.

    Redo logs are logical and physical structures that are designed to hold all thechanges made to a database and are intended to aid in the recovery of adatabase.

    38. How would you force a log switch?

    ALTER SYSTEM SWITCH LOGFILE;

    39. Give two methods you could use to determine what DDL changes have beenmade.

    You could use Logminer or Streams

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

    41. What is the difference between a TEMPORARY tablespace and aPERMANENT tablespace?

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 7

  • 8/14/2019 7009909 DBA Fyicenter Faq

    8/39

    FAQ: DBA

    A temporary tablespace is used for temporary objects such as sort structureswhile permanent tablespaces are used to 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 toconnect 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 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 intosmaller, more manageable pieces.

    51. You have just compiled a PL/SQL package but got errors, how would youview the errors?

    SHOW ERRORS52. 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;

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 8

  • 8/14/2019 7009909 DBA Fyicenter Faq

    9/39

    FAQ: DBA

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

    These two Oracle utilities are used for loading data into the database. Thedifference is that the import utility relies on the data being produced by anotherOracle 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 itconforms to ASCII formatted or delimited files.

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

    TNSNAMES.ORA and SQLNET.ORA

    54. What?s the command to see the current user name?

    Sql> show user;

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

    56. How do you switch to DOS prompt from SQL prompt?

    SQL> host

    57. How do I eliminate the duplicate rows ?

    SQL> delete from table_name where rowid not in (select max(rowid) from table

    group by duplicate_values_field_name);orSQL> delete duplicate_values_field_name dv from table_name ta where rowid

  • 8/14/2019 7009909 DBA Fyicenter Faq

    10/39

    FAQ: DBA

    103 Jiyo104 Smith

    58. How do I display row number with records?

    To achive this use rownum pseudocolumn with query, like SQL> SQL> selectrownum, ename from emp; Output: 1 Scott 2 Millor 3 Jiyo 4 Smith

    59. Display the records between two range

    select rownum, empno, ename from emp where rowid in(select rowid from emp where rownum

  • 8/14/2019 7009909 DBA Fyicenter Faq

    11/39

    FAQ: DBA

    There are four cursor attributes used in Oracle cursor_name%Found,cursor_name%NOTFOUND, cursor_name%ROWCOUNT, cursor_name

    %ISOPEN

    63. Implicit Cursor attributes

    Same as explicit cursor but prefixed by the word SQL SQL%Found, SQL%NOTFOUND, SQL%ROWCOUNT, SQL%ISOPEN Tips : 1. Here SQL%ISOPEN is false, because oracle automatically closed the implicit cursor afterexecuting SQL statements. : 2. All are Boolean attributes

    64. Find out nth highest salary from emp table

    SELECT DISTINCT (a.sal) FROM EMP A WHERE &N = (SELECT COUNT(DISTINCT (b.sal)) FROM EMP B WHERE a.sal select banner from v$version;

    66. Display the number value in Words

    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 hundred1250 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 records

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 11

  • 8/14/2019 7009909 DBA Fyicenter Faq

    12/39

    FAQ: DBA

    Odd 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 text

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

    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 backgroundprocesses that access a set of database files. The processes can be shared byall of the users.The memory structure that is used to store the most queried data from database.

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 12

  • 8/14/2019 7009909 DBA Fyicenter Faq

    13/39

    FAQ: DBA

    This helps up to improve database performance by decreasing the amount of I/Operformed against data file.

    76. What is Parallel Server?

    Multiple instances accessing the same database (only in multi-CPUenvironments)

    77. What is a schema?

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

    78. 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 arow in a table. An index is automatically created when a unique of primary keyconstraint clause is specified in create table command

    79. What are clusters?

    Group of tables physically stored together because they share common columnsand are often used together is called cluster.

    80. What is a cluster key?

    The related columns of the tables are called the cluster key. The cluster key isindexed using a cluster index and its value is stored only once for multiple tablesin the cluster.

    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 tablesUser objects (table,indexes,views etc.,)

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 13

  • 8/14/2019 7009909 DBA Fyicenter Faq

    14/39

    FAQ: DBA

    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 otherprocesses then deadlock arises.In a database environment this will often happen because of not issuing theproper row lock commands. Poor design of front-end application may cause thissituation and the performance of server will reduce drastically.These locks will be released automatically when a commit/rollback operationperformed or any one of this processes being killed externally.

    83. Auditing

    To aid in the investigation of suspicious db use. Statement Auditing is theauditing of specific SQL statements. Privilege Auditing is the auditing of the useof powerful system privileges. Object Auditing is the auditing of access to specificschema objects.

    84. Audit Trial

    Results of audited operations are stored in a table in data dictionary.

    85. Physical DB Structure

    ORACLE db consists of atleast one or more data files, two or more redo log files& one or more control files. The files of a db provide the actual physical storagefor db info.

    86. Logical DB Structure

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 14

  • 8/14/2019 7009909 DBA Fyicenter Faq

    15/39

    FAQ: DBA

    ORACLE 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. Tablespaces

    A db is divided into logical storage units called TS. TS is used to group relatedlogical structures together. Each db is logically divided into one or more TS. Oneor more data files are explicitly created for each TS to physically store the data ofall logical structures in a TS. Combined size of the data file is the total storagecapacity of TS. Combined storage capacity of the TS??s is the total storagecapacity of the db.

    87. Online & Offline TS

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

    88. Schema

    Schema is a collection of objects. Schema Objects are the logical structures thatdirectly 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 & viceversa.

    89. Index Clusters

    Index Clusters are group of one or more tables physically stored togetherbecause they share common columns & are often used together. The relatedcolumns 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 timeimproves.

    90. Index Clusters

    Hash Clusters : Also cluster table data in a manner similar to normal cluster. Arow is stored in a hash cluster based on the result of applying a hash function tothe row??s cluster key value. All rows with the same hash key value are storedtogether on disk. Hash clusters are better than using indexed table or indexedclusters when a table is queried with equality queries. For such queries, the

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 15

  • 8/14/2019 7009909 DBA Fyicenter Faq

    16/39

    FAQ: DBA

    specified cluster key is hashed. The resulting hash key value points directly tothe area on disk that stores the specified rows.

    91. Database Links

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

    91. Data Blocks

    At the finest level of granularity, an ORACLE db??s data is stored in data blocks.

    One data block corresponds to a specific number of bytes of physical db spaceon a disk. A data block size is specified when the db is created. A db uses &allocates free db space in ORACLE data blocks.

    91. Data Blocks

    At the finest level of granularity, an ORACLE db??s data is stored in data blocks.One data block corresponds to a specific number of bytes of physical db spaceon a disk. A data block size is specified when the db is created. A db uses &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 questions here are related to UNIX but you should equallybe able to answer questions related to common Windows environments.

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

    ls -ltra

    93. How do you execute a UNIX command in the background?

    Use the "&"

    94. How do you execute a UNIX command in the background?

    Use the "&"

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

    Umask

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 16

  • 8/14/2019 7009909 DBA Fyicenter Faq

    17/39

    FAQ: DBA

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

    Read allows you to see and list the directory contents. Write allows you to create,edit and delete files and subdirectories in the directory. Execute gives you theprevious read/write permissions plus allows you to change into the directory andexecute 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 ordifferent file system while for a hard link they must be located on the same filesystem.

    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 virtualmemory statistics for processes, disk, tape and CPU activity. Netstat reports onthe contents of network data structures.

    101. How would you change all occurrences of a value using VI?

    Use :%s///g

    102. Give two UNIX kernel parameters that effect an Oracle install

    SHMMAX & SHMMNI

    103. Briefly, how do you install Oracle software on UNIX.

    Basically, set up disks, kernel parameters, and run orainst.

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 17

  • 8/14/2019 7009909 DBA Fyicenter Faq

    18/39

    FAQ: DBA

    Interview Questions for DBA

    Give one method for transferring a table from one schema to another:Level:IntermediateExpected Answer: There are several possible methods, export-import, CREATETABLE... AS SELECT, or COPY.

    2. What is the purpose of the IMPORT option IGNORE? What is it?s defaultsetting?Level: LowExpected Answer: The IMPORT IGNORE option tells import to ignore "alreadyexists" errors. If it is not specified the tables that already exist will be skipped. If itis specified, the error is ignored and the tables data will be inserted. The defaultvalue is N.

    3. You have a rollback segment in a version 7.2 database that has expandedbeyond optimal, how can it be restored to optimal?Level: LowExpected answer: Use the ALTER TABLESPACE ..... SHRINK command.

    4. If the DEFAULT and TEMPORARY tablespace clauses are left out of aCREATE USER command what happens? Is this bad or good? Why?Level: LowExpected answer: The user is assigned the SYSTEM tablespace as a defaultand temporary tablespace. This is bad because it causes user objects andtemporary segments to be placed into the SYSTEM

    tablespace resulting in fragmentation and improper table placement (only datadictionary objects and the system rollback segment should be in SYSTEM).

    5. What are some of the Oracle provided packages that DBAs should be awareof?Level: Intermediate to High

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 18

  • 8/14/2019 7009909 DBA Fyicenter Faq

    19/39

    FAQ: DBA

    Expected answer: Oracle provides a number of packages in the form of theDBMS_ packages owned by the SYS user. The packages used by DBAs may

    include: DBMS_SHARED_POOL, DBMS_UTILITY, DBMS_SQL, DBMS_DDL,DBMS_SESSION, DBMS_OUTPUT and DBMS_SNAPSHOT. They may also tryto answer with the UTL*.SQL or CAT*.SQL series of SQL procedures. These canbe viewed as extra credit but aren?t part of the answer.

    6. What happens if the constraint name is left out of a constraint clause?Level: LowExpected answer: The Oracle system will use the default name of SYS_Cxxxxwhere xxxx is a system generated number. This is bad since it makes trackingwhich table the constraint belongs to or what the constraint does harder.

    7. What happens if a tablespace clause is left off of a primary key constraintclause?Level: LowExpected answer: This results in the index that is automatically generated beingplaced in then users default tablespace. Since this will usually be the sametablespace as the table is being created in, this can cause serious performanceproblems.

    8. What is the proper method for disabling and re-enabling a primary keyconstraint?Level: Intermediate

    Expected answer: You use the ALTER TABLE command for both. However, forthe enable clause you must specify the USING INDEX and TABLESPACE clausefor primary keys.

    9. What happens if a primary key constraint is disabled and then enabled withoutfully specifying the index clause?Level: IntermediateExpected answer: The index is created in the user?s default tablespace and allsizing information is lost. Oracle doesn?t store this information as a part of theconstraint definition, but only as part of the index definition, when the constraintwas disabled the index was dropped and the information is gone.

    10. (On UNIX) When should more than one DB writer process be used? Howmany should be used?Level: HighExpected answer: If the UNIX system being used is capable of asynchronous IOthen only one is required, if the system is not capable of asynchronous IO thenup to twice the number of disks used by Oracle number of DB writers should bespecified by use of the db_writers initialization parameter

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 19

  • 8/14/2019 7009909 DBA Fyicenter Faq

    20/39

    FAQ: DBA

    11. You are using hot backup without being in archivelog mode, can you recoverin the event of a failure? Why or why not?

    Level: HighExpected answer: You can?t use hot backup without being in archivelog mode.So no, you couldn?t recover.

    12. What causes the "snapshot too old" error? How can this be prevented ormitigated?Level: IntermediateExpected answer: This is caused by large or long running transactions that haveeither wrapped onto their own rollback space or have had another transactionwrite on part of their rollback space. This can be prevented or mitigated bybreaking the transaction into a set of smaller transactions or increasing the size

    of the rollback segments and their extents.

    13. How can you tell if a database object is invalid?Level: LowExpected answer: By checking the status column of the DBA_, ALL_ orUSER_OBJECTS views, depending upon whether you own or only havepermission on the view or are using a DBA account.

    14. A user is getting an ORA-00942 error yet you know you have granted thempermission on the table, what else should you check?Level: Low

    Expected answer: You need to check that the user has specified the full name ofthe object (select empid from scott.emp; instead of select empid from emp;) orhas a synonym that points to the object (create synonym emp for scott.emp;)

    15. A developer is trying to create a view and the database won?t let him. He hasthe "DEVELOPER" role which has the "CREATE VIEW" system privilege andSELECT grants on the tables he is using, what is the problem?Level: IntermediateExpected answer: You need to verify the developer has direct grants on all tablesused in the view. You can?t create a stored object with grants given throughviews.

    16. If you have an example table, what is the best way to get sizing data for theproduction table implementation?Level: IntermediateExpected answer: The best way is to analyze the table and then use the dataprovided in the DBA_TABLES view to get the average row length and otherpertinent data for the calculation. The quick and dirty way is to look at the numberof blocks the table is actually using and ratio the number of rows in the table to its

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 20

  • 8/14/2019 7009909 DBA Fyicenter Faq

    21/39

    FAQ: DBA

    number of blocks against the number of expected rows.

    17. How can you find out how many users are currently logged into thedatabase? How can you find their operating system id?Level: highExpected answer: There are several ways. One is to look at the v$session orv$process views. Another way is to check the current_logins parameter in thev$sysstat view. Another if you are on UNIX is to do a "ps -ef|grep oracle|wc -l?command, but this only works against a single instance installation.

    18. A user selects from a sequence and gets back two values, his select is:SELECT pk_seq.nextval FROM dual;What is the problem?

    Level: IntermediateExpected answer: Somehow two values have been inserted into the dual table.This table is a single row, single column table that should only have one value init.

    19. How can you determine if an index needs to be dropped and rebuilt?Level: IntermediateExpected answer: Run the ANALYZE INDEX command on the index to validateits structure and then calculate the ratio ofLF_BLK_LEN/LF_BLK_LEN+BR_BLK_LEN and if it isn?t near 1.0 (i.e. greaterthan 0.7 or so) then the index should be rebuilt. Or if the ratio

    BR_BLK_LEN/ LF_BLK_LEN+BR_BLK_LEN is nearing 0.3.

    Tuning Questions for DBA

    1. A tablespace has a table with 30 extents in it. Is this bad? Why or why not.Level: IntermediateExpected answer: Multiple extents in and of themselves aren?t bad. However ifyou also have chained rows this can hurt performance.

    2. How do you set up tablespaces during an Oracle installation?Level: LowExpected answer: You should always attempt to use the Oracle FlexibleArchitecture standard or another partitioning scheme to ensure proper separationof SYSTEM, ROLLBACK, REDO LOG, DATA, TEMPORARY and INDEXsegments.

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 21

  • 8/14/2019 7009909 DBA Fyicenter Faq

    22/39

    FAQ: DBA

    3. You see multiple fragments in the SYSTEM tablespace, what should youcheck first?

    Level: LowExpected answer: Ensure that users don?t have the SYSTEM tablespace astheir TEMPORARY or DEFAULT tablespace assignment by checking theDBA_USERS view.

    4. What are some indications that you need to increase theSHARED_POOL_SIZE parameter?Level: IntermediateExpected answer: Poor data dictionary or library cache hit ratios, getting errorORA-04031. Another indication is steadily decreasing performance with all othertuning parameters the same.

    5. What is the general guideline for sizing db_block_size anddb_multi_block_read for an application that does many full table scans?Level: HighExpected answer: Oracle almost always reads in 64k chunks. The two shouldhave a product equal to 64 or a multiple of 64.

    6. What is the fastest query method for a table?Level: IntermediateExpected answer: Fetch by rowid

    7. Explain the use of TKPROF? What initialization parameter should be turned onto get full TKPROF output?Level: HighExpected answer: The tkprof tool is a tuning tool used to determine cpu andexecution times for SQL statements. You use it by first setting timed_statistics totrue in the initialization file and then turning on tracing for either the entiredatabase via the sql_trace parameter or for the session using the ALTERSESSION command. Once the trace file is generated you run the tkprof toolagainst the trace file and then look at the output from the tkprof tool. This canalso be used to generate explain plan output.

    8. When looking at v$sysstat you see that sorts (disk) is high. Is this bad orgood? If bad -How do you correct it? Level: IntermediateExpected answer: If you get excessive disk sorts this is bad. This indicates youneed to tune the sort area parameters in the initialization files. The major sort areparameter is the SORT_AREA_SIZe parameter.

    9. When should you increase copy latches? What parameters control copylatches?

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 22

  • 8/14/2019 7009909 DBA Fyicenter Faq

    23/39

    FAQ: DBA

    Level: highExpected answer: When you get excessive contention for the copy latches as

    shown by the "redo copy" latch hit ratio. You can increase copy latches via theinitialization parameter LOG_SIMULTANEOUS_COPIES to twice the number ofCPUs on your system.

    10. 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?Level: LowExpected answer: You can look in the init.ora file for an indication of manually setparameters. For all parameters, their value and whether or not the current valueis the default value, look in the v$parameter view.

    11. Describe hit ratio as it pertains to the database buffers. What is the differencebetween instantaneous and cumulative hit ratio and which should be used fortuning?Level: IntermediateExpected answer: The hit ratio is a measure of how many times the databasewas able to read a value from the buffers verses how many times it had to re-read a data value from the disks. A value greater than 80-90% is good, lesscould indicate problems. If you simply take the ratio of existing parameters thiswill be a cumulative value since the database started. If you do a comparisonbetween pairs of readings based on some arbitrary time span, this is theinstantaneous ratio for that time span. Generally speaking an instantaneous

    reading gives more valuable data since it will tell you what your instance is doingfor the time it was generated over.

    12. Discuss row chaining, how does it happen? How can you reduce it? How doyou correct it?Level: highExpected answer: Row chaining occurs when a VARCHAR2 value is updatedand the length of the new value is longer than the old value and won?t fit in theremaining block space. This results in the row chaining to another block. It canbe reduced by setting the storage parameters on the table to appropriate values.It can be corrected by export and import of the effected table.

    13. When looking at the estat events report you see that you are getting busybuffer waits. Is this bad? How can you find what is causing it?Level: highExpected answer: Buffer busy waits could indicate contention in redo, rollback ordata blocks. You need to check the v$waitstat view to see what areas arecausing the problem. The value of the "count" column tells where the problem is,the "class" column tells you with what. UNDO is rollback segments, DATA is database buffers.

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 23

  • 8/14/2019 7009909 DBA Fyicenter Faq

    24/39

    FAQ: DBA

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

    Level: IntermediateExpected answer: Increase the size of the shared pool.

    15. If you see statistics that deal with "undo" what are they really talking about?Level: IntermediateExpected answer: Rollback segments and associated structures.

    16. If a tablespace has a default pctincrease of zero what will this cause (inrelationship to the smon process)?Level: HighExpected answer: The SMON process won?t automatically coalesce its free

    space fragments.

    17. If a tablespace shows excessive fragmentation what are some methods todefragment the tablespace? (7.1,7.2 and 7.3 only)Level: HighExpected answer: In Oracle 7.0 to 7.2 The use of the 'alter session set events'immediate trace name coalesce level ts#';? command is the easiest way todefragment contiguous free space fragmentation. The ts# parametercorresponds to the ts# value found in the ts$ SYS table. In version 7.3 the ?altertablespace coalesce;? is best. If the free space isn?t contiguous then export,drop and import of the tablespace contents may be the only way to reclaim non-

    contiguous free space.

    18. How can you tell if a tablespace has excessive fragmentation?Level: IntermediateIf a select against the dba_free_space table shows that the count of atablespaces extents is greater than the count of its data files, then it isfragmented.

    19. You see the following on a status report:redo log space requests 23redo log space wait time 0

    Is this something to worry about? What if redo log space wait time is high? Howcan you fix this?Level: IntermediateExpected answer: Since the wait time is zero, no. If the wait time was high itmight indicate a need for more or larger redo logs.

    20. What can cause a high value for recursive calls? How can this be fixed?Level: High

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 24

  • 8/14/2019 7009909 DBA Fyicenter Faq

    25/39

    FAQ: DBA

    Expected answer: A high value for recursive calls is cause by improper cursorusage, excessive dynamic space management actions, and or excessive

    statement re-parses. You need to determine the cause and correct it By eitherrelinking applications to hold cursors, use proper space management techniques(proper storage and sizing) or ensure repeat queries are placed in packages forproper reuse.

    21. If you see a pin hit ratio of less than 0.8 in the estat library cache report is thisa problem? If so, how do you fix it?Level: IntermediateExpected answer: This indicate that the shared pool may be too small. Increasethe shared pool size.

    22. If you see the value for reloads is high in the estat library cache report is thisa matter for concern?Level: IntermediateExpected answer: Yes, you should strive for zero reloads if possible. If you seeexcessive reloads then increase the size of the shared pool.

    23. You look at the dba_rollback_segs view and see that there is a large numberof shrinks and they are of relatively small size, is this a problem? How can it befixed if it is a problem?Level: HighExpected answer: A large number of small shrinks indicates a need to increase

    the size of the rollback segment extents. Ideally you should have no shrinks or asmall number of large shrinks. To fix this just increase the

    1Differentiate between TRUNCATE and DELETE2. What is the maximum buffer size that can be specified using theDBMS_OUTPUT.ENABLE function?3. Can you use a commit statement within a database trigger?4. What is an UTL_FILE.What are different procedures and functions associatedwith it?

    5. Difference between database triggers and form triggers?6. What is OCI. What are its uses?7. What are ORACLE PRECOMPILERS?8. What is syntax for dropping a procedure and a function? Are these operationspossible?9. Can a function take OUT parameters. If not why?10. Can the default values be assigned to actual parameters?11. What is difference between a formal and an actual parameter?

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 25

  • 8/14/2019 7009909 DBA Fyicenter Faq

    26/39

    FAQ: DBA

    12. What are different modes of parameters used in functions and procedures?13. Difference between procedure and function.

    14. Can cursor variables be stored in PL/SQL tables.If yes how. If not why?15. How do you pass cursor variables in PL/SQL?16. How do you open and close a cursor variable.Why it is required?17. What should be the return type for a cursor variable.Can we use a scalardata type as return type?18. What is use of a cursor variable? How it is defined?19. What WHERE CURRENT OF clause does in a cursor?20. Difference between NO DATA FOUND and %NOTFOUND21. What is a cursor for loop?22. What are cursor attributes?23. Difference between an implicit & an explicit cursor.

    24. What is a cursor?25. What is the purpose of a cluster?26. How do you find the numbert of rows in a Table ?27. Display the number value in Words?28. What is a pseudo column. Give some examples?29. How you will avoid your query from using indexes?30. What is a OUTER JOIN?31. Which is more faster - IN or EXISTS?32. When do you use WHERE clause and when do you use HAVING clause?33. There is a % sign in one field of a column. What will be the query to find it?34. What is difference between SUBSTR and INSTR?

    35. Which datatype is used for storing graphics and images?36. What is difference between SQL and SQL*PLUS?37. What is difference between UNIQUE and PRIMARY KEY constraints?38. What is difference between Rename and Alias?39. What are various joins used while writing SUBQUERIES?

    Oracle DBA Interview Questions only

    1)what is the shared memory segment?

    we have to configure this parameter SHMMAX in kernel of unix to populate theSGA in the RAM.Becos SGA is also shared memory segment.

    2)How can you started your standby server?

    3)Why Becos after nomount stage of stanby server we have to mount as standbyserver.

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 26

  • 8/14/2019 7009909 DBA Fyicenter Faq

    27/39

    FAQ: DBA

    4)Installation of oracle on solaris platform witch file you have to modified first?/etc/system for configuration of kernel

    5)If your database is hanged and you can't connect thro' sqlplus how can youshutdown database?ipcs -s|grep $ORACLE_SID gives us semaphore segment set process id and wecan kill them with the ipcrm commands.

    6)What is the $0?shescript'name

    7)what is the $1?argument after shellscript'name

    8)What is the semaphore management?That is the internal latch contention and resource wait set of Unix

    9)when you used resetlogs and noresetlogs?When we performed complite recovery we can opened our database withnoresetlogs and when we performed incomplete recovery that time we have toopened our database with resetlogs.

    10)When you performed only one datafile recovery that time what u usedresetlogs or norestlogs?

    That is also part of the complete recovery we have to used the norestlogs

    11)But if you are issued the resetlogs then what you after it?Once resetlogs issued after that we have to take full cold backup.

    12)If our buffer cache hit ratio is 90% but system is going to slow how you canjudge that buffer cache is too small?from the v$waitstat in the data block contention.

    13)what is the 10046 event?That is the best practice for dba to understand system wait event created by

    query.

    14)What is the crontab?in Unix that is the utility for scheduling the process

    15)Whithout use of crontab witch command you used for this?at commend

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 27

  • 8/14/2019 7009909 DBA Fyicenter Faq

    28/39

    FAQ: DBA

    16)How you can check which oracle instance are populated in you server?ps -ef|grep ora|grep -g grep

    17)which file you have to modified when you intersted to set oracle instanceautomaticaly started?/etc/oratab

    18)what is the pctfree?

    19)what is the pctused?

    20)what is the optimal?

    21)what is the undo_retention?

    22)how you can fast process the import which has large index?to set sort_area_size more

    23)what is the parallel server?shared database with more than the 2 instance called parallel server.

    24)what is parallel query?server process spawn more than the one slave process and all slave fetch datafrom the disk.

    25)What is the SGA?

    26)What is the your present activities as DBA?

    27)Instance is started means what?

    28)How can you configured Backup stategy?

    29)What is the Hot Backup?

    30)In tunning how can you performed it?

    31)What is the OFA?

    32)Suppoce one of the your end user come to you and told you that his report ishanged what should you do?

    33)If you database is in no archivelog mode and you took backup yesterday andyour database size is 40gb very next day when you start database that time it

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 28

  • 8/14/2019 7009909 DBA Fyicenter Faq

    29/39

    FAQ: DBA

    gives error that one of the redolog file corrupted how can you recovered it?

    34)What is the buffer busy wait?

    35)when data block buffer has too many contention what to do?

    36)what is the localy managed tablespace?

    37)why freelist contention is occured?

    38)what is the row chaining and row migration? How can you judged it and tuneit?

    39)if your database size is more than the 100gb and running 24*7*365 howplanned to decide to take backup?

    40)what is the rollback segment contention?

    41)why we used undo_retention?

    42)if you got ora-1555 error snapshot too old what to do?

    43)If you give proper hint in sql query but when you check from the trace that hintis not working why?

    44)Give the parameter which is affected on Oracle block size.

    45)What is the pctthreshold?

    46)If you want to check disk io how to obtained it?

    47)To avoid sorting what to do?

    DBA Tasks, Responsibilities and Skills Required

    DBA Responsibilities:

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 29

  • 8/14/2019 7009909 DBA Fyicenter Faq

    30/39

    FAQ: DBA

    The job of the DBA seems to be everything that everyone else either doesn'twant to do, or doesn't have the ability to do. DBAs get the enviable task of

    figuring out all of the things no one else can figure out. More seriously though,here is a list of typical DBA responsibilities:. Installation, configuration and upgrading of Oracle server software and relatedproducts. Evaluate Oracle features and Oracle related products. Establish and maintain sound backup and recovery policies and procedures. Take care of the Database design and implementation. Implement and maintain database security (create and maintain users androles, assign privileges). Perform database tuning and performance monitoring. Perform application tuning and performance monitoring

    . Setup and maintain documentation and standards

    . Plan growth and changes (capacity planning)

    . Work as part of a team and provide 7x24 support when required

    . Perform general technical trouble shooting and give consultation todevelopment teams. Interface with Oracle Corporation for technical support.

    Required Skills:

    . Good understanding of the Oracle database, related utilities and tools

    . A good understanding of the underlying operating system

    . A good knowledge of the physical database design

    . Ability to perform both Oracle and operating system performance tuning andmonitoring. Knowledge of ALL Oracle backup and recovery scenarios. A good knowledge of Oracle security management. A good knowledge of how Oracle acquires and manages resources. A good knowledge Oracle data integrity. Sound knowledge of the implemented application systems. Experience in code migration, database change management and datamanagement through thevarious stages of the development life cycle

    . A sound knowledge of both database and system performance tuning

    . A DBA should have sound communication skills with management,development teams, vendorsand systems administrators. Provide a strategic database direction for the organisation. A DBA should have the ability to handle multiple projects and deadlines. A DBA should possess a sound understanding of the business

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 30

  • 8/14/2019 7009909 DBA Fyicenter Faq

    31/39

    FAQ: DBA

    Interview Questions

    1. Tell us about yourself/ your background.

    2. What are the three major characteristics that you bring to the job market?

    3. What motivates you to do a good job?

    4. What two or three things are most important to you at work?

    5. What qualities do you think are essential to be successful in this kind ofwork?

    6. What courses did you attend? What job certifications do you hold?

    7. What subjects/courses did you excel in? Why?

    8. What subjects/courses gave you trouble? Why?

    9. How does your previous work experience prepare you for this position?

    10.How do you define 'success'?

    11.What has been your most significant accomplishment to date?

    12.Describe a challenge you encountered and how you dealt with it.

    13.Describe a failure and how you dealt with it.

    14.Describe the 'ideal' job... the 'ideal' supervisor.

    15.What leadership roles have you held?16.What prejudices do you hold?

    17.What do you like to do in your spare time?

    18.What are your career goals (a) 3 years from now; (b) 10 years from now?

    19.How does this position match your career goals?

    20.What have you done in the past year to improve yourself?

    21.In what areas do you feel you need further education and training to besuccessful?

    22.What do you know about our company?23.Why do you want to work for this company. Why should we hire you?

    24.Where do you see yourself fitting in to this organization . . .initially? . . .in 5years?

    25.Why are you looking for a new job?

    26.Are you willing to travel?

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 31

  • 8/14/2019 7009909 DBA Fyicenter Faq

    32/39

    FAQ: DBA

    27.What are your salary requirements?

    28.When would you be available to start if you were selected?

    29.Did you use online or off-line backups?

    30.What version of Oracle were you running?

    31.Haw many databases and what sizes?

    32.If you have to advise a backup strategy for a new application, how wouldyou approach it and what questions will you ask?

    33.If a customer calls you about a hanging database session, what will youdo to resolve it?

    34.Compare Oracle to any other database that you know. Why would you

    prefer to work on one and not on the other?35.(Yes, there is a Rule 0!)

    For a system to qualify as a RELATIONAL, DATABASE, MANAGEMENTsystem, that system must use its RELATIONAL facilities (exclusively) toMANAGE the DATABASE.

    1. The information ruleThe information rule simply requires all information in the database to berepresented in one and only one way, Namely by values in columnpositions within rows of tables.

    2. The guaranteed access ruleThis rule is essentially a restatement of the fundamental requirement forprimary keys. It says that every individual scalar value in the databasemust be logically addressable by specifying the mane of the containingtable, the name of the containing column and thePrimary key value of the containing row.

    3. Systematic treatment of null valuesThe DBMS is required to support a representation of "missing informationand inapplicable Information" that is systematic, distinct from all regularvalues (for example, "distinct from zero or any other number," in the caseof numeric values), and independent of data type. It is also implied thatsuch representations must be manipulated by the DBMS in a systematicway.4. Active online catalog based on the relational modelThe system is required to support an online, inline, relational catalog thatis accessible to authorized users by means of their regular querylanguage.

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 32

  • 8/14/2019 7009909 DBA Fyicenter Faq

    33/39

    FAQ: DBA

    5. The comprehensive data sub language rule The system must support aleast one relational language that

    (a) Has a linear syntax,(b) Can be used both interactively and within application programs, and supports data definition operations (including view definitions), datamanipulation operations (update as well as retrieval), security and integrityconstraints, and transaction management operations (begin, commit, androllback).

    6. The view-updating ruleAll views that are theoretically up datable must be updatable by thesystem.

    7. High-level insert, update, and deleteThe system must support set-at-a-time INSERT, UPDATE, and DELETEoperators.8. Physical data independenceSelf-explanatory.

    9. Logical data independenceSelf-explanatory

    10. Integrity independenceIntegrity constraints must be specified separately from application

    programs and stored in the catalog. It must be possible to change suchconstraints as and when appropriate without unnecessarily affectingexisting applications.

    11. Distribution independence Existing applications should continue tooperate successfully(a) When a distributed version of the DBMS is first introduced;(b) When existing distributed data is redistributed around the system.

    12. The nonsubversion ruleIf the system provides a low-level (record-at-a-time) interface, then that

    interface cannot be used to subvert the system (e.g.) bypassing arelational security or integrity constraint.

    What is Data Warehousing?

    Data Warehousing is concerned with the activities involved with creating aDataRepository where you store all the facts you know about some largeenterprise or activity, and then analyse the data in different ways,to look for

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 33

  • 8/14/2019 7009909 DBA Fyicenter Faq

    34/39

    FAQ: DBA

    patterns on the data. Typically this is done by large retail organisations, trying toidentify patterns in buying behaviour so they can sell more stuff to the poor

    unsuspecting customer.The most commonly quoted example is that somewhere in the States theydiscovered that on Friday nights the sales of beer and diapers/nappies went up.The explanation seemed to be that men would call in to buy beer for theweekend and the wives would say "While you are in the supermarket,please pickup some diapers/nappies for the baby".As a result of this analysis they started putting diapers/nappies next to the beerand increased the sales of both items. TERMS IN COMMON USE in DW is: -Facts - for example, sales in a shop for the beer and nappies example.2) Dimensions - for example, date and time of purchase, product and productcategory.

    Then DW involves analyzing Facts by different combinations of Diumensions.For example, "When do we sell most beer? "And "When do we sell mostnappies" - then they find the answer to both of these is Friday evening -and heypresto they can make more money by making it easier for the beer-buyers to buynappies (and please the wife), and vice versa.From this example, you can see that most DW examples and work are prettyboring. A major growth area for DW at present is the storage and analysis of'clickstream data' of traffic on Internet Web Sites.This is typically used to identify hits and page impressions to determine howmany people will see a particular banner advertisement on the Web Site. Anexcellent book covering this very new area is "The Data Webhouse" by Ralph

    Kimball.3) OLAP: -OLAP stands for 'On-Line Analytical Processing, and the term was first used byDr.Ted Codd, of IBM Research, who was the father of the relational databaseand SQL.The beer and nappies example is a case of OLAP in practice.What it means is that you are online analyzing masses of data.Whereas the common use of databases is to store details of 'transactions' suchas Bank account details.OLAP requirements are not very well met by SQL so extensions have beendeveloped by the vendors of OLAP products, like Brio or Cognos.

    How do I set a database in archivelog or noarchivelog?

    1) shutdown the databasesql> shutdown2) startup the database in mount statesql> startup mount3) set the database in archivelog or noarchivelog

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 34

  • 8/14/2019 7009909 DBA Fyicenter Faq

    35/39

    FAQ: DBA

    sql> alter database archivelog | noarchivelog4) open the database

    sql> alter database open5) Take a full backup

    What are the different ways to stop an Oracle instance?

    There are 4 ways to shutdown an Oracle Instance,

    1) Normal2) Transactional3) Immediate4) Abort

    1) NormalDuring "normal" shutdown no new connections are allowed and the server willwait for all users to disconnect before shutting down. The redo buffers anddatabase buffer are written to the datafiles, then the variousbackgroundprocesses are terminated and the allocated memory for the SGAare de-allocated. Finally Oracle will close and dismount the database.

    2) TransactionalDuring "transactional" shutdown no new connections are allowed and the serverwill disconnect users as soon as they complete their current transaction. Afterthat Oracle will immediately shut down the Instance.

    3) ImmediateDuring "immediate" shutdown no new connections are allowed. The server willnot wait for clients to disconnect nor for transactions to complete and will do arollback if needed. So after disconnecting the clients and rolling back any activetransactions Oracle will shut down the Instance.4) AbortDuring abort" shutdown no new connections are allowed. The server will not waitfor connected users to disconnect, uncommitted transactions will not be rolled

    back redo and database buffers are "not" written to disk and the database is notclosed or dismounted. Instance recovery will be needed on the next startup.

    What are the responsibilities of the system monitor (SMON)?

    The system monitor is responsible for:

    1) Instance Recovery

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 35

  • 8/14/2019 7009909 DBA Fyicenter Faq

    36/39

    FAQ: DBA

    It rolls forward any data that has been recorded in the online redo log files but notto the data files.

    It opens the database and any data that is not locked by unrecoveredtransactions is available to the usersIt rolls back uncommitted transactions (rolled back by SMON or by the serverprocess as they access the locked data)2) Combining or coalesces free space in the data files3) Deallocates temporary segments to return them as free space in the data files.

    What does the Process monitor (PMON) do?

    The process monitor is responsible for: Rolling back the current user'stransaction after a failed process. Releasing all currently held table and row locks

    after a failed process. Freeing up other resources reserved by the user after afailed process. Restart dead dispatchers after a failed process.

    Why is a checkpoint initiated?

    A checkpoint is initiated to ensure that modified data in memory are written to thedatafiles on regular basis, so no data is lost during a crash or failure.A checkpoint is also initiated to reduce the time needed to do instance recovery.(Only from that (check)point redo log entries need to be processed).A checkpoint is initiated to ensure that all committed data has been written to thedata files when shutting down.

    1. How many memory layers are in the shared pool?

    2. How do you find out from the RMAN catalog if a particular archive log hasbeen backed-up?

    3. How can you tell how much space is left on a given file system and how muchspace each of the file systems subdirectories take-up?

    4. Define the SGA and:

    How you would configure SGA for a mid-sized OLTP environment? What is involved in tuning the SGA?

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

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

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 36

  • 8/14/2019 7009909 DBA Fyicenter Faq

    37/39

    FAQ: DBA

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

    8. How would you go about verifying the network name that the local_listiener iscurrently using?

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

    10. What view(s) do you use to associate a users SQLPLUS session with his o/sprocess?

    11. What is the recommended interval at which to run statspack snapshots, andwhy?

    12. What spfile/init.ora file parameter exists to force the CBO to make theexecution path of a given statement use an index, even if the index scan may

    appear to be calculated as more costly?

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

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

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

    16. In which dictionary table or view would you look to determine at which time a

    snapshot or MVIEW last successfully refreshed?17. How would you best determine why your MVIEW couldnt FAST REFRESH?

    18. How does propagation differ between Advanced Replication and SnapshotReplication (read-only)?

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

    20. How would you begin to troubleshoot an ORA-3113 error?

    21. Which dictionary tables and/or views would you look at to diagnose a lockingissue?

    22. An automatic job running via DBMS_JOB has failed. Knowing only that itsfailed, how do you approach troubleshooting this issue?

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

    24. Youre getting high busy buffer waits - how can you find whats causing it?

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

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 37

  • 8/14/2019 7009909 DBA Fyicenter Faq

    38/39

    FAQ: DBA

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

    27. Database crashes. Corruption is found scattered among the file systemneither of your doing nor of Oracles. What database recovery options areavailable? Database is in archive log mode.

    28. Illustrate how to determine the amount of physical CPUs a Unix Boxpossesses (LINUX and/or Solaris).

    29. How do you increase the OS limitation for open files (LINUX and/or Solaris)?

    30. 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.

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

    32. How does Oracle guarantee data integrity of data changes?

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

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

    35. Why does Oracle not permit the use of PCTUSED with indexes?

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

    37. What would you do with an in-doubt distributed transaction?38. What are the commands youd issue to show the explain plan for select *from dual?

    39. In what script is snap$ created? In what script is the scott/tiger schemacreated?

    40. If youre unsure in which script a sys or system-owned object is created, butyou know its in a script from a specific directory, what UNIX command from thatdirectory structure can you run to find your answer?

    41. How would you configure your networking files to connect to a database bythe name of DSS which resides in domain icallinc.com?

    42. You create a private database link and upon connection, fails with: ORA-2085: connects to . What is the problem? How would you go about resolving thiserror?

    43. I have my backup RMAN script called backup_rman.sh. I am on the targetdatabase. My catalog username/password is rman/rman. My catalog db is calledrman. How would you run this shell script from the O/S such that it would run asa background process?

    Please visit us: Transsglobalsolutions.com ver: rel 1.0 38

  • 8/14/2019 7009909 DBA Fyicenter Faq

    39/39

    FAQ: DBA

    44. Explain the concept of the DUAL table.

    45. What are the ways tablespaces can be managed and how do they differ?

    46. From the database level, how can you tell under which time zone a databaseis operating?

    47. Whats the benefit of dbms_stats over analyze?

    48. Typically, where is the conventional directory structure chosen for Oraclebinaries to reside?

    49. You have found corruption in a tablespace that contains static tables that arepart of a database that is in NOARCHIVE log mode. How would you restore thetablespace without losing new data in the other tablespaces?

    50. How do you recover a datafile that has not been physically been backed upsince its creation and has been deleted. Provide syntax example.

    51 What is your database size?

    52 Do you know shell script?

    53 What are the problems u faced as a DBA explain briefly?

    54.Did you apply any patches? Oracle?

    55 How you copy the archivelogs? Manually or script? If it is 24x7?

    56.Do you know shell script?

    57.Will u clear Archivelog files frequently?