Database Administration · Unit 3
Database Startup, Shutdown and Initialization
Exam-focused notes for Database Startup, Shutdown and Initialization (Database Administration, BIT352): what the TU syllabus asks and how it has actually been tested, with 2 solved past questions from this unit.
Database Startup, Shutdown and Initialization in short
This chapter shows how to start and stop an Oracle database, and how its settings are stored. A DBA does these tasks often during maintenance, backup and recovery.
What this unit covers
- Database startup modes and commands
- Database shutdown modes and commands
- Initialization parameter files
- Spfile versus Pfile differentiation
- Oracle defined roles and their usage
Spfile versus Pfile differentiation
2081.1 · 10 marks
What is initialization parameter file? Differentiate between Spfile and Pfile. Explain some oracle defined roles with suitable example.[10]
Show solved answerHide answer
Initialization Parameter File, Spfile vs Pfile, and Oracle Defined Roles
Note: The reference notes did not contain material on this topic. The following answer is based on standard Oracle Database concepts as taught in BSc CSIT Database Administration courses.
1. Initialization Parameter File
An Initialization Parameter File (also called an init file) is a configuration file used by Oracle Database to read startup parameters when the database instance is started.
- It contains a list of key = value pairs that define how the Oracle instance behaves.
- Parameters include memory sizes, file locations, database name, number of processes, etc.
- Oracle reads this file at instance startup to configure the System Global Area (SGA), background processes, and other settings.
Example entries:
db_name = ORCL
memory_target = 512M
processes = 150
control_files = ('/u01/oradata/control01.ctl')
2. Difference Between SPFILE and PFILE
| Feature | SPFILE (Server Parameter File) | PFILE (Parameter File / init.ora) |
|---|---|---|
| Full Form | Server Parameter File | Parameter File (also called init.ora) |
| Format | Binary file | Plain text file |
| Location | Stored on the server side (managed by Oracle) | Can be stored anywhere; typically in $ORACLE_HOME/dbs/ |
| Editing | Cannot be edited manually; modified using ALTER SYSTEM command | Can be edited manually using any text editor |
| Persistence of Changes | Changes made with ALTER SYSTEM are automatically persistent across restarts | Changes must be manually saved; not automatically persistent |
| Default Name | spfile<SID>.ora | init<SID>.ora |
| Introduced In | Oracle 9i onwards | Available since early Oracle versions |
| Recommended | Yes, recommended for production use | Used for testing or when SPFILE is unavailable |
| Dynamic Changes | Supports dynamic parameter changes with SCOPE=BOTH/MEMORY/SPFILE | Does not support dynamic changes |
| Backup | Can be backed up using RMAN | Manually backed up |
Creating SPFILE from PFILE:
CREATE SPFILE FROM PFILE = '/u01/oracle/initORCL.ora';
Creating PFILE from SPFILE:
CREATE PFILE = '/u01/oracle/initORCL.ora' FROM SPFILE;
Modifying SPFILE parameter:
ALTER SYSTEM SET memory_target = 1G SCOPE = SPFILE;
3. Oracle Defined Roles
A Role in Oracle is a named group of related privileges that can be granted to users or other roles. Oracle provides several predefined (system-defined) roles to simplify privilege management.
Common Oracle Defined Roles:
a) CONNECT Role
- Grants the privilege to connect to the database.
- Historically included CREATE TABLE, CREATE VIEW, etc., but in Oracle 10g onwards it only includes the CREATE SESSION privilege.
GRANT CONNECT TO john;
-- Now john can log in to the database
b) RESOURCE Role
- Grants privileges to create database objects such as tables, sequences, procedures, triggers, etc.
- Suitable for application developers.
Privileges included:
- CREATE TABLE
- CREATE SEQUENCE
- CREATE PROCEDURE
- CREATE TRIGGER
- CREATE TYPE
GRANT RESOURCE TO john;
-- Now john can create tables, sequences, procedures, etc.
c) DBA Role
- The most powerful predefined role in Oracle.
- Grants all system privileges WITH ADMIN OPTION, meaning the user can also grant those privileges to others.
- Should be granted only to database administrators.
GRANT DBA TO admin_user;
-- admin_user now has full administrative privileges
d) SELECT_CATALOG_ROLE
- Grants SELECT privilege on all data dictionary views (DBA_* views).
- Useful for users who need to query the data dictionary without having full DBA access.
GRANT SELECT_CATALOG_ROLE TO analyst;
-- analyst can now query DBA_TABLES, DBA_USERS, etc.
e) EXP_FULL_DATABASE and IMP_FULL_DATABASE Roles
- EXP_FULL_DATABASE: Grants privileges needed to perform a full database export using Oracle Data Pump or exp utility.
- IMP_FULL_DATABASE: Grants privileges needed to perform a full database import.
GRANT EXP_FULL_DATABASE TO backup_user;
GRANT IMP_FULL_DATABASE TO restore_user;
f) SCHEDULER_ADMIN Role
- Grants privileges to manage Oracle Scheduler jobs, programs, and chains.
GRANT SCHEDULER_ADMIN TO job_manager;
Summary Table of Oracle Defined Roles
| Role | Purpose |
|---|---|
| CONNECT | Allows user to connect/login to database |
| RESOURCE | Allows creation of database objects |
| DBA | Full administrative privileges |
| SELECT_CATALOG_ROLE | Read access to data dictionary |
| EXP_FULL_DATABASE | Full database export |
| IMP_FULL_DATABASE | Full database import |
| SCHEDULER_ADMIN | Manage Oracle Scheduler |
Granting and Revoking Roles:
-- Grant a role
GRANT CONNECT, RESOURCE TO john;
-- Revoke a role
REVOKE RESOURCE FROM john;
-- Check roles granted to a user
SELECT * FROM DBA_ROLE_PRIVS WHERE GRANTEE = 'JOHN';
Key Benefit of Roles: Instead of granting individual privileges to each user, a DBA can grant a role (bundle of privileges) to multiple users, making privilege management easier and more efficient.
Database startup modes and commands
0 · 5 marks
Explain oracle database startup and shutdown modes with respective commands. [5]
Make Unit 3 stick
Practice BIT352 with flashcards & quizzes