You are on page 1of 20

Database Administration

and Management

Prepared By: M. Ahsan Khalid


Lecture 1

• Introduction to Course
• Learning Outcome
• Definition of DBA
• Responsibilities of DBA
Book Reference

• Ruth Baylis. “Oracle Database Administrator’s Guide”, 10g Release, 2006


Career Opportunities

• Database Administrator (DBA)


• Database Developer
• Data Engineer
• Database Consultant
• Database Administrator Manager
• Database Architect
• Cloud Database Administrator
Definition

• Database Administration (DBA) is a critical function within the realm of


information technology that involves the management, maintenance, and
optimization of databases. A database administrator, commonly referred to
as a DBA, is responsible for ensuring the integrity, security, and
performance of databases that store and manage an organization's data.
Responsibilities of DBA
• Database Design: DBAs are involved in designing the structure and layout of databases to
efficiently store and organize data. This includes determining the appropriate data model,
defining tables, relationships, and constraints, and optimizing database schema for
performance and scalability.
• Installation and Configuration: DBAs are tasked with installing and configuring database
management systems (DBMS) such as Oracle, Microsoft SQL Server, MySQL, or MongoDB.
They ensure that the database software is properly installed, configured, and optimized
according to the organization's requirements.
• Security Management: DBAs implement security measures to protect databases from
unauthorized access, data breaches, and cyber threats. This includes setting up user accounts
and permissions, implementing encryption, auditing database activities, and applying
security patches and updates.
• Backup and Recovery: DBAs develop and maintain backup and recovery strategies to
safeguard data against loss or corruption. They schedule regular backups, perform database
backups and restores, and test recovery procedures to ensure data integrity and business
continuity.
Responsibilities of DBA
• Performance Tuning: DBAs monitor and optimize database performance to ensure efficient data
processing and retrieval. This involves analyzing query performance, identifying bottlenecks,
optimizing indexes, and tuning database parameters to improve overall system performance.
• Capacity Planning: DBAs forecast future storage and processing needs based on current and
projected data growth. They assess database usage patterns, monitor resource utilization, and
plan for scalability by adding storage, memory, or processing power as needed.
• Data Migration and Integration: DBAs oversee the migration of data between different database
systems or platforms and ensure seamless integration with other applications and systems. They
develop data migration scripts, perform data validation, and resolve compatibility issues to ensure
data consistency and accuracy.
• Monitoring and Maintenance: DBAs monitor database health and performance using monitoring
tools and dashboards. They proactively identify and troubleshoot issues, apply patches and
upgrades, and perform routine maintenance tasks to keep databases running smoothly.
• Documentation and Compliance: DBAs maintain documentation related to database
configurations, procedures, and best practices.
Oracle server
• An Oracle server typically refers to a database server developed and
marketed by Oracle Corporation. Oracle Database is a multi-model
database management system and one of the most widely used relational
database management systems (RDBMS). It is commonly used for
managing and storing large volumes of data in various industries such as
finance, telecommunications, manufacturing, and government sectors.
• Oracle Database offers features such as scalability, high availability,
security, and robust data management capabilities. It supports SQL
(Structured Query Language) for querying and managing data and also
provides support for various programming languages and development
frameworks.
Oracle Instance

• An Oracle instance refers to the combination of memory structures and


background processes that constitute a running Oracle database. When an
Oracle database is started, an instance is created. The instance manages the
database's operations, including managing memory, processing SQL
queries, coordinating access to data files, and maintaining data consistency
and integrity.
Components of Oracle Instance
• System Global Area (SGA): The SGA is a shared memory region that contains data and
control information for the Oracle instance. It consists of various components such as the
database buffer cache, the shared pool (containing the library cache and data dictionary
cache), and the redo log buffer.
• Process structures: These are the background processes that perform various tasks to
support the functioning of the database. Key background processes include:
• Oracle Database Background Processes: These include processes like PMON (Process Monitor), SMON
(System Monitor), LGWR (Log Writer), DBWR (Database Writer), CKPT (Checkpoint), and others. These
processes handle tasks such as process monitoring, database recovery, writing data to disk, and managing
checkpoints.
• User Processes: These are processes initiated by users or applications connecting to the database. Each
user process communicates with the Oracle instance to perform tasks like executing SQL queries or
transactions.

