0% found this document useful (0 votes)
47 views

DBAM Solved.

Uploaded by

aliabbas781064
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

DBAM Solved.

Uploaded by

aliabbas781064
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 53

Database Administration & Management (IT-3441) Last 5 Years Solved Papers

IQRA GIRLS COLLEGE, SARGODHA


Affiliated with University of Sargodha

3 University Road Sargodha, Pakistan


048 3213192 - 3221569 - 3216629
[email protected]
www.iqragirlscollege.edu.pk

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 1


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

Database Administration & Management Solved Questions


(DBAM)
M.Sc.IT 4th

Table of Contents
Short Questions .............................................................................................................................. 3
M.Sc.IT 2016 (1) .......................................................................................................................... 3
M.Sc.IT 2016 (2) .......................................................................................................................... 7
M.Sc.IT 2015.............................................................................................................................. 13
BSIT 5th 2017 ............................................................................................................................. 16
BSIT 5th 2016 ............................................................................................................................. 18
BSIT 6th 2015 ............................................................................................................................. 20
Long Questions ............................................................................................................................. 22
M.Sc.IT 2016 (1) ........................................................................................................................ 22
M.Sc.IT 2016 (2) ........................................................................................................................ 35
M.Sc.IT 2015.............................................................................................................................. 47

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 2


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

Short Questions
M.Sc.IT 2016 (1)
1. Role

Ans: create the Oracle role using the create role command. You then grant the Oracle role all
of the common privileges that users will require to do their work, like the ability to select,
insert, update and delete data from various tables.Once the Oracle role is all setup, you only
need grant the Oracle role to users and all the privileges will be transferred along with that
grant.

2. Backup

Ans: A backup is a copy of data. This copy can include important parts of the database, such as
the control file and datafiles. A backup is a safeguard against unexpected data loss and
application errors. If you lose the original data, then you can reconstruct it by using a backup.
Recovery Manager (RMAN) is an Oracle utility that can back up, restore, and recover database
files. It is a feature of the Oracle database server and does not require separate installation.

3. Import Utility
Ans: Export and Import are the Oracle utilities that allow us to make exports & imports of the
data objects, and transfer the data across databases that reside on different hardware
platforms on different Oracle versions.
Export (exp) and import (imp) utilities are used to perform logical database backup and
recovery. When exporting, database objects are dumped to a binary file which can then be
imported into another Oracle database.
catexp.sql (in $ORACLE_HOME/rdbms/admin) will create EXP_FULL_DATABASE &
IMP_FULL_DATABASE roles (no need to run this, if you ran catalog.sql at the time of database
creation).

4. Offline Backups
Ans: Full backups include all datafiles, tablespaces, and the Oracle database control file (SP file
of pfile). Offline backups do not include the archived log files.
A cold backup, also called an offline backup, is a database backup during which the database is
offline and not accessible to update. This is the safest way to back up because it avoids the risk
of copying data that may be in the process of being updated.

5. Database Triggers
Ans: Oracle allows you to define procedures that are implicitly executed when an INSERT,
UPDATE, or DELETE statement is issued against the associated table. These procedures are
called database triggers

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 3


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

triggers are commonly used to

• automatically generate derived column values

• prevent invalid transactions

• enforce complex security authorizations

• enforce referential integrity across nodes in a distributed database

• enforce complex business rules

6. Oracle Managed Files (OMF)


Ans: Oracle Managed Files simplify the administration.
• Can make tablespace datafile management even easier by
automating the creation and removal of datafiles.
• Without OMF a DBA might drop a tablespace and forgets to
remove the underlying (one or many) datafiles. Making
inefficient use of disk resources and unnecessary backup time
for datafiles.
• OMF ensures that each filename is unique.
• All ASM files are OMF.
• Non-OMF files can be converted to OMF.

7. Online backups
Ans: As the name implies, an online backup allows you to backup the database while users are
working. For a large number of shops online backups are the only backups they ever make.
Once you setup the database and RMAN to support hot backups, doing the backup is insanely
easy. In fact, it takes fewer RMAN commands than an offline

8. RMAN
Ans: Oracle RMAN (Oracle Recovery Manager) is a utility built into Oracle databases to
automate backup and recovery; it includes features not available in third-party backup tools. ...
Block-level corruption detection is provided during backup and restore. An Oracle database
client, RMAN automates administration of backup strategies and ensures database integrity.
Block-level corruption detection is provided during backup and restore.

9. Security Capabilities
Ans:

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 4


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

Security Description
Capability

Operating system Controls access to files, directories, and system resources.


security

Authentication Proves the stated identity of users or system processes; safely


remembers and transports identity information; and makes identity
information available when needed.

Authorization Controls access to resources based on identity or other information.

Auditing Safely collects, stores, and distributes information about operating


requests and their outcomes.

Link-level Uses symmetric key encryption to establish data privacy for


encryption messages moving over the network links that connect the machines
in a BEA Tuxedo application.

Public key Uses public key (or asymmetric key) encryption to establish end-to-
security end digital signing and data privacy between BEA Tuxedo application
clients and servers. Complies with the PKCS-7 standard.

10. Privileges
Ans: When multiple users can access database objects, authorization can be controlled to these
objects with privileges. Every object has an owner. Privileges control if a user can modify an
object owned by another user. Privileges are granted or revoked either by the instance
administrator, a user with the ADMIN privilege or, for privileges to a certain object, by the
owner of the object.

• System privileges
• Object privileges
• Privilege hierarchy
• The PUBLIC role

11. Auditing
Ans: Auditing is the monitoring and recording of selected user database actions. It can be based
on individual actions, such as the type of SQL statement executed, or on combinations of
factors that can include user name, application, time, and so on. Security policies can trigger
auditing when specified elements in an Oracle database are accessed or altered, including the
contents within a specified object.

Auditing is typically used to:

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 5


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

• Enable future accountability for current actions taken in a particular schema


• Deter users (or others) from inappropriate actions based on that accountability
• Investigate suspicious activity
• Monitor and gather data about specific database activities

12. Fine-grained Auditing


Ans: Oracle Fine Grained Auditing (FGA) enables you to create policies that define specific
conditions that must be met in order for an audit to occur. It provides granular auditing of
queries, and INSERT, UPDATE, and DELETE operations.

13. Virtua Private Database


Ans: Virtual Private Database (VPD) is a database security feature that is built into an Oracle
database server, as opposed to being part of an application that is accessing the data. The user
is only allowed to see the data they have been given permission to see. VPD uses application
contexts to provide row-level security and fine-grained access control based on a company's
security policies.

14. Label Security


Ans: Oracle Label Security. Oracle Label Security (OLS) is an extension of the Virtual Private
Database (VPD) technology introduced in Oracle 8i. OLS allows access control down to
individual rows based on attached labels.

15. Real Application Clusters

Ans: Oracle RAC enables you to cluster Oracle databases. Oracle RAC uses Oracle Clusterware
for the infrastructure to bind multiple servers so they operate as a single system.

Oracle Clusterware is a portable cluster management solution that is integrated with Oracle
Database. Oracle Clusterware is also a required component for using Oracle RAC. In addition,
Oracle Clusterware enables both single-instance Oracle databases and Oracle RAC databases to
use the Oracle high-availability infrastructure. Oracle Clusterware enables you to create a

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 6


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

clustered pool of storage to be used by any combination of single-instance and Oracle RAC

databases.

16. Oracle Streams


Ans: Oracle Streams is the flow of information either within a single database or from one
database to another. Oracle Streams can be set up in homogeneous (all Oracle databases) or
heterogeneous (non-Oracle and Oracle databases) environments.

M.Sc.IT 2016 (2)


17. Oracle Server

Ans: A database server is the key to solving the problems of information management. In
general, a server reliably manages a large amount of data in a multiuser environment so that
many users can concurrently access the same data. All this is accomplished while delivering
high performance. A database server also prevents unauthorized access and provides efficient
solutions for failure recovery.

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 7


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

18. Oracle Instance


Ans: Introduction to the Oracle Database Instance. A database instance is a set of memory
structures that manage database files. A database is a set of physical files on disk created by the
CREATE DATABASE statement. The instance manages its associated data and serves the users of
the database. When an instance is started, Oracle Database allocates a memory area called the
system global area (SGA) and starts one or more background processes

19. Global Area (SGA)


Ans: In the database management systems developed by the Oracle Corporation, the System
Global Area (SGA) forms the part of the system memory (RAM) shared by all the processes
belonging to a single Oracle database instance. The SGA contains all information necessary for
the instance operation.

• buffer cache:
• dictionary cache:
• redo log buffer:
• uncommitted
• shared pool:
• Java pool:
• large pool:
• stream pool

20. Background Processes

