BIT352 · TU past paper
Database Administration 2080 question paper
The complete TU 2080 exam paper for Database Administration (BIT352), all 12 questions with solved model answers written to the mark scheme.
Tap a question to open its answer.
- 110 marksOracle database architecture overviewHideAnswer
What do you mean by database management system? Mention the clear architecture of oracle database.[10]
Database Management System (DBMS) and Oracle Database Architecture
What is a Database Management System (DBMS)?
A Database Management System (DBMS) is a collection of interrelated data and a set of programs to access and manage that data. It is software that acts as an interface between the user and the database, allowing users to create, retrieve, update, and delete data in an organized and efficient manner.
Key Characteristics of DBMS:
- Data Abstraction: Hides the complexity of data storage from users
- Data Independence: Changes in data structure do not affect application programs
- Data Integrity: Ensures accuracy and consistency of data
- Data Security: Provides access control and authorization mechanisms
- Concurrent Access: Allows multiple users to access data simultaneously
- Backup and Recovery: Provides mechanisms to recover data after failures
Examples:
Oracle, MySQL, PostgreSQL, Microsoft SQL Server, MongoDB
Oracle Database Architecture
Oracle Database has a well-defined architecture consisting of two major components:
Oracle Database = Instance + Database (Physical Files)
1. Oracle Instance
An Oracle Instance is a combination of Memory Structures and Background Processes that manage database files. It exists in RAM and is created when the database is started.
A. Memory Structures (SGA - System Global Area)
The System Global Area (SGA) is a shared memory region allocated when an Oracle instance starts. It contains:
Component Description Database Buffer Cache Stores copies of data blocks read from datafiles; reduces disk I/O Shared Pool Contains Library Cache (parsed SQL, execution plans) and Data Dictionary Cache Redo Log Buffer Records all changes made to the database before writing to redo log files Large Pool Optional area for large memory allocations (backup, parallel queries) Java Pool Used for Java code and data in the JVM Streams Pool Used by Oracle Streams for data replication Additionally, each user session has a PGA (Program Global Area) - a private memory area for individual server processes.
B. Background Processes
Oracle uses several background processes to manage the database:
Process Full Name Function SMON System Monitor Performs instance recovery at startup; cleans temporary segments PMON Process Monitor Cleans up failed user processes; releases locks and resources DBWn Database Writer Writes modified (dirty) blocks from buffer cache to datafiles LGWR Log Writer Writes redo log buffer entries to redo log files CKPT Checkpoint Updates datafile headers and control files at checkpoints ARCn Archiver Copies filled redo log files to archive log destination RECO Recoverer Resolves distributed transaction failures
2. Oracle Database (Physical Storage Structures)
The physical database consists of OS files stored on disk:
A. Datafiles (.dbf)
- Store the actual data (tables, indexes, etc.)
- Each database has one or more datafiles
- Belong to a tablespace
B. Control Files
- Small binary files that record the physical structure of the database
- Contain database name, datafile locations, redo log file locations, and checkpoint information
- Critical for database startup and recovery
C. Redo Log Files
- Record all changes made to the database
- Used for database recovery in case of failure
- Oracle writes to redo log files in a circular fashion
- At least two redo log groups are required
D. Archive Log Files (Optional)
- Archived copies of filled redo log files
- Used for complete media recovery
- Required when database runs in ARCHIVELOG mode
E. Parameter File (SPFILE / PFILE)
- Contains initialization parameters for the Oracle instance
- Defines SGA size, number of processes, database name, etc.
F. Password File
- Stores passwords for privileged users (SYSDBA, SYSOPER)
3. Logical Storage Structures
Oracle also has logical structures that map to physical storage:
Database └── Tablespace (SYSTEM, SYSAUX, USERS, TEMP, UNDO) └── Segment (Table Segment, Index Segment) └── Extent (collection of contiguous blocks) └── Data Block (smallest unit, e.g., 8KB)
Oracle Architecture Diagram (Simplified)
+--------------------------------------------------+ | ORACLE INSTANCE (RAM) | | +--------------------+ +--------------------+ | | | SGA | | Background | | | | - Buffer Cache | | Processes: | | | | - Shared Pool | | SMON, PMON, DBWn | | | | - Redo Log Buffer | | LGWR, CKPT, ARCn | | | | - Large Pool | | | | | +--------------------+ +--------------------+ | +--------------------------------------------------+ | | v v +--------------------------------------------------+ | ORACLE DATABASE (DISK) | | Datafiles | Control Files | Redo Log Files | | Archive Logs | Parameter File | Password File | +--------------------------------------------------+
Summary
Component Location Purpose SGA Memory (RAM) Shared data and SQL caching PGA Memory (RAM) Per-session private data Background Processes CPU Automate database management tasks Datafiles Disk Persistent data storage Control Files Disk Database structure metadata Redo Log Files Disk Change records for recovery Note: The separation of Instance (memory + processes) and Database (disk files) is the fundamental design principle of Oracle, enabling features like crash recovery, high availability, and Oracle RAC (Real Application Clusters).
- 210 marksBackup definition and necessityHideAnswer
Explain the term backup, restore and recovery in oracle database. Also explain the different backups and recovery process with example.[10]
Backup, Restore, and Recovery in Oracle Database
Note: Reference notes were not available for this topic. The following answer is based on standard Oracle Database concepts as taught in BSc CSIT curriculum.
1. Key Terminology
Backup
A backup is a copy of data (database files, control files, archived redo logs, etc.) that can be used to reconstruct lost or damaged data. It protects the database against data loss due to hardware failure, user errors, or disasters.
"A backup is a copy of data that can be used to reconstruct data."
Restore
Restore is the process of copying backup files back to their original (or new) location. It is the physical act of placing backup files onto disk so that recovery can proceed.
Example: Copying a datafile from tape/backup location back to the original directory.
Recovery
Recovery is the process of applying redo logs (archived and online) to a restored backup to bring the database to a consistent and up-to-date state. Recovery happens after restore.
Backup --> Restore (copy files back) --> Recovery (apply redo logs) --> Database Online
2. Types of Backups in Oracle
A. Physical Backup
A copy of the actual physical files used in storing and recovering the database.
Type Description Cold Backup (Offline) Taken when database is shut down cleanly Hot Backup (Online) Taken while database is running (requires ARCHIVELOG mode) i. Cold Backup (Offline Backup)
- Database is shut down before taking backup.
- All datafiles, control files, and redo log files are copied.
- Simple but causes downtime.
Example:
SHUTDOWN IMMEDIATE; -- Copy all datafiles, controlfiles, redo logs to backup location -- (OS level copy) STARTUP;ii. Hot Backup (Online Backup)
- Database remains open and available during backup.
- Requires database to be in ARCHIVELOG mode.
- Used for 24x7 production systems.
Example using RMAN:
RMAN> BACKUP DATABASE;
B. Logical Backup
A backup of the logical data (tables, schemas, procedures) using Oracle utilities like Data Pump (expdp/impdp) or the older exp/imp.
Example:
expdp system/password FULL=Y DUMPFILE=fullbackup.dmp LOGFILE=backup.logTo restore:
impdp system/password FULL=Y DUMPFILE=fullbackup.dmp LOGFILE=restore.log
C. Full Backup
A backup of the entire database -- all datafiles, control files, and archived redo logs.
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
D. Incremental Backup
Only backs up data blocks that have changed since the last backup. Saves time and storage.
Level Description Level 0 Full baseline backup (like a full backup) Level 1 Only blocks changed since last Level 0 or Level 1 Example:
-- Level 0 (Full baseline) RMAN> BACKUP INCREMENTAL LEVEL 0 DATABASE; -- Level 1 (Changed blocks only) RMAN> BACKUP INCREMENTAL LEVEL 1 DATABASE;
E. Cumulative vs Differential Incremental
Type Backs Up Differential (default) Blocks changed since last incremental backup Cumulative Blocks changed since last Level 0 backup RMAN> BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;
3. Recovery Process in Oracle
A. Complete Recovery
Recovers the database to the most current state -- no data loss. All redo logs are applied.
Steps:
-- Step 1: Restore the database RMAN> RESTORE DATABASE; -- Step 2: Recover (apply all redo logs) RMAN> RECOVER DATABASE; -- Step 3: Open the database RMAN> ALTER DATABASE OPEN;
B. Incomplete Recovery (Point-in-Time Recovery)
Recovers the database to a specific point in time before a failure or user error (e.g., accidental table drop).
Types:
Type Description Time-based Recover up to a specific time SCN-based Recover up to a System Change Number Log sequence-based Recover up to a specific log sequence Example (Time-based):
RMAN> RUN { SET UNTIL TIME "TO_DATE('2024-01-15 10:00:00','YYYY-MM-DD HH24:MI:SS')"; RESTORE DATABASE; RECOVER DATABASE; ALTER DATABASE OPEN RESETLOGS; }Note: After incomplete recovery, database must be opened with
RESETLOGS.
C. Tablespace Recovery
Recover a single tablespace without affecting the rest of the database.
RMAN> RESTORE TABLESPACE users; RMAN> RECOVER TABLESPACE users; RMAN> ALTER TABLESPACE users ONLINE;
D. Datafile Recovery
Recover a single damaged or missing datafile.
RMAN> RESTORE DATAFILE '/u01/oradata/users01.dbf'; RMAN> RECOVER DATAFILE '/u01/oradata/users01.dbf';
4. ARCHIVELOG Mode vs NOARCHIVELOG Mode
Feature ARCHIVELOG NOARCHIVELOG Online backup Supported Not supported Complete recovery Possible Not possible Point-in-timerecovery Possible Not possible Redo log handling Filled online redo logs are archived before being reused Online redo logs are overwritten, history is lost Recovery limit Any point up to the last committed transaction Only up to the last cold backup Storage cost Higher, an archive destination must be maintained Lower To enable it:
SHUTDOWN IMMEDIATE; STARTUP MOUNT; ALTER DATABASE ARCHIVELOG; ALTER DATABASE OPEN;
5. A Complete Worked Example
Suppose the datafile
users01.dbfof a production database is lost at 11:00 AM. A Level 0 backup exists from Sunday, Level 1 backups exist from each weekday night, and the database runs in ARCHIVELOG mode.RMAN> SQL 'ALTER DATABASE DATAFILE ''/u01/oradata/users01.dbf'' OFFLINE'; RMAN> RESTORE DATAFILE '/u01/oradata/users01.dbf'; -- restore: copy from backup RMAN> RECOVER DATAFILE '/u01/oradata/users01.dbf'; -- recovery: apply redo RMAN> SQL 'ALTER DATABASE DATAFILE ''/u01/oradata/users01.dbf'' ONLINE';RMAN restores the datafile from the Level 0 image, rolls it forward with the Level 1 incrementals, then applies the archived and online redo logs generated since that backup, so the datafile is brought back to 11:00 AM with no committed transaction lost. The rest of the database stays open for users throughout.
If instead a user had dropped a critical table at 10:00 AM, the loss is logical rather than physical, so an incomplete (point-in-time) recovery to 09:59 AM would be used and the database opened with
RESETLOGS.
6. Conclusion
Backup, restore and recovery are three distinct stages of one protection strategy: backup creates the redundant copy in advance, restore puts that copy back on disk, and recovery applies redo to make it consistent and current. Oracle supports physical backups (cold and hot) and logical backups (Data Pump), full and incremental levels, and complete or point-in-time recovery. Running the database in ARCHIVELOG mode is the single decision that makes online backup and complete recovery possible, which is why every production Oracle database is configured that way.
- 310 marksPrivilege definition and importanceHideAnswer
What is the importance of privileges in database security? Explain about role in oracle datanse and write command to do following: a. Create role b. Grant system and object privileges to role c. Create user d. Assign role to user e. Drop role[10]
--- Privileges are permissions granted to users that allow them to perform specific operations on a database or its objects. They are fundamental to database security for the following reasons: 1. Access Control: Privileges ensure that o...
- 45 marksHideAnswer
What are data files? How it is related with tablespace. Write a command to add a datafile in existing tablespace named "users". [5]
Data Files and Their Relationship with Tablespace
What are Data Files?
Data files are the physical operating system files that actually store the data of an Oracle database on disk. Every piece of data stored in an Oracle database (tables, indexes, rollback segments, etc.) is ultimately written to one or more data files.
Key characteristics of data files:
- They have a physical existence on the disk (e.g.,
.dbffiles) - They store data in Oracle's internal block format
- A single data file belongs to only one tablespace
- They grow in size as more data is inserted into the database
- They can be configured to auto-extend when full
Relationship Between Data Files and Tablespace
The relationship between data files and tablespaces is a logical-to-physical mapping:
Tablespace (Logical) Data File (Physical) Logical storage unit Physical storage unit Groups related data Stores actual data on disk One tablespace can have multiple data files One data file belongs to only one tablespace - A tablespace is a logical storage container in Oracle that groups related database objects (tables, indexes, etc.).
- A data file is the physical file on the OS that backs the tablespace.
- When a tablespace runs out of space, a new data file can be added to extend its capacity.
Diagram:
DATABASE | +-- TABLESPACE (Logical) | +-- Data File 1 (.dbf) [Physical] | +-- Data File 2 (.dbf) [Physical]
Command to Add a Data File to Existing Tablespace "USERS"
ALTER TABLESPACE users ADD DATAFILE '/u01/oradata/orcl/users02.dbf' SIZE 100M AUTOEXTEND ON NEXT 10M MAXSIZE 500M;Explanation of each clause:
Clause Description ALTER TABLESPACE usersSpecifies the existing tablespace to modify ADD DATAFILEAdds a new physical data file to the tablespace '/u01/oradata/orcl/users02.dbf'Full path and name of the new data file SIZE 100MInitial size of the data file (100 Megabytes) AUTOEXTEND ONAllows the file to grow automatically when full NEXT 10MExtends by 10 MB each time it auto-extends MAXSIZE 500MMaximum size the file can grow to Note: The path must be accessible by the Oracle database server process. On Windows, the path would be like
'C:\oradata\users02.dbf'. - They have a physical existence on the disk (e.g.,
- 55 marksSQL*PLUS definition and functionalitiesHideAnswer
What is SQLPLUS? Also explain the functionalities of SQLPLUS that the ORACLE DBA can use. [5]
SQL\PLUS is an interactive and batch query tool (command-line interface) provided by Oracle Corporation that comes bundled with the Oracle Database software. It allows users and Database Administrators (DBAs) to: - Interact directly with...
- 65 marksOracle RAC conceptsHideAnswer
Explain the term oracle RAC and oracle ASM. [5]
Note: The reference notes did not contain material on this topic. The following answer is based on standard Oracle database concepts as taught in database administration courses. --- Oracle RAC is a cluster database option that allows mu...
- 75 marksOracle Data Guard conceptsHideAnswer
What is oracle data guard? Explain its importance in oracle database. [5]
Oracle Data Guard is a high availability, data protection, and disaster recovery solution provided by Oracle Corporation. It creates, maintains, and monitors one or more standby databases as copies of the primary (production) database. I...
- 85 marksRoles and responsibilities of database admHideAnswer
Explain the term Database administrator (DBA) and describe the different roles of DBA. [5]
--- A Database Administrator (DBA) is a person (or a group of persons) who is responsible for the overall management, control, and maintenance of a database system. The DBA has central authority over the database and acts as an interface...
- 95 marksJob scheduling in oracle databaseHideAnswer
What is Job Scheduling in oracle database? How DBMS_ SCHEDULER Works? Explain the different component of scheduler. [5]
Note: Reference notes were not available for this topic. The following answer is based on standard Oracle Database documentation and is correct for TU BSc CSIT curriculum. --- Job Scheduling in Oracle Database is the process of automatin...
- 105 marksOracle Net service componentsHideAnswer
Explain the different oracle net service components. [5]
Note: The reference notes did not contain this topic directly. The following answer is based on standard Oracle Net Services curriculum as taught in TU BSc CSIT Database Administration courses. --- Oracle Net Services is a suite of netwo...
- 115 marksDatabase auditing conceptsHideAnswer
What is database auditing? Explain the standard auditing in oracle database. [5]
Database auditing is the process of monitoring and recording selected user database actions performed on a database. It involves tracking who accessed the database, what operations were performed, when they were performed, and from where...
- 125 marksSQL Tuning Advisor usageHideAnswer
Explain how SQL tuning advisor can be used to tune your database. [5]
--- SQL Tuning Advisor is an Oracle Database built-in diagnostic tool that automatically analyzes SQL statements and provides recommendations to improve their performance. It acts as an expert system that examines problematic SQL and sug...