Tuesday, August 16, 2011

RDBMS - Part 2

1.      What are cursors give different types of cursors.
PL/SQL uses cursors for all database information accesses statements. The language supports the use two types of cursors
Ø  Implicit
Ø  Explicit

2.      What is cold backup and hot backup (in case of Oracle)?
Ø  Cold Backup:
It is copying the three sets of files (database files, redo logs, and control file) when the instance is shut down. This is a straight file copy, usually from the disk directly to tape. You must shut down the instance to guarantee a consistent copy.
If a cold backup is performed, the only option available in the event of data file loss is restoring all the files from the latest backup. All work performed on the database since the last backup is lost.
Ø  Hot Backup:
Some sites (such as worldwide airline reservations systems) cannot shut down the database while making a backup copy of the files. The cold backup is not an available option.
So different means of backing up database must be used — the hot backup. Issue a SQL command to indicate to Oracle, on a tablespace-by-tablespace basis, that the files of the tablespace are to backed up. The users can continue to make full use of the files, including making changes to the data. Once the user has indicated that he/she wants to back up the tablespace files, he/she can use the operating system to copy those files to the desired backup destination.
The database must be running in ARCHIVELOG mode for the hot backup option.
If a data loss failure does occur, the lost database files can be restored using the hot backup and the online and offline redo logs created since the backup was done. The database is restored to the most consistent state without any loss of committed transactions.

3.      What are Armstrong rules? How do we say that they are complete and/or sound
The well-known inference rules for FDs        
Ø  Reflexive rule : 
                                    If Y is subset or equal to X then X       Y.
Ø  Augmentation rule:
                                    If X       Y then XZ       YZ.
Ø  Transitive rule:
                                    If  {X      Y, Y       Z} then X        Z.
Ø  Decomposition rule :
                                    If X       YZ then X      Y.
Ø  Union or Additive rule:
                                    If {X      Y, X        Z} then X       YZ.
Ø  Pseudo Transitive rule :
                                    If {X      Y, WY         Z} then WX        Z.
            Of these the first three are known as Amstrong Rules. They are sound because it is enough if a set of FDs satisfy these three. They are called complete because using these three rules we can generate the rest all inference rules.

4.      How can you find the minimal key of relational schema?
Minimal key is one which can identify each tuple of the given relation schema uniquely. For finding the minimal key it is required to find the closure that is the set of all attributes that are dependent on any given set of attributes under the given set of functional dependency.
            Algo. I Determining X+, closure for X, given set of FDs F
1.      Set X+ = X
2.      Set Old X+ = X+
3.      For each FD  Y        Z in F and if  Y belongs to X+ then add Z to X+
4.      Repeat steps 2 and 3 until Old X+  = X+

Algo.II Determining minimal K for relation schema R, given set of FDs F
1.      Set K to R that is make K a set of all attributes in R
2.      For each attribute A in K
a.       Compute (K – A)+ with respect to F
b.      If  (K – A)+ = R then set K = (K – A)+


5.      What do you understand by dependency preservation?
Given a relation R and a set of FDs F, dependency preservation states that the closure of  the union of the projection of F on each decomposed relation Ri is equal to the closure of F. i.e.,
((PR1(F))  U … U (PRn(F)))+ =  F+
 if decomposition is not dependency preserving, then some dependency is lost in the decomposition.

6.      What is meant by Proactive, Retroactive and Simultaneous Update.
Proactive Update:
            The updates that are applied to database before it becomes effective in real world .
Retroactive Update:
            The updates that are applied to database after it becomes effective in real world .
Simulatneous Update:
            The updates that are applied to database at the same time when it becomes effective in real world .

7.      What are the different types of JOIN operations?
Equi Join:  This is the most common type of join which involves only equality comparisions. The disadvantage in this type of join is that there

No comments:

Post a Comment