Ans: To maximize performance and accommodate many users, a multi-process Oracle system
uses some additional Oracle processes called background processes.

An Oracle instance can have many background processes; not all are always present. There are
numerous background processes. See the V$BGPROCESS view for more information on the
background processes. The background processes in an Oracle instance can include the
following:

• (DBWn)
• (LGWR)
• (CKPT)
• (SMON)
• (PMON)

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 8


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

• Other Background Processes

21. Backup Compression


Ans: You can optionally use compression when backing up Oracle databases to Oracle
Database Backup Cloud Service. ... You'll specify compression when you perform a backup.
Recovery Manager (RMAN) supports binary compression using one of the following
compression levels: HIGH, MEDIUM, BASIC, and LOW.

RMAN> CONFIGURE COMPRESSION ALGORITHM 'MEDIUM';

RMAN> CONFIGURE DEVICE TYPE sbt BACKUP TYPE TO COMPRESSED BACKUPSET;

22. Flash Recovery Area


Ans: The Oracle Flash Recovery Area (FRA) is also known as the fast recover area. Up through
Oracle 11g R1, the Oracle Flash Recovery Area (FRA) was the name of one of the basic
components of the RMAN environment. The FRA is essentially a disk location for the storage of
files related to the recovery process.These files in the FRA are managed by Oracle and RMAN
automatically. Files that could be found in the FRA include:

• RMAN backups
• control file
• logs
o online redo log copies

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 9


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

o archived redo logs


o flashback logs

23. Validating Backups

Ans: The main purpose of RMAN validation is to check for corrupt blocks and missing files. You
can also use RMAN to determine whether backups can be restored. You can use the following
RMAN commands to perform validation:

• VALIDATE
• BACKUP ... VALIDATE
• RESTORE ... VALIDATE

24. Recovery Operations

Ans: Recovery in general refers to the various operations involved in restoring, rolling forward,
and rolling back a backup. Backup and recovery in general refers to the various strategies and
operations involved in protecting your database against data loss and reconstructing the data
should that loss occur.

25. Block Media Recovery

Ans: Block media recovery recovers an individual corrupt datablock or set of datablocks within
a datafile. In cases when a small number of blocks require media recovery, you can selectively
restore and recover damaged blocks rather than whole datafiles.

Block media recovery provides several advantages over datafile media recovery. For example,
block media recovery

• Lowers the Mean Time to Recovery (MTTR) because only blocks needing recovery are
restored and only necessary corrupt blocks undergo recovery. Block media recovery
minimizes redo application time and avoids I/O overhead during recovery.
• Allows affected datafiles to remain online during recovery of the blocks. Without block-
level recovery, if even a single block is corrupt, then you must restore a backup of the
entire datafile and apply all redo generated for that file after the backup was created.

26. Restoring a Control File

Ans: restoring and recovering your database after the loss of one or more data files, but you
still have a usable server parameter file and control file. You can also use RMAN to restore a
lost server parameter file or control file.

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 10


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

27. Restoring a Table Space


1. Ans: Log in to the computer where you want to restore the tablespaces or datafiles.
2. Locate the user tablespaces or datafiles using the following command:
SQL> SELECT FILE_NAME, TABLESPACE_NAME FROM DBA_DATA_FILES;
3. Change the state of the database to mount, or nomount, or shutdown before you
restore the tablespaces or datafiles.
SQL> STARTUP MOUNT;
SQL> STARTUP NOMOUNT;
SQL> SHUTDOWN IMMEDIATE;
4. Log in to the Arcserve UDP Console.
5. Restore the tablespaces or datafiles using the Restore Wizard. For more information on
the restore process, see How to Restore From a Recovery Point.

28. Restoring a Data File


Ans:
29. Restoring an Entire Database
Ans:

To restore and recover the entire database:

1. Connect RMAN to the target database as described in "Connecting to the Target


Database Using RMAN."

2. Ensure that the database is mounted, but not open.

3. SHUTDOWN IMMEDIATE;

4. STARTUP MOUNT;

5. Restore the database using the following command:

6. RESTORE DATABASE;

The data files from the RMAN backup are restored to their default locations.

7. Recover the database using the RECOVER command.

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 11


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

8. RECOVER DATABASE;

9. Open the database using the following command:

10. ALTER DATABASE OPEN;

30. Validating Restore Operations


Ans: Validating the restore of datafiles from a backup tests whether a sufficient set of backups
exists that can be used to restore the specified files. After you specify which tablespaces
to restore and, possibly, a point in time as of which to restore them, RMAN selects a set of
backups that contain the needed data.

31. Point in Time Recovery

Ans: Database point-in-time recovery (DBPITR) restores the database from backups prior to
the target time for recovery, then uses incremental backups and redo to roll the database
forward to the target time.DBPITR is sometimes called incomplete recovery because it does not
use all of the available redo or completely recover all changes to your database.The
requirements for database point-in-time recovery are as follows:

• Your database must be running in ARCHIVELOG mode.


• You must have backups of all datafiles from before the target SCN for DBPITR and
archived redo logs for the period between the SCN of the backups and the target SCN.

32. Data Recovery Advisor


Ans: Data Recovery Advisor in Oracle Database 11g Release 1. The Data Recovery Advisor
automatically diagnoses corruption or loss of persistent data on disk, determines the
appropriate repair options, and executes repairs at the user's request.

• Create a Failure
• Relevant RMAN Functionality
o LIST FAILURE
o ADVISE FAILURE
o REPAIR FAILURE
o CHANGE FAILURE
o VALIDATE
• Health Monitor (DBMS_HM)
• Oracle Enterprise Manager

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 12


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

M.Sc.IT 2015

33. Data Dictionary Cache


Ans:The data dictionary is a collection of database tables and views containing reference
information about the database, its structures, and its users. Oracle accesses the data
dictionary frequently during SQL statement parsing. ... The other area in memory to
hold dictionary data is the library cache.

34. Java Pool


Ans: The java pool is a RAM region within the Oracle SGA and the java pool RAM is used to
provide: Parsing of Java code and scripts. Installation tasks related to Java applications
with Oracle 11g.

35. Large Pool


Ans:The large pool is an optional memory area. It provides an area of memory from
which large allocations can be made. Oracle's backup and restore utilities typically allocate
buffers that are hundreds of kilobytes in size. These will be allocated in the large pool if one is
present.

36. Automatic Storage Management

Ans:Automatic Storage Management (ASM) is an integrated, high-performance database file


system and disk manager. ... Striping—ASM spreads data evenly across all disks in a disk group
to optimize performance and utilizationASM groups the disks in your storage system into one
or more disk groups. You manage a small set of disk groups and ASM automates the placement
of the database files within those disk groups.

ASM provides the following benefits:

⚫ Striping
⚫ Mirroring
⚫ Online storage reconfiguration and dynamic rebalancing
⚫ Managed file creation and deletion

37. Oracle Logical Storage Structures

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 13


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

Ans: Logical Storage Structures. Oracle Database allocates logical space for all data in the
database. ...

38. Tablespaces
Ans:An Oracle database consists of one or more logical storage units called tablespaces,
which collectively store all of the database's data. Each tablespace in an Oracle database
consists of one or more files called datafiles, which are physical structures that conform
to the operating system in which Oracle is running.

39. Data Blocks


Ans:Data Blocks Overview. Oracle manages the storage space in the datafiles of a
database in units called data blocks. A data block is the smallest unit of data used by a
database. In contrast, at the physical, operating system level, all data is stored in bytes. Each
operating system has a block size.

40. Diff. b/w Shared Server & Dedicated Server


Ans:A dedicated process has one to one relationship with user process. The user connected with
dedicated server connection has the dedicated resource that is whether or not the user is doing
work the connection remains allocated to that user. Thus if your user is not working and if there
is less network resource then this user is blocking another user to connect or to execute the user
request by making this user works queued. This connection is preferable when you have lot of
resource or to some administrative user like "SYS" , "SYS" for administrative works and for batch
jobs,
When there is shared server the user connection is shared, that is user is connecting by
dispatchers and when a user is idle his resource can be used by other users, thus lessen the load
on system, this is more likely in a environment where user is mostly idle, like in a order entry
system.

41. Archived Log Files


Ans:Oracle Database lets you save filled groups of redo log files to one or more offline
destinations, known collectively as the archived redo log, or more simply the archive log. The
process of turning redo log files into archived redo log files is called archiving.

42. Initialization Parameter Files


Ans:Oracle reads the initialization parameter values from either a PFILE or SPFILE as the
database is starting. The parameters tell the Oracle programs how much memory to allocate,
where to put files related to the database and the location of existing datafiles.

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 14


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

A parameter has a name and a value.When the Oracle database is started, one of the first
things it needs to do is read the database initialization parameter file. The parameter file
(init.ora) is created by the DBA and defines the overall instance configuration, such as how
much memory should be allocated to the instance

