Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Database Mids Notes

Chapter No. 1: The Evolution of the Relational Database

Basics of Relational Model: The relational model revolutionized data management by


introducing the concept of tables, where data is organized in rows and columns. It ensures
data integrity through primary and foreign key relationships, enabling efficient querying and
manipulation of data.

Summary of Oracle Database Features: Oracle Database offers a comprehensive set of


features including high availability, scalability, security, and performance optimization.
These features include Real Application Clusters (RAC), Data Guard, encryption, access
controls, and query optimization.

Databases and Instances: In Oracle, a database is a collection of data files and control files
managed by a set of background processes. An instance is the set of memory structures and
background processes that access a database. Multiple instances can access the same database
concurrently.

Oracle Database Structure: Oracle databases have a hierarchical structure consisting of


tablespaces, which contain segments (such as tables and indexes), extents, and data blocks.
Control files and redo log files are also part of the database structure.

Files of a database:

• Control Files: Control files contain metadata about the physical structure of the
database and are crucial for database recovery.
• Datafiles: Datafiles store the actual data of the database, including tables, indexes,
and other objects.
• Redo Logfiles: Redo log files record changes made to data in the database and are
essential for recovery in case of system failure.
• Archive Logs: Archive logs are backups of redo logs, enabling point-in-time
recovery of the database.
Database Initialization: Database initialization involves setting parameters and options to
configure the database environment. This includes specifying memory allocation, defining
storage structures, and setting up initialization parameters.

Chapter No. 2: Oracle Architecture

Deploying Physical Components: Oracle architecture consists of physical components such


as datafiles, control files, and redo log files, which are stored on the file system.

Control Files: Control files are critical to the Oracle database as they maintain metadata
about the physical and logical structure of the database, including the names and locations of
datafiles and redo log files.

Setting the Database Block Size: The database block size is a fundamental parameter that
determines the size of data blocks within the database. It affects I/O performance and storage
efficiency.

Datafiles: Datafiles store the actual data of the database, including tables, indexes, and other
objects. They are allocated in tablespaces, and their size can be managed dynamically.

Redo Logfiles: Redo log files record all changes made to data in the database. They are
crucial for database recovery and are typically mirrored to ensure data integrity.

ARCHIVELOG mode and automatic archiving: ARCHIVELOG mode enables automatic


archiving of redo logs, providing a backup in case of system failure. It allows for point-in-
time recovery of the database.

Instance Memory and Processes: Oracle instance memory consists of the System Global
Area (SGA) and the Program Global Area (PGA). Background processes manage various
tasks such as managing memory, managing storage, and handling client connections.

Background Processes for an Instance: Background processes include the System Monitor
(SMON), Process Monitor (PMON), and others, which perform tasks like instance recovery,
managing locks, and maintaining the database buffer cache.
The Data Dictionary: The data dictionary is a central repository of metadata about the
database, including information about tables, indexes, users, and privileges. It is stored in
special tables within the Oracle database.

Chapter No. 4: Oracle Data Structures

Datatypes: Oracle supports various datatypes including numeric, character, date, LOB
(Large Objects), and user-defined types. Each datatype has specific storage requirements and
behaviors.

Basic data structures: Basic data structures in Oracle include tables, which organize data
into rows and columns, and indexes, which improve query performance by providing fast
access to data.

Additional data structures: Additional data structures include clusters, partitions, and
tablespaces, which provide further organization and optimization of data storage and access.

Data design: Data design involves defining tables, columns, constraints, and relationships to
ensure data integrity and optimize performance. It includes normalization, denormalization,
and careful consideration of data types and indexing.

Constraints: Constraints enforce rules on data integrity, such as primary key, foreign key,
unique, and check constraints. They ensure that data remains consistent and valid within the
database.

Indexes: Indexes improve query performance by providing fast access to data based on
specified columns. They can be created on tables to speed up data retrieval for commonly
used queries

File System vs. Database System Comparison:

File System:

