Thursday 12 September 2013

Oracle DBA Interview Questions and Answers-3


Page-3

31: Give some examples of the types of database constraints you may find in Oracle and indicate their purpose.
A : A Primary or Unique Key can be used to enforce uniqueness on one or more columns.
A Referential Integrity Constraint can be used to enforce a Foreign Key relationship between two tables.
A Not Null constraint - to ensure a value is entered in a column
A Value Constraint - to check a column value against a specific set of values.

32: 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?
A : Disable the foreign key constraint to the parent, drop the table, re-create the table, enable the foreign key constraint.

33: Explain the difference between ARCHIVELOG mode and NOARCHIVELOG mode and the benefits and disadvantages to each.
A : 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 can recover to any point in time. NOARCHIVELOG mode is basically the absence of ARCHIVELOG mode and has the disadvantage of not being able to recover to any point in time. NOARCHIVELOG mode does have the advantage of not having to write transactions to an archive log and thus increases the performance of the database slightly.

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

35: Give the stages of instance startup to a usable state where normal users may access it.
A: STARTUP NOMOUNT - Instance startup
STARTUP MOUNT - The database is mounted
STARTUP OPEN - The database is opened

36: What column differentiates the V$ views to the GV$ views and how?
A : The INST_ID column which indicates the instance in a RAC environment the information came from.

37: How would you go about generating an EXPLAIN plan?
A : 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.sql

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

39: Explain an ORA-01555.
A : You get this error when you get a snapshot too old within rollback. It can usually be 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 error message.

40: Explain the difference between $ORACLE_HOME and $ORACLE_BASE.
A : ORACLE_BASE is the root directory for oracle. ORACLE_HOME located beneath ORACLE_BASE is where the oracle products reside.


41: Explain the use of setting GLOBAL_NAMES equal to TRUE.
A : It ensure the use of consistent naming conventions for databases and links in a networked environment.

42: Explain the difference between a FUNCTION, PROCEDURE and PACKAGE.
A : They are all named PL/SQL blocks.
Function must return a value. Can be called inside a query.
Procedure may or may not return value.
Package is the collection of functions, procedures, variables which can be logically grouped together.

43: What background process refreshes materialized views?
A : Job Queue Process (CJQ)

44: How would you determine what sessions are connected and what resources they are waiting for?
A : v$session,v$session_wait

45: How would you force a log switch?
A : alter system switch logfile;

No comments:

Post a Comment

Ask your Questions....