43. Alert and Trace Log Files

Ans:

◆ oracle writes messages to the alert log when things go wrong.


◆ Located in directory specified by initialization parameter
◆ BACKGROUND_DUMP_DEST
◆ Contains both routine status messages and error conditions.
◆ Log into Oracle Enterprise Manager and click on ALERT LOG

rocesses are stored in Trace Files. (user, server, background)


• Located at
C:\APP\ADMINISTRATOR\DIAG\RDBMS\MYDB\MYDB\..
• Initialization Parameters are:
• BACKGROUND_DUMP_DEST
• USER_DUMP_DEST
• CORE_DUMP_DEST
• Automatic Diagnostic Repository (ADR) is a system-managed
central tracing and logging repository for storing database alert
logs, trace files and health monitor reports.
44. Backup Files
Ans: A backup is a copy of data from your database that can be used to reconstruct that
data. Backups can be divided into physical backups and logical backups.
Physical backups are backups of the physical files used in storing and recovering your database,
such as datafiles, control files, and archived redo logs.

Recovery Manager, a tool (with command-line client and Enterprise Manager GUI
interfaces) that integrates with sessions running on the Oracle server to perform a range
of backup and recovery activities.

The traditional user-managed backup and recovery, SQL*Plus backup and recovery-
related capabilities

45. Fine-grained Auditing

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 15


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

Ans: Oracle Fine Grained Auditing (FGA) enables you to create policies that define specific
conditions that must be met in order for an audit to occur. It provides granular auditing of
queries, and INSERT, UPDATE, and DELETE operations.

46. Virtual Private Database


Ans: Virtual Private Database (VPD) is a database security feature that is built into
an Oracle database server, as opposed to being part of an application that is accessing
the data. The user is only allowed to see the data they have been given permission to see.
47. Label Security
Ans: Oracle Label Security. Oracle Label Security (OLS) is an extension of the Virtual Private
Database (VPD) technology introduced in Oracle 8i. OLS allows access control down to
individual rows based on attached labels.

48. Real Application Clusters


Ans: Repeate

BS 5th 2017
49. What is dynamic SGA

ANS: This ability to dynamically grow and shrink different areas within the Oracle SGA
offers some exciting new possibilities for the Oracle database administrator. Database
activity within each region of the SGA can be monitored individually, and resources can
be allocated and deleted according the usage patterns within the Oracle database.

50. Shared pool

ANS: The shared pool portion of the SGA contains the library cache, the dictionary cache,
buffers for parallel execution messages, and control structures.The total size of the
shared pool is determined by the initialization parameter SHARED_POOL_SIZE. The
default value of this parameter is 8MB on 32-bit platforms and 64MB on 64-bit
platforms. Increasing the value of this parameter increases the amount of memory
reserved for the shared pool

51. Undo advisor


ANS: Automatic tuning of undo retention typically achieves better results with a fixed-
size undo tablespace. If you decide to use a fixed-size undo tablespace, the Undo
Advisor can help you estimate needed capacity.

You can access the Undo Advisor through Oracle Enterprise Manager (EM) or through

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 16


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

the DBMS_ADVISOR PL/SQL package or through the DBMS_UNDO_ADV PL/SQL package.

52. Undo retention


ANS: UNDO_RETENTION is a parameter in the init.ora initialization parameters file that
specifies the time period in seconds for which a system retains undo data for committed
transactions. The flashback query can go upto the point of time specified as a value in
the UNDO_RETENTION parameter.

53. AMM
ANS: With automatic memory management, the Oracle instance dynamically tunes
all memory components to optimize performance as the workload changes. To
enable automatic memory management: Start SQL*Plus and connect to the database
as SYSDBA .

54. Library cache


ANS :The Library Cache is a piece of memory within the SGA that Oracle uses in order to
store SQL Statements. Whenever a Process issues an SQL Statement, the text of the
Statement goes into the Library Cache where the statement is parsed an validated. If for
example I do a insert into city (name, abbr) values ('Geneva', 'GE');. the Library Cache
checks if there is a table named city having the columns name and abbr. As an additional
task, the Library Cache also checks if the user's privileges are sufficient to execute the
statement.
In a similar way, the Library Cache also caches PL/SQL Statements and Objects.
The Library Cache was introduced because parsing (and validating and checking
privileges) is expensive in terms of CPU cycles.

55. Online backups


ANS : You can back up all or specified datafiles of an online tablespace while the
database is open, but only when the database runs in ARCHIVELOG mode. In this
case, Oracle can write changes to the online datafiles while the backup is occurring.
A backup of online datafiles is called an online backup.

56. Data pump export options


ANS: Oracle Data Pump technology enables very high-speed movement of data and
metadata from one database to another. Oracle Data Pump is available only on Oracle
Database 10g release 1 (10.1) and later. ... Moving Data Between
Different Database Versions. Original Export and Import Versus Data Pump Export and
Import.

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 17


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

Data Pump Export (hereinafter referred to as Export for ease of reading) is a utility for
unloading data and metadata into a set of operating system files called a dump file set.
The dump file set can be imported only by the Data Pump Import utility. The dump file
set can be imported on the same system or it can be moved to another system and
loaded there.

57. Data pump import options

ANS: The dump file set is made up of one or more disk files that contain table data,
database object metadata, and control information. The files are written in a
proprietary, binary format. During an import operation, the Data Pump Import utility
uses these files to locate each database object in the dump file set.

Data Pump Import (hereinafter referred to as Import for ease of reading) is a utility for
loading an export dump file set into a target system. The dump file set is made up of one
or more disk files that contain table data, database object metadata, and control
information.

58. Implementing offline backups


ANS: You can restore from an offline backup. Offline backups taken after the database is
cleanly shutdown, and they do not require a roll forward operation to get them to a
consistent database state.You can apply the redo log or incremental backups for the
latest database changes.
59. Data dictionary cache
ANS: The data dictionary is a collection of database tables and views containing
reference information about the database, its structures, and its users. Oracle accesses
the data dictionary frequently during SQL statement parsing. ... The other area in
memory to hold dictionary data is the library cache.

60. Java pool


ANS: The java pool is a RAM region within the Oracle SGA and the java pool RAM is used
to provide: Parsing of Java code and scripts. Installation tasks related
to Java applications with Oracle 11g.
61. Large pool
ANS: Oracle Large Pool is an optional memory component of the oracle database SGA.
This area is used for providing large memory allocations in many situations that arise
during the operations of an oracle database instance.

BSIT 5th 2016


62. Basic initialization parameters

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 18


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

ANS: Most databases should only need to have the database basic initialization parameters
set to run properly and efficiently.Oracle advises you to become familiar with the basic
parameters and only use other parameters when directed to by feature documentation or
in special circumstances. The following is a list of the database basic initialization
parameters:

CLUSTER_DATABASE
COMPATIBLE
CONTROL_FILES
DB_BLOCK_SIZE
DB_CREATE_FILE_DEST
DB_CREATE_ONLINE_LOG_DEST_n
DB_DOMAIN
DB_NAME

A server parameter file enables you to change initialization parameters with ALTER SYSTEM
commands and to persist the changes across a shutdown and startup. It also provides a basis
for self-tuning by Oracle Database.

63. Tablespace architecture


ANS: A tablespace is a logical storage container for segments. Segments are database
objects, such as tables and indexes, that consume storage space. At the physical level, a
tablespace stores data in one or more data files or temp files. A database must have the
SYSTEM and SYSAUX tablespaces. The following figure shows the tablespaces in a typical
database. The following sections describe the tablespace types.

64. Optimal Flexible Architecture


ANS: Optimal Flexible Architecture is a set of guidelines that you should adopt when
organizing Oracle directories and files on your computer. All Oracle components on the
installation media are compliant with Optimal Flexible Architecture.

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 19


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

65. Oracle installation

ANS:

• Log on as a member of the Administrators group to the computer to install Oracle


components.
• If you are installing on a Primary Domain Controller (PDC) or a Backup Domain
Controller (BDC), log on as a member of the Domain Administrators group.
• Insert the Oracle Database Client installation media and navigate to the client directory.
Alternatively, navigate to the directory where you downloaded or copied the installation
files.
• Use the same installation media to install Oracle Database on all supported Windows
platforms.
• Double-click setup.exe to start Oracle Universal Installer.

BSIT 6th 2015


66. Oracle server
ANS: An Oracle server consists of an Oracle database and an Oracle server instance.
Every time a database is started, a system global area (SGA) is allocated
and Oracle background processes are started. The combination of the background
processes and memory buffers is called an Oracle instance.

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 20


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

67. Oracle instance


