13499941 oracle dba interview question2

Upload: mansvi

Post on 29-May-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 13499941 Oracle DBA Interview Question2

    1/15

  • 8/9/2019 13499941 Oracle DBA Interview Question2

    2/15

    The major difference between varchar2 and char is fixed length and variable length. Varchar2 have variablelength mean if we declare as 20 space and its use only 5 space the memory assign only 5. But in char takesdaclare space while use any number space less than declare

    6.what are the difference between and constraints and triggers?

    Constraints are used to maintain the integrity and atomicity of database .in other words it can be said they areused to prevent invalid data entry. The main 5 constraints are

    NOT NULL, PRIMARY KEY, FOREIGN KEY, UNIQUE KEY and CHECK

    Triggers are basically stored procedures, which automatically fired when any insert, update or delete is issuedon table

    Another most imp. Diff. is that trigger effected only those row after which trigger applied but constrainteffected all row of table.

    7.what is normalization? What is the advantage of normalization (briefly)

    1.The process of separating data into distinct, unique sets is called normalization. This is implemented toimprove the performance of the RDBMS, such as reduces redundancy of data and data inconsistency.

    2.Normalization is the process of removing redundant data from your tables in order to improve storageefficiency, data integrity and scalability.

    3.Database normalization is a series of steps followed to obtain a database design that allows for consistentstorage and efficient access of data in a relational database. These steps reduce data redundancy and the risk ofdata becoming inconsistent.

    4.Normalization is the process used to reduce the unnecessary repetition of data i.e., redundant data. It isperformed on the data, which is redundant and makes the data in a normalized format. It is of step-by-stepprocess IstNotmal, FormIIndNormal, formIIIrdNormal, formIVthNormal form or Boyce odd Normal form By

    performing this we will get the data in the Normalized formati.,e from DBMS to RDBMS.

    8.How the logs are escalated?

    There are different types are logs which are logged by Oracle Database Engine. A DBA has to look in for alterlog which exist background dump dust. The seviourity of the problem are analysed and escalated based on theinformation provided by the alter log.

    9.What is structure of Database?

    1.Oracle database usually contains one database and a single instance. But, Oracle 9i, 10g RAC (Real

    Application Clusters) can have multiple instances to interact with a single database for high availability.Instance is non-persistent, memory based background processes and structures.Database is persistent, disk based, data and control files

    2.Physical Structure of Database:One or more data files, control file(s), Redo log file(s) and init.ora fileLogical Structure of Database:Table spaces, segments, extents, blocks

    10.what is the difference between primary key, unique key, and surrogate key?

    Primary Key: A column in a table whose values uniquely identify the rows in the table. A primary key valuecannot be NULL.

    Unique Key: Unique Keys are used to uniquely identify each row in an Oracle table. There can be one andonly one row for each unique key value.

  • 8/9/2019 13499941 Oracle DBA Interview Question2

    3/15

    Surrogate Key: A system generated key with no business value. Usually implemented with database-generatedsequences.

    Primary Key Unique key1.There is only one 1. There may be more than 1

    Primary key for I table Unique Key in table

    2.It can contain Null Value 2. It can contain Null Value1. what are the diffrent file types that are supported by SQL*Loader?

    a.direct method (skips dbcache, no redo generation)

    b. conventional method (just opposite of direct load)

    2.How to find how many database reside in Oracle server in query?

    select count(*) from v$database;

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

    CBO (Cost Based Optimizer): Generates an execution plan for a SQL statementOptimizer_index_cost_adj parameter can be set to help CBO to decide an execution plan, which affectsthe speed of SQL query. We can also make necessary changes to the following parameters to effectCBO performance:Optimizer_search_limit & optimizer_max_permutations

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

    The shared pool portion of the SGA contains three major areas: library cache, dictionary cache, buffersfor parallel execution messages, and control structures.

    5.What are the attributes of the Virtual Indexes?

    a. These are permanent and continue to exist unless we drop them.

    b. Their creation will not affect existing and new sessions. Only sessions marked for Virtual Indexusage will become aware of their existence.

    c. Such indexes will be used only when the hidden parameter "_use_nosegment_indexes" is set totrue.

    d. The Rule based optimizer did not recognize Virtual Indexes when ITested, however, CBO recognizes them. In all of my examples, I have used CBO. However, I did notcarry out intensive testing in RBO and you may come across exceptions to this view.

    d. Dictionary view DBA_SEGMENTS will not show an entry for Virtual Indexes. The tableDBA_INDEXES and DBA_OBJECTS will have an entry for them in Oracle 8i; in Oracle 9ionwards, DBA_INDEXES no longer show Virtual Indexes.

    e. Virtual Indexes cannot be altered and throw a "fake index" error!f. Virtual Indexes can be analyzed, using the ANALYZE command or DBMS_STATS package, but thestatistics cannot be viewed (in Oracle 8i, DBA_INDEXES will not show this either). Oracle may begenerating artificial statistics and storing it somewhere for referring it later.Creating Virtual Index

  • 8/9/2019 13499941 Oracle DBA Interview Question2

    4/15

    Creating a Virtual Index can be achieved by using the NOSEGMENT clause with the CREATEINDEX command.

    6.What is meant by Virtual Indexes in Oracle?

    Virtual Indexes are another undocumented feature used by Oracle. Virtual indexes, as the namesuggests are pseudo-indexes that will not behave the same way that normal indexes behave, and are

    meant for a very specific purpose. A virtual index is created in a slightly different manner than thenormal indexes. A virtual index has no segment pegged to it, i.e., the DBA_SEGMENTS view will notshow an entry for this.

    Oracle handles such indexes internally and few required dictionary tables are updated so that theoptimizer can be made aware of its presence and generate an execution plan considering suchindexes.As per Oracle, this functionality is not intended for standalone usage. It is part of the OracleEnterprise Manger Tuning Pack (Virtual Index Wizard).

    The virtual index wizard functionality allows the user to test a potential new index prior to actuallybuilding the new index in the database.It allows the CBO to evaluate the potential new index for aselected SQL statement by building an explain plan that is aware of the potential new index.

    This allows the user to determine if the optimizer would use the index, once implemented.

    7.What are materialized views? When are they used?

    Materialized view is like a view but stores both definition of a view plus the rows resulting fromexecution of the view. It uses a query as the bases and the query is executated at the time the view iscreated and the results are stored in a table. You can define the Materialized view with the same storage

    parametes as any other table and place it in any tablespace of your choice. You can also index andpartition the Materialized view table like other tables to improve performance of queries executed

    aginst them.

    Use of Meterialized view:-

    Expensive operations such as joins and aggregations do not need to be re executed.If the query is astisfied with data in a Meterialized view, the server transforms the query to referencethe view rather than the base tables.

    8.What is a functional index - explain?

    Function-based indexes can use any Function or Object method that is declared as repeatable.Queries using expressions can use the index.

    Ex: - CREATE INDEX sales_margin_inxON sales (revenue - cost);

    Sql> SELECT ordidFROM salesWHERE (revenue - cost) > 1000;We have to enable Function-based indexes by enableing the following initialization parametersALTER SESSION SET QUERY_REWRITE_ENABLED = TRUE;ALTER SESSION SET QUERY_REWRITE_INTEGRITY = TRUSTED;

    9.Where we use bitmap index?

    a. Bitmap indexes are most appropriate for columns having low distinct values.b. We can use bitmap index where cardinality is very low like gender column or color column.

    10.What is an extent?

  • 8/9/2019 13499941 Oracle DBA Interview Question2

    5/15

    a. An extent is the smallest unit of storage allocation comprising collection of Blocks.b. Well an extent is a chunk of a space that is used by database segments when a segment is created itallocates extents.

    11.How to you move from dedicated server Process to a Shared Server Process

    Use DBCA (DATABASE CONFIGUARATION ASSISTANT) toolYou will get the option to selectshared server mode.

    12.What are the components of physical database structure of Oracle database?

    A. Totally there are 6 files (components) of physical database structure.3 mandatory & 3 optional.Three mandatory files are

    1> data file: store actual data2> control file: stores structural & status information of database.3> redo log file: stores changed/committed data

    Three optional files are4>-parameter file: stores all size related parameters note: this file is mandatory for a1st time ucreate a database, and then it is optional.5> archive log file: its offline copy of redo log files6>-password file: used to make normal user to behave as a super user.

    b. 1. Control files2. Init file3. Log files 4. Redo/archive log files 5. data files

    C. Physical components of oracle database are control files, redo log files and datafiles.Control file: control file is read in the mount state of database. Control file is a small binary file, whichrecords the physical structure of database, which includesDatabase name

    Names and locations of datafiles and online redo log files. Timestamp of database creationCheckpoint information current logs sequence number.

    Redo log files: This files saves all the changes that are made to the database as they occur. This plays agreat role in the database recovery.

    Datafiles: datafiles are the physical files, which stores data of all logical structure.

    11.What are the components of logical database structure of Oracle database

    Tablespace, segments, extents, data Blocks.

    A logical unit of storage of database is called Tablespace.

    A segment is a space allocated for a specific logical storage structure within a tablespace.

    Extents: Space allocated to a segments.

    Datablocks: Oracle server manage the storage space in the datafiles in units is called data blocks ororacle blocks.

    12.What are the different types of segments?

    table segment, index segment, IOT, cluster, temp segment, data segment.

    13.Can you name few DBMS packages and their use?

    DBMS_OUTPUT.PUT_LINE ('strings');Print out the stringsDBMS_UTILITY.get_time ()

  • 8/9/2019 13499941 Oracle DBA Interview Question2

    6/15

    get the current timeDBMS_ALERT

    e.g begindbms_alert.register('myregister');end

    To register interst in a named alert

    14.How can be determine the size of the log files.

    Select sum (bytes)/1024/1024 size_in_mb from v$log;

    15.How can be determine the size of the database?

    A. Select sum (bytes)/1024/1024/1024 Size_in_GB from dba_data_files;

    B. Select sum (bytes)/1024/1024 from v_$datafile + select sum (bytes)/1024/1024 from v_$logfile willgive u the total size of the database

    C. Select (select sum (bytes/1024/1024/1024) from v$datafile) +( select sum(bytes/1024/1024/1024)from v$tempfile) + (select sum(bytes/1024/1024/1024) from v$log) "Size of Database in GB" fromdual.

    16. How can you check which user has which Role.

    desc dba_tab_privs (OR) Can use ROLE_TAB_PRIVS also (OR) select * from dba_role_privs orderby grantee;

    17. Can you start a database without SPfile in oracle 9i?

    While starting database Oracle reads spfiledb.ora, spfile.ora, initdb.ora or init.ora file. Yes it is possibleto start the database using init.ora file only. The main advantage of using the SPFILE.ora is only tomake changes to the dynamic initialization parameters without restarting the database using the

    SCOPE option. The changes will be stored in the spfile only and if you start the database using "pfile"option those changes wont be applicable to the database.

    18.Do a view contain data?

    A view does not contain any data of its own, but is like a window through which data from other tablescan be viewed and changedThe answer depends on the type of view. In case of normal view, the ans is NO it only contains query

    based on a base table but in case of materialized view, YES it does contain data and for the updateddata in the base table, it needs to be refreshed.

    NO: Because view is for view one or more tables data like query.

    19.What is Oracle table?

    A table is the most commonly used form of storing user data.A table is used to store the information in form of rows &columns in the database.Table is a segment (type of Segments), which is used to store user data. Tables can have partitions(value wise, date period wise) and each partition can have separate tablespace for better performance.The Collection of informations stored in the structured format that is called a table.

    20.Can objects of the same schema reside in different tablespaces?

  • 8/9/2019 13499941 Oracle DBA Interview Question2

    7/15

    Yes, it can. For example if you specify a different tablepace (B) for indexes, the indexes of the tablesthat the user create would be residing in B, and the table would reside in the user's default tablespaceA.

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

    21.What is an Oracle index?

    An Index is a tree structure that allows direct access to a row in a table. Indexes can be classified basedon their logical design or on their physical implementation.The Logical classification groups indexes from an application perspective, while the physicalclassification is derived from the way the indexes are stored

    An index is a schema object that can speed up the retrieval of rows by using pointers. If you do nothave an index, then a full table scan occurs. Its purpose is to reduce disk I/O by using an indexed pathto locate data quickly. If a table is dropped, the corresponding indexes are also dropped.

    It is created in existing table to locate rows more quickly&efficiently. The users cannot see the indexes;they are just used to speed up the queries

    22.Can we create index on long raw column?

    NO we can't create index on long raw column.

    23.What is 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 contains - Multiple users/schema's- One or more rollback segments- One or more tablespaces- Data dictionary tables.User objects (table, indexes, views etc.)

    24.What are clusters?

    Groups of tables physically stored together because they share common columns and are often usedtogether is called clusters.

    25.What is the function of redo log?

    The primary function of the redo log is to record all changes made to data.

    26.What are the characteristics of data files?

    Characterstics of Data File:- A Data file can be associated with only one database.- Once created, a data file cannot change is size.- One or more data files form a logical unit of database storage called a Tablespace.

    Datafile size can be change by using ALTER DATABASE .................RESIZE command.

  • 8/9/2019 13499941 Oracle DBA Interview Question2

    8/15

    ORACLE DBA INTERVIEW QUESTIONS

    1.What is a temporary segment

    Temporary Segments are created by ORACLE when a SQL statement needs a temporary work area tocomplete execution. When the statement finishes execution, the temporary segments extents are released to thesystem for future use.

    2.What are the uses of rollback segment

    The use of RollBack Segment is Database is - to maintain read consistency between multiple transactions.

    3.What process writes from data files to buffer cache?

    Server Process (OR) it is an server process not DBWR(DataBase Writer)

    4.What is a redo log?Redo log contains the before and after image copies of changed data.

    5.What is a 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 tothe database. Whenever a transaction is committed, the corresponding redo entries temporarily stores in redolog buffers of the SGA are written to an on-line redo log file by the background process LGWR. Theon-line redo log files are used in cyclical fashion..

    6.What does LGWR do ?It is one of the main background process in oracle . In oracle and unix environment you can check this processusing ps -ef |pg command . which is writting all the uncommited transaction from SGA to redologfile . (or)

  • 8/9/2019 13499941 Oracle DBA Interview Question2

    9/15

    Log Writer (LGWR) writes redo log entries generated in the redo log buffer of the SGA to on-line Redo LogFile.

    7.Name init.ora parameters which effects system performance.

    These are the Parameters for init.ora

    DB_BLOCK_BUFFERSSHARED_POOL_SIZESORT_AREA_SIZEDBWR_IO_SLAVESROLLBACK_SEGMENTSSORT_AREA_RETAINED_SIZEDB_BLOCK_LRU_EXTENDED_STATISTICSSHARED_POOL_RESERVE_SIZE

    8.What is a database instance and Explain

    An Oracle instance is a combination of background processes and memory structures (SGA).

    9.What are the Advantages of Using DBCA

    These are a few of the advantages of using DBCA:

    You can use its wizards to guide you through a selection of options providing an easy means of creating andtailoring your database. It allows you to provide varying levels of detail. You can provide a minimum of inputand allow Oracle to make decisions for you, eliminating the need to spend time deciding how best to set

    parameters or structure the database. Optionally, it allows you to be very specific about parameter settings and

    file allocations.

    It builds efficient and effective databases that take advantage of Oracle's new features.

    It uses Optimal Flexible Architecture (OFA), whereby database files and administrative files, includinginitialization files, follow standard naming and placement practices

    10.How do you find whether the instance was started with pfile or spfile

    There are 3 different ways :-

    1) SELECT name, value FROM v$parameter WHERE name = 'spfile'; //This query will return NULL if youare using PFILE

    2) SHOW PARAMETER spfile // This query will returns NULL in the value column if you are using pfile andnot spfile

    3) SELECT COUNT(*) FROM v$spparameter WHERE value IS NOT NULL; // if the count is non-zero thenthe instance is using a spfile, and if the count is zero then it is using a pfile:By Default oracle will look into the default location depends on the o/s. Like in unix, oracle will check in$oracle_home/dbs directory and on windows it will check in oracle_home/database directory, and the content

    of pfile is just text based, but spfile content is in binary format, that is understandable by oracle very well.

    Also oracle server always check the spfile or pfile with these sequence :-

    SPFILE.ORA, SPFILE.ORA, PFILE.ORA,PFILE.ORA

  • 8/9/2019 13499941 Oracle DBA Interview Question2

    10/15

    11.What is an index segmentOracle creates the index segment for an index or an index partition when you issue the CREATE INDEXstatement. In this statement, you can specify storage parameters for the extents of the index segment and atablespace in which to create the index segment. (The segments of a table and an index associated with it donot have to occupy the same tablespace.) Setting the storage parameters directly affects the efficiency of data

    retrieval and storage

    12.What is public database link

    You can create a public database link for a database. All users and PL/SQL subprograms in the database canuse a public database link to access data and database objects in the corresponding remote database.When many users require an access path to a remote Oracle database, an administrator can create a single

    public database link for all users in a database.CREATE PUBLIC DATABASE LINK ...;

    13.What is row chaining

    if any of the empty row is not sufficient to hold the row. then row is placed in multiple blocks. it happeneswhen the block size is small and rows are of large size. then it cause chaining. Due to chaining performancedegrades and will cause more IOs

    14.What is the use of control file

    Control file is binary file which is having all the information realted to database. db_name, maxlogfiles,maxdatafiles, tablespaces information. Without this u cannot open your database. Init.ora parameter fileshowing the location of the controlfile. (or)control file is a binary file which contains db_name,dbcreated,checkpoint information,datafiles and logfiles.

    15.What is a tablespaceTablespace is nothing but a logical object comprisiing of one or more data files which actually stores the data.(or) A tablespace is a collection of one or more datafile.

    16.What is SYSTEM tablespace and when is it createdSYSTEM TABLESPACE USAGE NOTES:

    Username - Name of the user

    Created - User creation dateProfile - Name of resource profile assigned to the userDefault Tablespace - Default tablespace for data objectsTemporary Tablespace - Default tablespace for temporary objects

    Only SYS, SYSTEM and possibly DBSNMP should have their default tablespace set to SYSTEM.

    select USERNAME,CREATED,PROFILE,DEFAULT_TABLESPACE,

    TEMPORARY_TABLESPACEfrom dba_usersorder by USERNAME

  • 8/9/2019 13499941 Oracle DBA Interview Question2

    11/15

    Objects in SYSTEM TSOBJECTS IN SYSTEM TABLESPACE NOTES:

    Owner - Owner of the objectObject Name - Name of objectObject Type - Type of objectTablespace - Tablespace name

    Size - Size (bytes) of object

    Any user (other than SYS, SYSTEM) should have their objects moved out of the SYSTEM tablespace

    select OWNER,SEGMENT_NAME,SEGMENT_TYPE,TABLESPACE_NAME,BYTESfrom dba_segmentswhere TABLESPACE_NAME = 'SYSTEM'and OWNER not in ('SYS','SYSTEM')order by OWNER, SEGMENT_NAME

    17.How to define data block size

    The primary block size is defined by the Initialization parameter DB_BLOCK_SIZE.

    18.What is an Oracle sequence

    A sequence is a database object created by a user that can be used to generate unique integers. A typical usageof sequences is to generate primary key values which are unique for each row.It is generated and incremented (or decremented) by an internal Oracle routine. It can be used by multiple users

    and for multiple tables too. A sequence can be used instead of writing an application code for sequence-generating routine.

    19.Explain the relationship among database, tablespace and data file.What is schemaDatabases, tablespaces and datafiles are closely related, but they have important differences:

    --- A Oracle Database consists of one or more tablespaces--- Each Table space in an Oracle database consists of one or more files called datafiles.--- A database's data is collectively stored in the datafiles that constitute each tablespace of the database

    (or)When a database user is created, a corresponding schema with the same name is created for that user. A schemais a named collection of objects that include Tables, Triggers, constraints, Indexes, Views etc. A user can only

    be associated with one schema, and that is the same name as the user's. Username and schema are often usedinterchangeably.

    20.DIFFERENTIATE BETWEEN Latches vs Enqueues

    Enqueues are another type of locking mechanism used in Oracle. An enqueue is a more sophisticated

    mechanism which permits several concurrent processes to have varying degree of sharing of "known"resources. Any object which can be concurrently used, can be protected with enqueues. A good example is oflocks on tables. We allow varying levels of sharing on tables e.g. two processes can lock a table in share modeor in share update modeetc.

  • 8/9/2019 13499941 Oracle DBA Interview Question2

    12/15

    One difference is that the enqueue is obtained using an OS specific locking mechanism. An enqueue allows theuser to store a value in the lock, i.e the mode in which we are requesting it. The OS lock manager keeps trackof the resources locked. If a process cannot be granted the lock because it is incompatible with the moderequested and the lock is requestedwith wait, the OS puts the requesting process on a wait queue which is serviced in FIFO.Another difference between latches and enqueues is that in latches there is no ordered queue of waiters like inenqueues.

    Latch waiters may either use timers to wakeup and retry or spin (only in multiprocessors). Since all waiters areconcurrently retrying (depending on the scheduler), anyone might get the latch and conceivably the first one totry might be the last one to get.

    21.What is a latch?

    Latches are low level serialization mechanisms used to protect shared data structures in the SGA. Theimplementation of latches is operating system dependent, particularly in regard to whether a process will waitfor a latch and for how long.

    A latch is a type of a lock that can be very quickly acquired and freed. Latches are typically used to preventmore than one process from executing the same piece of code at a given time. Associated with each latch is acleanup procedure that will be called if a process dieswhile holding the latch. Latches have an associated level that is used to prevent deadlocks. Once a processacquires a latch at a certain level it cannot subsequently acquire a latch at a level that is equal to or less thanthat level (unless it acquires it nowait).

    What is difference between Logical Standby Database and Physical Standby database?

    The primary functional difference between logical and physical standby database setups is that logical standby

    permits you to add additional objects (tables, indexes, etc) to the database, while physical standby is always anexact structural duplicate of the master database. The downside, though, is that logical standby is based onnewer technologies (logical standby is new in Oracle 9.2) and tends to be generally regarded as moretempramental than physical standby.

    22.What is the frequency of log Updated..?

    1.COMMIT or ROLLABCK2.time out occurs (3 secs)3 1/3 of log is full

    4.1 mb of redo5. Checkpoint occurs23.How do you pin an object.

    Use dbms_shared_pool procedure.EXECUTE DBMS_SHARED_POOL.KEEP(OBJECTNAME);

    24.How do you rename a database?--------------------------------------------------------------------------------

    -- To change the name of the database-- For this script to run properly do the following:

    -- Backup the Control file to Trace

  • 8/9/2019 13499941 Oracle DBA Interview Question2

    13/15

    ALTER DATABASE BACKUP CONTROLFILE TO TRACE;

    -- Shutdown the database to make the changesSHUTDOWN IMMEDIATE;

    -- Edit the trace file and change the CREATE CONTROLFILE command-- CREATE CONTROLFILE REUSE SET DATABASE "NEW_SID_NAME" RESETLOGS-- (note the SET keyword)

    Change the name in Control file and Init.oraThe first line of Control file should be "CREATE CONTROLFILE REUSE SET DATABASE "" RESETLOGSARCHIVELOG"

    - modify the db_name parameter in the init.ora

    -- Startup the datbase nomount with changed PFileSTARTUP NOMOUNT;

    -- Execute the create controlfile command.@create_control.sql;

    -- Cancel base recovery of the databaseRecover database USING BACKUP CONTROLFILE until cancel;CANCEL

    -- Open resetlogs the databaseALTER DATABASE OPEN RESETLOGS;

    -- Rename GLOBAL_NAME toALTER DATABASE RENAME GLOBAL_NAME TO ;

    -- Create SPFile, IF required give NAME and PATH of the PFILECREATE SPFILE FROM PFILE;

    select name from v$database;

    (or)

    You can change Database my by simple do some steps.

    1. Alter Database backup control file to trace;2. Above step will create a text control file.

    3. Change the Database name there and in init.ora file.4. create new control file by running script (from backup control file)5. Startup mount6.open database resetlogs.And your database name will be changed

    25.What is the use of redo log informationRedo log information are used to recover database if it get currept.

    26.Explain Oracle memory structure.

    The Oracle RDBMS creates and uses storage on the computer hard disk and in random access memory(RAM). The portion in the computers RAM is called memory structure. Oracle has two memory structures inthe computers RAM. The two structures are the Program Global Area (PGA) and the System Global Area(SGA).

  • 8/9/2019 13499941 Oracle DBA Interview Question2

    14/15

    The PGA contains data and control information for a single, user process. The SGA is the memory segmentthat stores data that the user has retrieved from the database or data that the user wants to place into thedatabase

    27.What are memory structures in Oracle?

    The basic memory structures associated with Oracle include: System Global Area (SGA), which is shared by all server and backgroundprocesses and holds the following:o Database buffer cacheo Redo log buffero Shared poolo Large pool (if configured) Program Global Areas (PGA), which is private to each server and background

    process; there is one PGA for each process. The PGA holds the following:o Stack areaso Data areas

    28.State new features of Oracle 9i.1. Dynamic Memomry Management2. Default tablespace at the db levele3. temporary tablespace at the dba level4. Undo tablespace managemnet (auto/manual)

    29.What does database do during mounting process?During database mount process, Oracle would check for the existence of controlfiles mentioned in init.ora file

    but it wont check the contents of the controlfile which is done during the opening of database.

    30.What is the view name where i can get the space in MB for tables or views?

    select segment_name,sum(bytes) from dba_segmentswhere segment_name='TABLE_NAME' ANDOWNER='OWNER of the table'group by segment_name

    31.How to DROP an Oracle Database?

    You can do it at the OS level by deleting all the files of the database. The files to be deleted can be found

    using:

    1) select * from dba_data_files;2) select * from v$logfile;3) select * from v$controlfile;4) archive log list5) initSID.ora6) In addition you can clean the UDUMP, BDUMP, scripts etc

    Clean up the listener.ora and the tnsnames.ora. make sure that the oratab entry is also removed. (or)Go To Dbca And Click On Delete Database

    32.What is Parallel Server ?

    Multiple instances accessing the same database (Only In Multi-CPU environments)

  • 8/9/2019 13499941 Oracle DBA Interview Question2

    15/15

    33.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.,)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

    34.What is a deadlock ? Explain .

    Two processes wating 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.These locks will be released automatically when a commit/rollback operation performed or any one of this

    processes being killed externally.(OR)

    A deadlock is a condition where two or more users are waiting for data locked by each other. Oracleautomatically detects a deadlock and resolves them by rolling back one of the statements involved in thedeadlock, thus releasing one set of data locked by that statement. Statement rolled back is usually the onewhich detects the deadlock. Deadlocks are mostly caused by explicit locking because oracle does not do lockescalation and does not use read locks. Multitable deadlocks can be avoided by locking the tables in sameorder in all the applications, thus precluding a deadlock.

    (OR)System waiting for an event that may or may not happens and can be rectified using round robin algorithmwhich implemented internally by operating systems