Unit 5 K Database
Unit 5 K Database
COURSE OUTCOMES:
CONTENTS
a) Naive users
b) Application programmers
c) Sophisticated users
d) Specialized users
e) Database administrator
a) Naive User:
Naïve users are unsophisticated users who don’t have any DBMS
knowledge but they frequently
use the database application in their daily life to get desired result.
They are interacting with the system through the application
program.
They give data as input through application program or get output
data generated by application program.
Example: Bank cashier, clerks, railway ticket booking user.
b) Application programmers:
1.Schema Definition
The Database Administrator creates the database schema by executing DDL
statements. Schema includes the logical structure of database table (Relation) like
data types of attributes, length of
attributes, integrity constraints etc.
2. Storage structure and access method definition The DBA creates appropriate
storage structures and access methods by writing a set of definitions which is
translated by data storage and DDL compiler.
Create user:
Syntax:
Delete user:
Syntax:
Alter user
-The alter user statement modifies MySQL accounts like users password.
Database privileges:
“A privilege is a right to execute SQL statements or to access object”
Or
GRANT all ON object_name TO user_name ;
e.g
1) grant select,update on emp to user1;
2) Grant insert, update, delete on student to rajesh;
Above example give the permission of privileges insert, update and delete on
student for the user rajesh.
Syntax:
OR
REVOKE all ON object_name FROM user_name ;
5.2.2 Properties
the properties of transactions are ACID( Atomicity, consistency, isolation,
durability)
2.Consistency:
Consistency guarantees that a transaction never leaves your database in a half
finished state. It keeps the database consistent.
1. Active: the initial state, the transaction stays in this state while it is
executing.
2. Partially committed: when the final statement has been executed it is in the
partially committed state.
4. Aborted: after the transaction has been rolled back and the database has been
restored to its state prior to the start of the transaction.
5.3.1.Database failures:
Types of Failures:
There are 3 types of failures:
1. Transaction failure
2. System crash/ system failure
3. Disk failure
1. Transaction failure
The transaction failure occurs when it fails to execute or when it reaches a
point from where it can't go any further. If a few transaction or process is
hurt, then this is called as transaction failure.
3. Disk Failure
It occurs where hard-disk drives or storage drives used to fail
frequently. Disk failure occurs due to the formation of bad sectors, disk
head crash, and unreachability to the disk or any other failure, which destroy
all or part of disk storage.
network failure,
system crash,
natural disasters,
carelessness,
sabotage(corrupting the data intentionally),
software errors, etc.
Database backup:
Database backup is storage of data that is copy of the data.
It protects the database against data loss.
If the original data is lost, then using backup it can reconstruct
Importance of backup:
Planning and testing backup helps against failure of media, operating
system. It determines the speed and success of the recovery. Physical backup
extracts data from physical storage.
For example: Operating system
Logical backup extracts data using sql from the database and store it in
binary files.
Logical backup is used to restore the database object into the database.
1) Physical backup:
Physical backups are the backups of the physical files used in the storing and
recovering your database such as data files, control files and archived Redo logs,
log files.
It is a copy of files storing database information to some other location such as
Disk, some of line storage such as magnetic tape.
Physical backups are the foundation of the recovery mechanism in the
database.
2. Rolling Back / Roll Back: Applies roll back statements to the data files. It
is stored in transaction table.
The roll back transaction is a transaction which rolls back the transaction to
the beginning of the transaction.
It is possible to use before commit transaction.
Following are also another some Database recovery techniques:
Data warehouses, data lakes, Data mining, Big data ,Mongo DB,
DynamoDB and databases are all data storage systems used for data analysis and
management. Each has different purposes, features, and how data is processed:
Data warehouses
Designed for reporting and analysis, data warehouses store structured data in a
predefined schema. They use batch processing to integrate data from multiple
sources, and rely on Extract, Transform, Load (ETL) processes.
Data lakes
Designed for storing raw data in its original format, data lakes can store
structured, semi-structured, and unstructured data. They allow batch and stream
processing, and support Extract, Load, Transform (ELT) processes. Data lakes
don't enforce a predefined schema, allowing for flexibility in data exploration and
analysis.
Big data
It is a combination of structured, semi-structured and unstructured data that
organizations collect, analyze and mine for information and insights. It's used
in machine learning projects, predictive modeling and other advanced analytics
applications.
Big data is often characterized by the three V's:
large volume of data.
wide variety of data .
high velocity at which the data is generated, collected and processed
Data mining
It is the process of sorting through large data sets to identify patterns and
relationships that can help solve business problems through data analysis.
Data specialists who use data mining must have coding and programming language
experience, as well as statistical knowledge to clean, process and interpret data.
MongoDB
MongoDB is a document database. It stores data in a type of JSON(javascript
obeject notatios) format called BSON(Binary JSON). A record in MongoDB is a
document, which is a data structure composed of key value pairs similar to the
structure of JSON objects.
DynamoDB