ANS: Oracle instance—An Oracle instance (also known as a database instance) contains
the set of Oracle Database background processes that operate on the stored data and
the shared allocated memory that those processes use to do their work.
An instance must be started to read and write information to the database.

68. SGA

ANS: In the database management systems developed by the Oracle Corporation, the System
Global Area (SGA) forms the part of the system memory (RAM) shared by all the processes
belonging to a single Oracle database instance. The SGA contains all information necessary for
the instance operation.

69. Background processes


ANS: Repeate

70. Oracle database


ANS: An Oracle database is a collection of data treated as a unit. The purpose of a database is to
store and retrieve related information. A database server is the key to solving the problems of
information management. In general, a server reliably manages a large amount of data in a multiuser
environment so that many users can concurrently access the same data. All this is accomplished
while delivering high performance. A database server also prevents unauthorized access and
provides efficient solutions for failure recovery.

71. Client-application server-server


ANS: An application server provides access to the data for the client. It serves as an
interface between the client and one or more database servers, which provides an
additional level of security. It can also perform some of the query processing for
the client, thus removing some of the load from the database server.

72. Client server


ANS: The client runs the database application that accesses database information and
interacts with a user through the keyboard, screen, and pointing device, such as a
mouse. The server runs the Oracle software and handles the functions required for
concurrent, shared data access to an Oracle database.

73. Host-based
ANS:
74. Sequences
ANS: In Oracle, you can create an autonumber field by using sequences. A sequence is
an object in Oracle that is used to generate a number sequence. This can be useful
when you need to create a unique number to act as a primary key.

75. Synonyms
ANS: A synonym is an alternative name for objects such as tables, views, sequences,
stored procedures, and other database objects. You generally use synonyms when you

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 21


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

are granting access to an object from another schema and you don't want the users to
have to worry about knowing which schema owns the object.

76. PL/SQL
ANS: database management, PL/SQL is a procedural language extension to Structured Query
Language (SQL). The purpose of PL/SQL is to combine database language and procedural
programming language. The basic unit in PL/SQL is called a block and is made up of three parts:
a declarative part, an executable part and an exception-building part

77. External file access


ANS: External tables allow Oracle to query data that is stored outside the database in
flat files. The ORACLE_LOADER driver can be used to access any data stored in any
format that can be loaded by SQL*Loader. No DML can be performed on external tables
but they can be used for query, join and sort operations.

78. Offline backups


ANS: Repeat

79. Database triggers


ANS: Oracle allows you to define procedures that are implicitly executed when an
INSERT, UPDATE, or DELETE statement is issued against the associated table. These
procedures are called database triggers
80. OMF
ANS: Repeate

81. Online backups


ANS: Repeate

Long Questions
M.Sc.IT 2016 (1)

1. Explain Diff. Memory Structures available in Oracle server.


When an instance is started, Oracle Database allocates a memory area and starts background processes. The
memory area stores information such as the following:

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 22


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

• Program code
• Information about each connected session, even if it is not currently active
• Information needed during program execution, for example, the current state of a query from which
rows are being fetched
• Information such as lock data that is shared and communicated among processes
• Cached data, such as data blocks and redo records, that also exists on disk

Basic Memory Structures


The basic memory structures associated with Oracle Database include:

• System global area (SGA)

The SGA is a group of shared memory structures, known as SGA components, that contain data and
control information for one Oracle Database instance. The SGA is shared by all server and
background processes. Examples of data stored in the SGA include cached data blocks and shared
SQL areas.

In general, the SGA consists of the following:

• buffer cache: holds copies of data blocks read from datafiles[1]


• dictionary cache: holds information about data dictionary tables, such as information about account,
datafile, segment, extent, table and privileges
• redo log buffer: contains information about database transactions, both committed and uncommitted, in
preparation for writing to online redo log files
• shared pool: holds the dictionary or row cache, the library cache, cursor definitions and shared SQL.
• Java pool: holds information for parsing Java statements.
• large pool: including the User Global Area (UGA))
• stream pool:this is remote connectivity for the database.
• In the Oracle DBMS, the Oracle server allocates the system global area (SGA) in granule units at the
time of instance startup. During the startup, each component acquires as many granules as it
requires. The SGA can be said to consist of linked granules. The granule size depends on the database
version and sometimes on the operating system. In Oracle 9i and earlier, it is 4 MB if the SGA size is
less than 128 MB, and 16 MB otherwise. For later releases, it is typically 4 MB if the SGA size is less
than 1 GB, and 16 MB otherwise. [3] There must be at least 3 granules in the SGA: one for the
Database Buffer Cache, one for the Shared Pool Area and one for the Redo Log Buffer. It is possible
to retrieve information about the current granule size at any time by querying the dynamic view
V$SGAINFO.[4]

• Program global area (PGA)

A PGA is a nonshared memory region that contains data and control information exclusively for use
by an Oracle process. The PGA is created by Oracle Database when an Oracle process is started.

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 23


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

One PGA exists for each server process and background process. The collection of individual PGAs is
the total instance PGA, or instance PGA. Database initialization parameters set the size of the
instance PGA, not individual PGAs.Ans: Figure 14-1 Oracle Database Memory Structures

2. Explain Mandatory background process in Oracle server.


Ans: Mandatory Background Processes in Oracle

If any one of these 6 mandatory background processes is killed/not running, the instance will be
aborted.

1) Database Writer (maximum 20) DBW0-DBW9,DBWa-DBWj

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 24


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

Whenever a log switch is occurring as redolog file is becoming CURRENT to ACTIVE stage, oracle
calls DBWn and synchronizes all the dirty blocks in database buffer cache to the respective
datafiles, scattered or randomly.

Database writer (or Dirty Buffer Writer) process does multi-block writing to disk
asynchronously. One DBWn process is adequate for most systems. Multiple database writers
can be configured by initialization parameter DB_WRITER_PROCESSES, depends on the number
of CPUs allocated to the instance. To have more than one DBWn only make sense if each DBWn
has been allocated its own list of blocks to write to disk. This is done through the initialization
parameter DB_BLOCK_LRU_LATCHES. If this parameter is not set correctly, multiple DB writers
can end up contending for the same block list.

The possible multiple DBWR processes in RAC must be coordinated through the locking and
global cache processes to ensure efficient processing is accomplished.

DBWn will be invoked in following scenarios:

• When the dirty blocks in SGA reaches to a threshold value, oracle calls DBWn.
• When the database is shutting down with some dirty blocks in the SGA, then oracle calls
DBWn.
• DBWn has a time out value (3 seconds by default) and it wakes up whether there are
any dirty blocks or not.
• When a checkpoint is issued.
• When a server process cannot find a clean reusable buffer after scanning a threshold
number of buffers.
• When a huge table wants to enter into SGA and oracle could not find enough free space
where it decides to flush out LRU blocks and which happens to be dirty blocks. Before
flushing out the dirty blocks, oracle calls DBWn.
• Oracle RAC ping request is made.
• When Table DROPped or TRUNCATEed.

• When tablespace is going to OFFLINE/READ ONLY/BEGIN BACKUP.



2) Log Writer (maximum 1) LGWR

LGWR writes redo data from redolog buffers to (online) redolog files, sequentially.

Redolog file contains changes to any datafile. The content of the redolog file is file id, block id
and new content.

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 25


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

LGWR will be invoked more often than DBWn as log files are really small when compared to
datafiles (KB vs GB). For every small update we don’t want to open huge gigabytes of datafiles,
instead write to the log file.

Redolog file has three stages CURRENT, ACTIVE, INACTIVE and this is a cyclic process. Newly
created redolog file will be in UNUSED state.

When the LGWR is writing to a particular redolog file, that file is said to be in CURRENT status. If
the file is filled up completely then a log switch takes place and the LGWR starts writing to the
second file (this is the reason every database requires a minimum of 2 redolog groups). The file
which is filled up now becomes from CURRENT to ACTIVE.

Log writer will write synchronously to the redolog groups in a circular fashion. If any damage is
identified with a redolog file, the log writer will log an error in the LGWR trace file and the alert
log. Sometimes, when additional redolog buffer space is required, the LGWR will even write
uncommitted redolog entries to release the held buffers. LGWR can also use group commits
(multiple committed transaction's redo entries taken together) to write to redologs when a
database is undergoing heavy write operations.

In RAC, each RAC instance has its own LGWR process that maintains that instance’s thread of
redo logs.

LGWR will be invoked in following scenarios:

• LGWR is invoked whenever 1/3rd of the redo buffer is filled up.


• Whenever the log writer times out (3sec).
• Whenever 1MB of redolog buffer is filled (This means that there is no sense in making
the redolog buffer more than 3MB).
• Shutting down the database.
• Whenever checkpoint event occurs.
• When a transaction is completed (either committed or rollbacked) then oracle calls the
LGWR and synchronizes the log buffers to the redolog files and then only passes on the
acknowledgement back to the user. Which means the transaction is not guaranteed
although we said commit, unless we receive the acknowledgement. When a transaction
is committed, a System Change Number (SCN) is generated and tagged to it. Log writer
puts a commit record in the redolog buffer and writes it to disk immediately along with
the transaction's redo entries. Changes to actual data blocks are deferred until a
convenient time (Fast-Commit mechanism).
• When DBWn signals the writing of redo records to disk. All redo records associated with
changes in the block buffers must be written to disk first (The write-ahead protocol).

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 26


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

While writing dirty buffers, if the DBWn process finds that some redo information has
not been written, it signals the LGWR to write the information and waits until the
control is returned.

3) Checkpoint (maximum 1) CKPT