• Advantages:
o Simplicity: File systems are simple and easy to understand, making them
accessible for basic data storage needs.
o Flexibility: Users have direct control over how files are organized and
accessed.
o Performance: In certain cases, file systems can offer faster access to data,
especially when dealing with simple data structures.
• Disadvantages:
o Data Redundancy: Each application may create its own files, leading to
duplication of data and inconsistency.
o Limited Querying: File systems lack sophisticated querying capabilities,
making it difficult to perform complex searches and analysis.
o Concurrency Issues: Managing concurrent access to files can be challenging,
leading to potential data corruption or loss.

Database System:

• Advantages:
o Data Integrity: Databases enforce data integrity constraints, ensuring
consistency and reducing redundancy.
o Query Language: Database systems offer powerful query languages like
SQL, allowing users to perform complex operations on data.
o Concurrency Control: Database systems manage concurrent access to data,
ensuring transactions are executed safely and reliably.
• Disadvantages:
o Complexity: Database systems are more complex to set up and manage
compared to file systems.
o Overhead: They require additional resources for maintenance, indexing, and
managing metadata.
o Cost: Licensing fees and hardware requirements for database systems can be
significant compared to simple file systems.

How File System has taken over: File systems have not entirely taken over database
systems, but they remain prevalent in certain domains due to their simplicity and direct
control over data organization. However, databases have become the standard for managing
structured data in businesses and enterprises due to their robust features for data management,
integrity, and querying capabilities.

Archive Logs, Data Log Files, Data Dictionary, and Redo Files:

• Archive Logs: Archive logs are backups of redo logs, which contain a record of
changes made to the database. They are essential for data recovery and disaster
recovery purposes, enabling point-in-time recovery of the database.
• Data Log Files: Data log files can refer to various log files within a database system.
They may include transaction logs, which record changes made to the database, or
audit logs, which track user activity for security and compliance purposes.
• Data Dictionary: A data dictionary is a central repository of metadata within a
database system. It contains information about the structure of the database, such as
tables, columns, data types, constraints, and relationships.
• Redo Files: Redo logs are a critical component of Oracle's database architecture.
They record changes made to data in the database, providing a backup in case of
system failure. Redo logs ensure the database can be recovered to a consistent state
after a crash or other issue.

Oracle Database Features:

• High Availability: Oracle Database provides features like Real Application Clusters
(RAC) and Data Guard for high availability and disaster recovery.
• Scalability: It supports scaling both vertically and horizontally to accommodate
growing data needs.
• Security: Oracle offers various security features including encryption, access
controls, and auditing to ensure data protection.
• Performance: Optimizations like query optimization, indexing, and caching enhance
performance for large-scale data processing.

NoSQL and Hive SQL Features and Differentiation:

NoSQL:

• Features:
o Schemaless: NoSQL databases are schema-less or have a flexible schema,
allowing for easy storage of unstructured or semi-structured data.
o Horizontal Scalability: Many NoSQL databases support easy horizontal
scaling across distributed clusters.
o Variety of Data Models: NoSQL databases support various data models
including key-value, document, column-family, and graph databases.

Hive SQL (HiveQL):

• Features:
o SQL Compatibility: HiveQL is a SQL-like query language that allows users
to query data stored in Apache Hive, a data warehousing infrastructure built
on top of Hadoop.
o Batch Processing: Hive is optimized for batch processing of large datasets,
making it suitable for analytical workloads.
o Integration with Hadoop Ecosystem: Hive integrates seamlessly with other
components of the Hadoop ecosystem like HDFS, MapReduce, and Spark.

Differentiation:

• Data Model: NoSQL databases offer flexibility in data models, whereas Hive SQL is
more aligned with relational data models.
• Scalability: NoSQL databases are designed for horizontal scalability and distributed
computing, while Hive SQL is typically used for batch processing on large datasets
within Hadoop clusters.
• Query Language: Hive SQL is closer to traditional SQL, making it easier for SQL-
savvy users to adopt, while NoSQL databases may have their own query languages or
APIs tailored to specific data models.

You might also like