• Control Files: Control files are binary files that store metadata about the database, including
the database name, data file locations, log file names, and checkpoints.
Session
A session refers to a logical connection established between a user or an application and the database. When a
user or an application initiates a connection to the database, a session is created, allowing them to interact with
the database by executing SQL queries, transactions, or other database operations.
Here are some key aspects of a database session:
• Connection Establishment: A session begins when a user or an application successfully connects to the
database using valid credentials (username and password) and establishes a network connection.
• Resource Allocation: Once the connection is established, the DBMS allocates resources to the session, such
as memory and CPU resources, to handle the user's requests and execute SQL statements.
• Execution Context: Each session has its own execution context, which includes temporary storage areas,
cursor states, and other session-specific settings. This allows multiple users or applications to interact with
the database concurrently without interfering with each other.
• Transaction Management: Sessions can initiate transactions, which are sequences of database operations
that are executed as a single unit of work. Transactions can be committed (made permanent) or rolled back
(undone) based on the outcome of the operations.
• Session State: The session maintains a state that reflects its current activity, including the SQL statements
executed, the results returned, and any changes made to the database. This state persists until the session is
terminated or disconnected.
• Security Context: Sessions operate within the security context of the user who initiated the connection,
which determines the privileges and access rights granted to the session for accessing database objects.
Oracle Database
Oracle Database is a relational database management system (RDBMS) developed and marketed by Oracle Corporation. It is
one of the most widely used database management systems in the world, powering a vast array of applications and systems
across various industries.
Key features of Oracle Database include:
• Scalability: Oracle Database is designed to scale from small single-server installations to large enterprise-level
deployments spanning multiple servers and data centers. It can handle massive volumes of data and support thousands of
concurrent users.
• High Availability: Oracle Database offers features such as Real Application Clusters (RAC), Data Guard, and Automatic
Storage Management (ASM) to ensure high availability and data protection. These features enable failover, data
replication, and automatic recovery to minimize downtime and data loss.
• Security: Oracle Database provides comprehensive security features to protect data against unauthorized access,
including role-based access control (RBAC), encryption, auditing, and data masking. It also supports compliance
requirements such as GDPR, HIPAA, and PCI DSS.
• Performance: Oracle Database is optimized for performance and efficiency, with features like query optimization,
indexing, caching, and in-memory processing. It also includes tools for monitoring and tuning database performance to
optimize resource usage and response times.
• Data Management: Oracle Database supports a wide range of data types, including structured, semi-structured, and
unstructured data. It provides powerful data management capabilities such as partitioning, compression, data
deduplication, and advanced analytics.
• Development Tools: Oracle Database offers a suite of development tools and frameworks for building and deploying
database applications, including Oracle Application Express (APEX), Oracle Developer Tools for Visual Studio, and Oracle
SQL Developer. It also supports programming languages such as PL/SQL, Java, and Python.
Physical Structure
• Data Files: Data files are the primary storage containers for the actual data in an Oracle database. These files store the
tables, indexes, and other database objects. In Oracle, data files are typically stored in the file system of the underlying
operating system.
• Control Files: Control files are binary files that contain metadata about the database structure, such as the database
name, data file locations, log file names, and checkpoint information. Control files are critical for database startup and
recovery operations.
• Redo Log Files: Redo log files record all changes made to the database, including insertions, updates, and deletions.
They are crucial for database recovery in the event of a crash or failure. Redo log files are typically multiplexed to ensure
redundancy and reliability.
• Parameter Files: Parameter files (init.ora or spfile.ora) contain configuration parameters that control the behavior of
the Oracle instance and database. These parameters include settings related to memory allocation, database options,
and performance tuning.
• Tablespaces: Tablespaces are logical storage containers that organize and group related database objects, such as
tables and indexes. Each tablespace consists of one or more data files where the actual data is stored. Oracle databases
can have multiple tablespaces to manage data storage efficiently.
• Segments: Segments are logical storage structures within tablespaces that represent database objects such as tables,
indexes, and partitions. Each segment corresponds to a set of extents allocated for storing data. Segments can be
further divided into extents and blocks at the physical level.
• Extents: Extents are contiguous blocks of data storage allocated for a specific database object within a tablespace.
When a database object requires more space, Oracle allocates additional extents to accommodate the data.
• Blocks: Blocks are the smallest unit of storage within an Oracle database. Each block typically consists of a fixed number
of bytes (commonly 8 KB) and is used to store data or metadata. Blocks are organized into data files and are the basic
Memory Structure