Checkpoint is a background process which triggers the checkpoint event, to synchronize all
database files with the checkpoint information. It ensures data consistency and faster database
recovery in case of a crash.

When checkpoint occurred it will invoke the DBWn and updates the SCN block of the all
datafiles and the control file with the current SCN. This is done by LGWR. This SCN is called
checkpoint SCN.
• Checkpoint event can be occurred in following conditions:
o Whenever database buffer cache filled up.
o Whenever times out (3seconds until 9i, 1second from 10g).
o Log switch occurred.
o Whenever manual log switch is done.
SQL> ALTER SYSTEM SWITCH LOGFILE;
o Manual checkpoint.
SQL> ALTER SYSTEM CHECKPOINT;
o Graceful shutdown of the database.
o Whenever BEGIN BACKUP command is issued.

o When the time specified by the initialization parameter


LOG_CHECKPOINT_TIMEOUT (in seconds), exists between the incremental checkpoint and the
tail of the log.
o When the number of OS blocks specified by the initialization parameter
LOG_CHECKPOINT_INTERVAL, exists between the incremental checkpoint and the tail of the
log.
o The number of buffers specified by the initialization parameter
FAST_START_IO_TARGET required to perform roll-forward is reached.
o Oracle 9i onwards, the time specified by the initialization parameter
FAST_START_MTTR_TARGET (in seconds) is reached and specifies the time required for a crash
recovery. The parameter FAST_START_MTTR_TARGET replaces LOG_CHECKPOINT_INTERVAL
and FAST_START_IO_TARGET, but these parameters can still be used.

4) System Monitor (maximum 1) SMON


▪ If the database is crashed (power failure) and next time when we restart the database SMON observes
that last time the database was not shutdown gracefully. Hence it requires some recovery, which is known as

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 27


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

INSTANCE CRASH RECOVERY. When performing the crash recovery before the database is completely open, if it
finds any transaction committed but not found in the datafiles, will now be applied from redolog files to datafiles.
▪ If SMON observes some uncommitted transaction which has already updated the table in the datafile, is
going to be treated as a in doubt transaction and will be rolled back with the help of before image available
in rollback segments.
▪ SMON also cleans up temporary segments that are no longer in use.
▪ It also coalesces contiguous free extents in dictionary managed tablespaces that have PCTINCREASE set to
a non-zero value.
▪ In RAC environment, the SMON process of one instance can perform instance recovery for other instances
that have failed.
▪ SMON wakes up about every 5 minutes to perform housekeeping activities.

5) Process Monitor (maximum 1) PMON

If a client has an open transaction which is no longer active (client session is closed) then PMON comes into the
picture and that transaction becomes in doubt transaction which will be rolled back.

PMON is responsible for performing recovery if a user process fails. It will rollback uncommitted transactions. If the
old session locked any resources that will be unlocked by PMON.

PMON is responsible for cleaning up the database buffer cache and freeing resources that were allocated to a
process.

PMON also registers information about the instance and dispatcher processes with Oracle (network) listener.

PMON also checks the dispatcher & server processes and restarts them if they have failed.

PMON wakes up every 3 seconds to perform housekeeping activities.

In RAC, PMON’s role as service registration agent is particularly important.

6) Recoverer (maximum 1) RECO [Mandatory from Oracle 10g]

This process is intended for recovery in distributed databases. The distributed transaction recovery process finds
pending distributed transactions and resolves them. All in-doubt transactions are recovered by this process in the
distributed database setup. RECO will connect to the remote database to resolve pending transactions.

Pending distributed transactions are two-phase commit transactions involving multiple databases. The database
that the transaction started is normally the coordinator. It will send request to other databases involved in two-
phase commit if they are ready to commit. If a negative request is received from one of the other sites, the entire
transaction will be rolled back. Otherwise, the distributed transaction will be committed on all sites. However,
there is a chance that an error (network related or otherwise) causes the two-phase commit transaction to be left

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 28


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

in pending state (i.e. not committed or rolled back). It's the role of the RECO process to liaise with the coordinator
to resolve the pending two-phase commit transaction. RECO will either commit or rollback this transaction.

3. Briefly describe components of Oracle server.


Ans: An Oracle database is a collection of data treated as a unit. ... A database server is the key
to solving the problems of information management. In general, a server reliably manages a
large amount of data in a multiuser environment so that many users can concurrently access
the same data.

Oracle Instance
The Oracle instance allows you to access the Oracle database ( opening only one database).
The Oracle instance consists of:
• Background process : manage and implement the relationships between physical structures
and memory structures. There are two categories
• Mandatory background processes: DBWN, PMON, CKPT, LGWR, SMON
• Optional background process: ARCn, LMDn, RECO, CJQ0, LMON, Snnn, Dnnn, Pnnn,
LCKn, QMNn
• Memory structures consisting of essentially of two memory areas:
• Memory area allocated to the SGA (System Global Area) : allocated to start the instance
and represents a fundamental component of an Oracle instance. It consists of several
memory areas:
• The shared memory area
• The buffer cache of the database
• Buffer logging and other structures for the management of internal and external locks,
statistical data, etc ...
• The LARGE POOL memory area
• The Java memory area
• Memory allocated for the PGA (Program Global Area) is allocated at the start of the process
server. It is reserved for each user process that connects to the Oracle database and is
released at the end of the process.

The user process


The program which interacts with the database by starting a connection. It communicates only
with the process server.

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 29


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

Process Servers
Represents the program that interact directly with the Oracle server. It responds to all requests
and return results. It can be dedicated to a client or a server shared by many.

Oracle database
The Oracle database is a collection of data treated as a single entity and consists of three types
of files including:
• Control files
• Data Files
• Log files

4. What is recovery, write steps for recovering instance, data file and control file.
Ans: Recovery Manager (RMAN) is an Oracle utility that can back up, restore,
and recover database files. It is a feature of the Oracle database server and does not require
separate installation.

When Oracle Database Performs Instance Recovery


Whether instance recovery is required depends on the state of the redo threads. A redo thread is marked
open in the control file when a database instance opens in read/write mode, and is marked closed when the
instance is shut down consistently. If redo threads are marked open in the control file, but no live instances
hold the thread enqueues corresponding to these threads, then the database requires instance recovery.

Oracle Database performs instance recovery automatically in the following situations:

• The database opens for the first time after the failure of a single-instance database or all instances of
an Oracle RAC database. This form of instance recovery is also called crash recovery. Oracle
Database recovers the online redo threads of the terminated instances together.
• Some but not all instances of an Oracle RAC database fail. Instance recovery is performed
automatically by a surviving instance in the configuration.

Recover Oracle Datafile


You should follow these basic steps:
1. After identifying which files are damaged, place the database in the appropriate state
for restore and recovery. ...
2. Restore the files with an operating system utility. ...

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 30


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

3. Restore any necessary archived redo log files.


4. Use the SQL*Plus RECOVER command to recover the datafile backups.

Recovering a Control File Using a Current Copy


This section presents ways that you can recover your control file from a current backup or from a multiplexed
copy.

Recovering from Control File Corruption Using a Control File


Copy
This procedure assumes that one of the control files specified in the CONTROL_FILES parameter is corrupted,
that the control file directory is still accessible, and that you have a multiplexed copy of the control file.

1. With the instance shut down, use an operating system command to overwrite the bad control file
with a good copy:
2. % cp /u03/oracle/prod/control03.ctl /u02/oracle/prod/control02.ctl

3.

4. Start SQL*Plus and open the database:


5. SQL> STARTUP

Recovering from Permanent Media Failure Using a Control File


Copy
This procedure assumes that one of the control files specified in the CONTROL_FILES parameter is inaccessible
due to a permanent media failure and that you have a multiplexed copy of the control file.

1. With the instance shut down, use an operating system command to copy the current copy of the
control file to a new, accessible location:
2. % cp /u01/oracle/prod/control01.ctl /u04/oracle/prod/control03.ctl

3.

4. Edit the CONTROL_FILES parameter in the initialization parameter file to replace the bad location with
the new location:
5. CONTROL_FILES = (/u01/oracle/prod/control01.ctl,

6. /u02/oracle/prod/control02.ctl,

7. /u04/oracle/prod/control03.ctl)

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 31


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

8.

9. Start SQL*Plus and open the database:


10. SQL> STARTUP

11.

If you have multiplexed control files, you can get the database started up quickly by editing
the CONTROL_FILES initialization parameter. Remove the bad control file from CONTROL_FILES setting and you
can restart the database immediately. Then you can perform the reconstruction of the bad control file and at
some later time shut down and restart the database after editing the CONTROL_FILES initialization parameter
to include the recovered control file.

5. What is database backup? Elaborate diff. types and strategy of backup.


Ans: A backup is a copy of data from your database that can be used to reconstruct that
data. Backups can be divided into physical backups and logical backups.
Physical backups are backups of the physical files used in storing and recovering your database,
such as datafiles, control files, and archived redo logs.

Backup Type
Types of Backups
• Full Backups
• Incremental Backups
• Hot vs Cold Backups

Full backup
As the name implies, a full backup is when every single file and folder in the system is backed
up. A full backup takes longer and requires more space than other types of backups but the
process of restoring lost data from backup is much faster.
Incremental backup
With incremental backup, only the initial backup is a full one. Subsequent backups only stores
changes that were made since the previous backup. The process of restoring lost data from
backup is longer but the backup process is much quicker.
Cold backup:
A cold backup is done when there is no user activity going on with the system. Also called as
offline backup, is taken when the database is not running and no users are logged in. all files of
the database are copied and no changes during the copy are made.
Hot backup:

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 32


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

A hot backup is taken when the database needs to run all the time. It is an online backup. All
files of the database are copied and there may be changes to the database during the copy.

Terminology:

• Backups may be stored as:


Image copies:
• Image copies are exact byte-for-byte copies of files. You can create an image copy by copying a
file at the operating system level. ...
• Backup sets are logical entities produced by the RMAN BACKUP command. ...
• Each backup set contains one or more physical files called backup pieces.

Backup sets:
RMAN backs up the datafiles, control file, archived log files, and server parameter files in a
RMAN specific format called a backup piece. In a nutshell, a backup set is a bundle of dbf, ctl
and redo file that can restore a database. A set of one or more such backup pieces makes up
a backup set.
Backup Strategies

Before you create an Oracle database, decide how to protect the database against
potential media failures. If you do not develop a backup strategy before creating
your database, then you may not be able to perform recovery if a disk failure
damages the datafiles, online redo log files, or control files.

This section describes general guidelines that can help you decide when to perform
database backups and which parts of a database you should back up. Of course, the
specifics of your strategy depend on the constraints under which you are operating.

This section contains these topics:

• Obeying the Golden Rule of Backup and Recovery


• Choosing the Database Archiving Mode
• Multiplexing Control Files, Online Redo Logs, and Archived Redo Logs
• Performing Backups Frequently and Regularly
• Performing Backups Before and After You Make Structural Changes
• Backing Up Often-Used Tablespaces
• Performing Backups After Unrecoverable Operations

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 33


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

• Performing Whole Database Backups After Opening with the RESETLOGS


Option
• Archiving Older Backups
• Knowing the Constraints for Distributed Database Backups
• Exporting Data for Added Protection and Flexibility
• Avoiding the Backup of Online Redo Logs
• Keeping Records of the Hardware and Software Configuration of the Server

6. Write steps for recovering redo files and control files.


Ans: Recovering After the Loss of All Members of an Online Redo Log Group

If a media failure damages all members of an online redo log group, then different scenarios
can occur depending on the type of online redo log group affected by the failure and the
archiving mode of the database.

If the damaged log group is active, then it is needed for crash recovery; otherwise, it is not.

If the
group
is . . . Then . . . And you should . . .
Inactive It is not needed for Clear the archived or unarchived group.
crash recovery
Active It is needed for crash Attempt to issue a checkpoint and clear the log; if
recovery impossible, then you must restore a backup and perform
incomplete recovery up to the most recent available redo
log.
Current It is the log that the Attempt to clear the log; if impossible, then you must
database is currently restore a backup and perform incomplete recovery up to
writing to the most recent available redo log.

Your first task is to determine whether the damaged group is active or inactive.

1. Locate the filename of the lost redo log in V$LOGFILE and then look for the group number
corresponding to it. For example, enter:

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 34


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

2. SELECT GROUP#, STATUS, MEMBER FROM V$LOGFILE;


3.
4. GROUP# STATUS MEMBER
5. ------- ----------- ---------------------
6. 0001 /oracle/dbs/log1a.f
7. 0001 /oracle/dbs/log1b.f
8. 0002 INVALID /oracle/dbs/log2a.f
9. 0002 INVALID /oracle/dbs/log2b.f
10. 0003 /oracle/dbs/log3a.f
11. 0003 /oracle/dbs/log3b.f
12.
13. Determine which groups are active. For example, enter:
14. SELECT GROUP#, MEMBERS, STATUS, ARCHIVED
15. FROM V$LOG;
16.
17. GROUP# MEMBERS STATUS ARCHIVED
18. ------ ------- --------- -----------
19. 0001 2 INACTIVE YES
20. 0002 2 ACTIVE NO
21. 0003 2 CURRENT NO
22.
23. If the affected group is inactive, follow the procedure in Losing an Inactive Online Redo
Log Group. If the affected group is active (as in the preceding example), then follow the
procedure in "Losing an Active Online Redo Log Group".

Losing an Inactive Online Redo Log Group

If all members of an online redo log group with INACTIVE status are damaged, then the procedure
depends on whether you can fix the media problem that damaged the inactive redo log group.

M.Sc.IT 2016 (2)

7. Explain diff. administration tools available in Oracle 11 g.


Ans: Tools for Administering the Database
The goal of this guide is to enable you to quickly and efficiently create an Oracle database, and to provide
guidance in basic database administration.

The following are some products, tools, and utilities you can use to achieve your goals as a database
administrator:

• Oracle Universal Installer

Oracle Universal Installer (OUI) is a utility that installs your Oracle software and options. It can
automatically start Oracle Database Configuration Assistant to install a database.

• Oracle Database Configuration Assistant

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 35


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

Oracle Database Configuration Assistant (DBCA) is a utility that creates a database from templates
that are supplied by Oracle, or you can create your own. It enables you to copy a preconfigured seed
database, thus saving the time and effort of generating and customizing a new database.

• Database Upgrade Assistant

The Database Upgrade Assistant is a tool that guides you through the upgrade of your existing
database to a new Oracle Database release.

• Net Configuration Assistant

Net Configuration Assistant (NETCA) is a utility that enables you to configure listeners and naming
methods, which are critical components of the Oracle Database network.

• Oracle Enterprise Manager Database Control

The primary product for managing your database is Oracle Enterprise Manager Database Control
(Database Control), a Web-based interface. After you have installed the Oracle Database software,
created or upgraded a database, and configured the network, you can use Database Control to
manage your database. Database Control also provides an interface for performance advisors and for
Oracle utilities such as SQL*Loader and Recovery Manager (RMAN).

Oracle also offers separately licensed Oracle Enterprise Manager management packs, management
plug-ins, and other products you can purchase to enhance the capabilities of Oracle Enterprise
Manager in specific environments.

8. What is Optimal Flexible Architecture (OFA). Elaborate with example.


Ans: Optimal Flexible Architecture (OFA)

Oracle Corporation recommends that the Optimal Flexible Architecture (OFA)


standard be implemented when installing and configuring Oracle8i. The OFA
standard is a set of configuration guidelines for fast, reliable Oracle databases that
require little maintenance.

OFA is designed to:

• organize large amounts of complicated software and data on disk to avoid


device bottlenecks and poor performance
• facilitate routine administrative tasks such as software and data backup
functions, which are often vulnerable to data corruption
• alleviate switching among multiple Oracle databases
• adequately manage and administer database growth

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 36


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

• help eliminate fragmentation of free space in the data dictionary, isolate other
fragmentation, and minimize resource contention
• Table B-2 Optimal Flexible Architecture Hierarchical File Path Examples

Directory Description

Root directory

User data mount point 1

/u01/

Subtree for application software

/u01/app/

Central OraInventory directory, which maintains


information about Oracle installations on a server.
/u01/app/oraInventory Members of the group designated as the OINSTALL group
have permissions to write to the central inventory. All
Oracle software installation owners must have the
OINSTALL group as their primary group, and be able to
write to this group.

Oracle base directory for user oracle. There can be many


Oracle Database installations on a server, and many Oracle
/u01/app/oracle/ Database software installation owners.

Oracle software homes that an Oracle installation owner