• The memory structure refers to the way Oracle manages memory within the
database instance for various operations and data storage. It consists of
several components that collectively handle the storage and manipulation
of data.
Memory Structure
• System Global Area (SGA):
• The SGA is the primary shared memory area for an Oracle instance.
• It is allocated when the instance starts up and contains data and control information shared
among users connected to the instance.
• Key components of the SGA include:
• Database Buffer Cache: Stores copies of data blocks read from data files, reducing disk I/O.
• Shared Pool: Contains shared memory structures such as SQL statements, data dictionary cache, and
control structures.
• Redo Log Buffer: Stores redo entries, which are changes made to the database.
• Large Pool: Used for large memory allocations like backup and restore operations, parallel execution,
and I/O server processes.

• Program Global Area (PGA):


• The PGA is a memory region that contains data and control information for a single Oracle server
process or a background process.
• Each user process has its own PGA.
• The PGA includes memory structures such as the sort area used for sorting operations, session
memory for storing session variables, and private SQL areas for processing SQL statements.
Memory Structure
• Redo Log Buffer:
• The redo log buffer temporarily holds redo log entries before they are written to the redo log files.
• Redo log entries record changes made to the database, providing the information needed to recover the
database in the event of a failure.

• Java Pool:
• This is a memory area within the SGA dedicated to Java execution.
• It stores all session-specific Java code and data within the SGA.

• Streams Pool:
• The Streams pool is used for Oracle Streams, a feature for data replication and integration.
• It caches information needed for Oracle Streams operations.

• Large Pages:
• Large pages are used to manage the SGA and other shared memory structures more efficiently on some
operating systems.
• By using large pages, Oracle can reduce the overhead associated with managing large amounts of
memory.
User Process
• A user process refers to a session established by a user application
connecting to the database. Following sequence of steps may be required to
accomplish a complete or comprehensive user process:
• Connection Establishment
• Authentication & Authorization
• Session Initialization
• SOL Statement
• Resource Allocation and management
• Error Handling
• Termination
Server Process
• Server processes are background processes that handle the communication between
client applications and the database server. These processes are responsible for executing
tasks on behalf of connected user sessions and managing various aspects of database
operations. Following sequence of steps may be required to accomplish a complete or
comprehensive Server process:
• Connection Handling
• Session management
• SQL statement Execution
• Transaction Management
• Resource Allocation
• Error Handling and logging
• Parallel Processing
• Background Tasks
Background Processes
• Background processes are a set of server processes that perform various administrative and
maintenance tasks to ensure the smooth operation and integrity of the database. These processes run
independently of user sessions and handle tasks such as I/O operations, memory management, and
system monitoring. Here are some common background processes in Oracle:
• DBWn (Database Writer): The primary purpose of the Database Writer process (DBWn) is to ensure
the persistence of changes made to database blocks in memory by writing them to disk. This activity
is essential for maintaining data consistency and integrity, as it ensures that changes made by
transactions are durable and recoverable in the event of a system failure.
• LGWR (Log Writer): The Log Writer process is responsible for writing redo log entries to the redo log
files. Redo log entries record changes made to the database, providing a mechanism for database
recovery and transaction durability.
• CKPT (Checkpoint): A checkpoint ensures that all committed changes are written to the data files,
thereby reducing the time required for database recovery in the event of a failure. Checkpoints can
also be initiated explicitly by database administrators using SQL commands or automatically during
certain operations such as tablespace offline/online, ALTER DATABASE BEGIN BACKUP, or ALTER
SYSTEM CHECKPOINT.
• SMON (System Monitor): The System Monitor process performs instance recovery and crash
recovery in the event of a failure. It also cleans up temporary segments and frees resources associated
with terminated transactions.
Background Processes
• PMON (Process Monitor): The Process Monitor process is responsible for monitoring and cleaning
up database resources associated with terminated or disconnected sessions. It also performs
instance recovery if a user process fails or loses connection to the database.
• MMON (Manageability Monitor): The Manageability Monitor process collects statistics and
metrics related to database performance and resource usage. It provides data for various Oracle
performance monitoring and tuning features.
• MMNL (Manageability Monitor Light): The MMNL process is responsible for collecting
performance statistics and metrics related to database performance and resource usage. It
operates as part of the manageability infrastructure in Oracle databases and provides data for
various performance monitoring and tuning features.
• DBRM (Database Resource Manager): The Database Resource Manager process manages and
allocates system resources such as CPU and memory among different database sessions and
consumer groups based on predefined resource allocation policies.
• ARCn (Archiver): Archive processes (ARCn) are responsible for copying filled redo log files to
archival storage destinations (such as tape or remote disk) for backup and recovery purposes.
• SMCO (Space Management Coordinator): The Space Management Coordinator process
coordinates space management tasks such as segment space management and extent allocation
within the database.

You might also like