owns should be located in the Oracle base directory for the
Oracle software installation owner, unless that Oracle
software is Oracle Grid Infrastructure deployed for a
cluster.

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 37


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

Directory Description

Oracle base directory for user grid. The Oracle home (Grid
home) for Oracle Grid Infrastructure for a cluster
/u01/app/grid installation is located outside of the Grid user. There can be
only one Grid home on a server, and only one Grid software
installation owner.

The Grid home contains log files and other administrative


files.

Subtree for database administration files

/u01/app/oracle/admin/

Subtree for support log files

/u01/app/oracle/admin/TAR

admin subtree for database named “sales”

/u01/app/oracle/admin/db_sales/

admin subtree for database named “dwh”

/u01/app/oracle/admin/db_dwh/

Subtree for recovery files

/u01/app/oracle/fast_recovery_area/

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 38


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

Directory Description

Recovery files for database named “sales”

/u01/app/oracle/fast_recovery_area/db_sales

Recovery files for database named “dwh”

/u01/app/oracle/fast_recovery_area/db_dwh

Oracle data file directories

/u02/app/oracle/oradata

/u03/app/oracle/oradata

/u04/app/oracle/oradata

Common path for Oracle software products other than


Oracle Grid Infrastructure for a cluster
/u01/app/oracle/product/

Oracle home directory for Oracle Database 1, owned by


Oracle Database installation owner account oracle
/u01/app/oracle/product/12.2.0/dbhome_1

Oracle home directory for Oracle Database 2, owned by


Oracle Database installation owner account oracle
/u01/app/oracle/product/12.2.0/dbhome_2

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 39


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

Directory Description

Oracle home directory for Oracle Database 2, owned by


Oracle Database installation owner account oracle2
/u01/app/oracle2/product/12.2.0/dbhome_2

Oracle home directory for Oracle Grid Infrastructure for a


standalone server, owned by Oracle Database and Oracle
/u01/app/oracle/product/12.2.0/grid Grid Infrastructure installation owner oracle.

Oracle home directory for Oracle Grid Infrastructure for a


cluster (Grid home), owned by user grid before installation,
/u01/app/12.2.0/grid and owned by root after installation.

9. Write steps for creating a database from template with Database


configuration Assistant.
Ans:
10. Graphically draw the diff. b/w logical storage structure and oracle
automatic storage management.

Ans: What is Automatic Storage Management?

Automatic Storage Management (ASM) is an integrated, high-performance database file system


and disk manager. ASM is based on the principle that the database should manage storage
instead of requiring an administrator to do it. ASM eliminates the need for you to directly
manage potentially thousands of Oracle database files.

ASM groups the disks in your storage system into one or more disk groups. You manage a small
set of disk groups and ASM automates the placement of the database files within those disk
groups.

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 40


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

ASM provides the following benefits:

• Striping—ASM spreads data evenly across all disks in a disk group to optimize
performance and utilization. This even distribution of database files eliminates the need
for regular monitoring and I/O performance tuning.

For example, if there are six disks in a disk group, pieces of each ASM file are written to
all six disks. These pieces come in 1 MB chunks known as extents. When a database file
is created, it is striped (divided into extents and distributed) across the six disks, and
allocated disk space on all six disks grows evenly. When reading the file, file extents are
read from all six disks in parallel, greatly increasing performance.

• Mirroring—ASM can increase availability by optionally mirroring any file. ASM mirrors at
the file level, unlike operating system mirroring, which mirrors at the disk level.
Mirroring means keeping redundant copies, or mirrored copies, of each extent of the
file, to help avoid data loss caused by disk failures. The mirrored copy of each file extent
is always kept on a different disk from the original copy. If a disk fails, ASM can continue
to access affected files by accessing mirrored copies on the surviving disks in the disk
group.

ASM supports 2-way mirroring, where each file extent gets one mirrored copy, and 3-
way mirroring, where each file extent gets two mirrored copies.

• Online storage reconfiguration and dynamic rebalancing—ASM permits you to add or


remove disks from your disk storage system while the database is operating. When you
add a disk, ASM automatically redistributes the data so that it is evenly spread across all
disks in the disk group, including the new disk. This redistribution is known as
rebalancing. It is done in the background and with minimal impact to database
performance. When you request to remove a disk, ASM first rebalances by evenly
relocating all file extents from the disk being removed to the other disks in the disk
group.
• Managed file creation and deletion—ASM further reduces administration tasks by
enabling files stored in ASM disk groups to be Oracle-managed files. ASM automatically
assigns filenames when files are created, and automatically deletes files when they are
no longer needed. For information about Oracle-managed files, see Oracle Database
Administrator's Guide.

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 41


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

Introduction to Logical Storage Structures


Oracle Database allocates logical space for all data in the database. The logical units of database space
allocation are data blocks, extents, segments, and tablespaces. At a physical level, the data is stored in data
files on disk (see Chapter 11, "Physical Storage Structures"). The data in the data files is stored in operating
system blocks.

Figure 12-1 is an entity-relationship diagram for physical and logical storage. The crow's foot notation
represents a one-to-many relationship.

Figure 12-1 Logical and Physical Storage

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 42


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

Description of "Figure 12-1 Logical and Physical Storage"

Logical Storage Hierarchy


Figure 12-2 shows the relationships among data blocks, extents, and segments within a tablespace. In this
example, a segment has two extents stored in different data files.

Figure 12-2 Segments, Extents, and Data Blocks Within a Tablespace

11. What are initialization parameters? Diff. b/w static and dynamic
parameters with example of each.

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 43


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

Ans: Initialization Parameter File


• Initialization Parameter Files specify location and size limits of
various structures as well as connection limits.
One of two types of files:

• Text-based: init<SID>.ora (init.ora or PFILE)


• Server-side binary: spfile<SID>.ora (spfile.ora or SPFILE)

• Instance looks for SPFILE in default location otherwise the


startup command can specify PFILE.
• Default location:
• C:\APP\ADMINISTRATOR\ADMIN\mydb\PFILE\init.ora
• $ORACLE_HOME\DATABASE
• $ORACLE_HOME\DBS
Initialization Parameter File
Two broad categories of Initialization Parameters:

• Basic Initialization Parameters. (when creating a new database)


• Advanced Initialization Parameters. (283 parameters in total)
Parameter Examples:
• CONTROL_FILES: One or more control file names
• DB_FILES: Maximum number of database files
• PROCESSES: Maximum number of OS user processes that can
simultaneously connect
• DB_BLOCK_SIZE: Standard database block size used by all tablespaces
• DB_CACHE_SIZE: Size of the standard block buffer cache
• SGA_TARGET: Total size of all SGA components
• MEMORY_TARGET: Oracle system-wide usable memory
• PGA_AGGREGATE_TARGET: Amount of PGA memory for all server processes
• SHARED_POOL_SIZE: Size of shared pool (in bytes)
• UNDO_MANAGEMENT: Undo space management mode to be used
29/02/16
Initialization Parameter File
• Use SQL Plus to view parameters and their values using.
• SELECT name, value FROM v$parameter;
• Read a particular parameter.
• SHOW parameter SHARED_POOL_SIZE;
Initialization Parameter File
Static Parameters:

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 44


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

• Can be changed only in the parameter file.


• Require restarting the instance before taking effect.
Dynamic Parameters:

• Can be changes while database is online.


• Can be altered at session and system level.
• Are valid for duration of session.
• Are changed by using ALTER SESSION and ALTER SYSTEM commands.

Initialization Parameter File


SQL> ALTER SESSION
SET NLS_DATE_FORMAT ='mon dd yyyy';
Session altered.
SQL> SELECT SYSDATE FROM dual;
SYSDATE
-----------

SQL> ALTER SYSTEM SET SEC_MAX_FAILED_LOGIN_ATTEMPTS=2


COMMENT='Reduce from 10 for tighter security.' SCOPE=SPFILE;
System altered.
Initialization Parameter File

• Starting-up with a Non-default Server Parameter File:


• (create a one-line text initialization parameter file that contains only the
SPFILE parameter location.
• Example: create file init.ora and write following line inside.
• SPFILE = C:\ORACLE_HOME\DATABASE\SPFILE.ORA
• Store init.ora in c:\test\
• Start up the instance pointing to this file:
• STARTUP PFILE = C:\TEST\INIT.ORA

Creating SPFILE
• Server Parameter Files are binary files that exist only on server and a
called from client location to start-up database.
• Can be created using the CREATE SPFILE statement.
• Connect SQL PLUS as SYSDBA then:
• Syntax: create SPFILE from PFILE;
• Example : CREATE SPFILE
FROM PFILE = ‘$ORACLE_HOME/dbs/init.ora’;
CREATE SPFILE = ‘mySPFILE.ora’

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 45


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

FROM PFILE = ‘$ORACLE_HOME/dbs/init.ora’;


• Oracle database uses default server parameter filename.
12. What are diff. stages of oracle instance start up and shut down.
Ans:
start-up Database:

• Connect with SQL Plus as SYSDBA to start-up.


• Starting an instance and Mounting & Opening Database:
1. STARTUP
(normal database operation; instance started; database is mounted and
opened. Valid users can connect to database and perform access
operations)
• Starting an instance and Mounting a Database:
2. STARTUP MOUNT
(starting database without opening it; allows to perform maintenance
operations. For example enabling disabling redo log archiving options. To
perform full database recovery)

Start-up Database
• Starting an instance without Mounting a Database:
3. STARTUP NOMOUNT
(Typically used only during database creation)
• Restricting access to an instance at startup:
4. STARTUP RESTRICT
(To start instance and optionally mount it and open a database but restrict
access only to administrative personnel.
Can be used in combination with mount, no mount and open modes.
Generally used to import or export data.
To temporarily prevent users from using data.
To perform migration or upgrade operations)
Start-up Database
• Forcing an instance to start:
5. STARTUP FORCE
(rarely used; when experiencing problems to startup or unable to
shutdown properly)

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 46


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

• Starting up, Mounting, Starting Complete Media Recovery:


6. STARTUP OPEN RECOVER
(have recovery process automatically start, if media recovery is required)
• Automatic Database Startup at Operating System Start
Shut Down Database:

• Shutting Down a database in normal situations:


1. SHUTDOWN
2. SHUTDOWN NORMAL
(No new connections are allowed.
Waits for all currently connected users to disconnect.)
• Shutting Down immediately:
3. SHUTDOWN IMMEDIATE
(No new connections are allowed.
No new transactions are allowed to be started.
Any uncommitted transactions are rolled back.
Does not wait for connected users to disconnect themselves.)

4. SHUTDOWN TRANSACTIONAL
• (No new connections are allowed.
• No new transactions are allowed.
• Waits for all ongoing transactions to get completed.
• Any connected users are disconnected right after completing ongoing
transactions.)
• Shutting Down a database instantaneously:
5. SHUTDOWN ABORT
• (No new connections or transactions are allowed.
• Current SQL statements being processed are terminated.
• Uncommitted transactions are not rolled back.
• Does not wait for users to disconnect themselves. Disconnects them all
M.Sc.IT 2015

13. What is Optimal Flexible Architecture (OFA)? Elaborate with


example.

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 47


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

Ans:Repeate
14. Write steps for creating database from template with Database
Configuration Assistant.
Ans:Repeate
15. Diff. b/w system privileges and object privilege with example of
each.
Ans: What is the difference between system and object privileges?
First off, let’s define what a privilege is in a database. In a database, every user account can be granted a number of privileges,
which are also known as permissions. These privileges allow a particular user account to do certain things, like DELETE and
UPDATE certain tables, CREATE a database, SELECT from a certain table, and many other things.

In Oracle, Microsoft’s SQL Server, and in Sybase Adaptive Server privileges are further divided into two different categories: 1.
system privileges and 2. object privileges. What’s the difference between system and object privileges? Well, lets go through an
explanation of each one, and then we’ll discuss the differences between the two.

System privileges
System privileges are privileges given to users to allow them to perform certain functions that deal with managing the database
and the server . Most of the different types of permissions supported by the database vendors fall under the system privilege
category. Let’s go through some examples of system privileges in Oracle and SQL Server.

Examples of Oracle system privileges

• CREATE USER. The CREATE USER permission, when granted to a database user, allows that database user to create
new users in the database.
• CREATE TABLE. The CREATE TABLE permission, when granted to a database user, allows that database user to create
tables in their own schema. This type of privilege is also available for other object types – like stored procedures and
indexes.
• CREATE SESSION. The CREATE SESSION permission, when granted to a database user, allows that database user to
connect to the database.

Examples of Microsoft SQL Server System Privileges

• BACKUP DATABASE. The BACKUP DATABASE permission, when granted to a database user, allows that database user
to create backups of the databases on the server.
• CREATE DATABASE. The CREATE DATABASE permission, when granted to a database user, allows that database user
to create new databases on the server.
• SHUTDOWN. The SHUTDOWN permission, when granted to a database user, allows that database user to issue a
command to shutdown the server.

Object privileges
Object privileges are privileges given to users so that they can perform certain actions upon certain database objects –
where database objects are things like tables, stored procedures, indexes, etc. Some examples of object privileges include
granting a particular database user the right to DELETE and/or SELECT from a particular table. This is done using the GRANT
clause, which you can read more about here: SQL GRANT.

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 48


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

16. What is database schema? Explain diff. schema objects in oracle


database.
Ans: A schema is a collection of database objects. A schema is owned by a database user and
has the same name as that user. Schema objects are logical structures created by users.
... Objects in the same schema can use storage in different tablespaces, and a tablespace can
contain data from different schemas.

Schema Objects

This chapter discusses the different types of database objects contained in a user's
schema. It includes:

• Tables
• Views
• Materialized Views
• Dimensions
• The Sequence Generator
• Synonyms
• Indexes
• Index-Organized Tables
• Application Domain Indexes
• Clusters
• Hash Clusters

Each user owns a single schema. Schema objects can be created and manipulated
with SQL and include the following types of objects:

• Clusters
• Database links
• Database triggers
• Dimensions
• External procedure libraries

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 49


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

• Indexes and index types


• Java classes, Java resources, and Java sources
• Materialized views and materialized view logs
• Object tables, object types, and object views
• Operators
• Sequences
• Stored functions, procedures, and packages
• Synonyms
• Tables and index-organized tables
• Views

Tables

Tables are the basic unit of data storage in an Oracle database. Data is stored
in rows and columns. You define a table with a table name (such as employees) and set

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 50


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

of columns. You give each column a column name (such as employee_id, last_name,
and job_id), a datatype (such as VARCHAR2, DATE, or NUMBER), and a width. The width can
be predetermined by the datatype, as in DATE. If columns are of the NUMBER datatype,
define precision and scale instead of width. A row is a collection of column
information corresponding to a single record.

You can specify rules for each column of a table. These rules are called integrity
constraints. One example is a NOT NULL integrity constraint. This constraint forces the
column to contain a value in every row.

After you create a table, insert rows of data using SQL statements. Table data can
then be queried, deleted, or updated using SQL.

Views

A view is a tailored presentation of the data contained in one or more tables or other
views. A view takes the output of a query and treats it as a table. Therefore, a view
can be thought of as a stored query or a virtual table. You can use views in most
places where a table can be used.

For example, the employees table has several columns and numerous rows of
information. If you want users to see only five of these columns or only specific rows,
then you can create a view of that table for other users to access.

Figure 10-5 shows an example of a view called STAFF derived from the base
table employees. Notice that the view shows only five of the columns in the base table.

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 51


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

Figure 10-5 An Example of a View

Dimensions

A dimension defines hierarchical (parent/child) relationships between pairs of


columns or column sets. Each value at the child level is associated with one and only
one value at the parent level. A hierarchical relationship is a functional
dependency from one level of a hierarchy to the next level in the hierarchy. A
dimension is a container of logical relationships between columns, and it does not
have any data storage assigned to it.

Synonyms

A synonym is an alias for any table, view, materialized view, sequence, procedure,
function, or package. Because a synonym is simply an alias, it requires no storage
other than its definition in the data dictionary.

Synonyms are often used for security and convenience. For example, they can do the
following:

• Mask the name and owner of an object


• Provide location transparency for remote objects of a distributed database
• Simplify SQL statements for database users
• Enable restricted access similar to specialized views when exercising fine-
grained access control

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 52


Database Administration & Management (IT-3441) Last 5 Years Solved Papers

Indexes

Indexes are optional structures associated with tables and clusters. You can create
indexes on one or more columns of a table to speed SQL statement execution on
that table. Just as the index in this manual helps you locate information faster than if
there were no index, an Oracle index provides a faster access path to table data.
Indexes are the primary means of reducing disk I/O when properly used.

You can create many indexes for a table as long as the combination of columns
differs for each index. You can create more than one index using the same columns if
you specify distinctly different combinations of the columns. For example, the
following statements specify valid combinations:

CREATE INDEX employees_idx1 ON employees (last_name, job_id);


CREATE INDEX employees_idx2 ON employees (job_id, last_name);

17. What is recovery, write steps for recovering instance, data file and
control file.
Ans: Repeated
18. What is database backup? Elaborate diff. types and strategy of
backup.
Ans: Repeated

Hafiz M. Saif-ur-Rehman ([email protected]) Lecturer@ Iqra Girls College, Sargodha 53

You might also like