0% found this document useful (0 votes)
45 views15 pages

Unit 5 K Database

notes of dms
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
45 views15 pages

Unit 5 K Database

notes of dms
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 15

Unit 5: DATABASE ADMINISTRATION

COURSE OUTCOMES:

CO5 - Apply security and backup methods on database.

THEORY LEARNING OUTCOMES


TLO 5.1 Implement SQL queries for database administration.
TLO 5.2 Explain concept of various types database backup processes.
TLO 5.3 Describe various terms related to advanced database concepts.

CONTENTS

5.1 Introduction to database administration:- Types of database users, Create and


delete users, Assign privileges to users

5.2 Transaction: Concept, Properties & States of Transaction

5.3 Database Backup: Types of Failures, Causes of Failure,Database backup


introduction, types of database backups:Physical & Logical

5.4 Data Recovery – Recovery concepts , recoverytechniques- roll forward


,Rollback

5.5 Overview of Advanced database concepts:- DataWarehouse ,Data lakes , Data


mining, Big data ,Mongo DB, DynamoDB.

5.1 Introduction to database administration:- Types of database users, Create


and delete users, Assign privileges to users
5.1.1.Types of database users

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:

 Application programmers are the users who write the program.


 These programmers use programming tools to develop the program.
 They are back end programmers who writes code for the application
program
 They are computer professionals as programs could be written in
programming language such as visual basic, c, Cobol etc.
 Example: software developer
 RAD technology is used to write the program.
c) Sophisticated users:
 They develop their own database application according to their
requirement. Sophisticated users interact with the system by
making the requests in the form of query language i.e. they write
SQL query to query processor.
 These queries are then submitted to the query processor.
 Query processor converts the DML statements into lower level
interactions which are understandable by storage manager.
 Examples: Engineer, scientist, business analyst (BA).
d) Specialized users:
 These users are not traditional.
 They write some special application programs which are not regular
applications.
 Example: such types of applications are CAD, knowledge based and
expert system.
e) Database administrator:
 Responsible for managing whole database system , create and
maintains database.
 The Database administrator has all the privileges/permissions
allowed by dbms and he can assign or remove the privileges from
user
 Manages users who can access the database and manages integrity
issue.
 Manages performance of system as and when required.

Functions of database administrator

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.

3. Schema and physical organization modification DBA writes set of definitions


to modify the database schema or description of physical storage organization.

4. Granting authorization for data access


The DBA provides different access rights to the users according to their level.
Ordinary users might have highly restricted access to data, while you go up in the
hierarchy to the administrator, you will get more access rights. Integrity constraints
specifications: Integrity constraints are written by DBA and they are stored in a
special file which is accessed by database manager while updating data.
5. Routine Maintenance some of the routine maintenance activities
of a DBA is given below.
(i) Taking backup of database periodically
(ii) Ensuring enough disk space is available all the time.
(iii) Monitoring jobs running on the database.
(iv) Ensure that performance is not degraded by some expensive task submitted by
some users.

6. Integrity- constraint specification: Integrity constraints are written by DBA


and they are stored in a special file, which is accessed by database manager, while
updating the data.
5.1.2. Create and delete users, Assign privileges to users

Create user:

to create a new user, “ create user “ command is used.

Syntax:

Create user user_name identified by password;

e.g:1) create user sycm identified by root123;

2) create user student identified by student123;

Delete user:

By using drop command we can delete user permanantly.

Syntax:

Drop user user_name;

e.g. drop user sycm;

Alter user

-The alter user statement modifies MySQL accounts like users password.

Alter user username identified by password;

e.g alter user student identified by newstudent123;

5.1.3. Assign privileges to users

Database privileges:
“A privilege is a right to execute SQL statements or to access object”

There are two types of privileges.


a) System privileges: includes permissions for creating tables, session,
users,views,roles etc.
List of system privileges:
 Create table
 Create view
 Create session
 Create user
 Create role
It is granted by Database administrator to users.

b) Object privileges: this includes permissions for any command or query


to perform operations on database table, views etc. i.e
insert,update,delete,alter etc.
List of object privileges:
 insert
 update
 delete
 select
 alter

Granting and Revoking privileges:


Grant: This command is used to give permission to user to do operations on
object.
Syntax

GRANT privilege_name ON object_name TO user_name ;

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.

3) Grant all on student to raju;

4)grant update on columns eid and ename .

grant update(eid,ename) on emp to shreyas;


Revoke: This command is used to withdraw the privilege that has been granted to
the user.

Syntax:

REVOKE privilege_name ON object_name FROM user_name ;

OR
REVOKE all ON object_name FROM user_name ;

e.g: 1)Revoke select, update on emp from user1;

2)Revoke insert, update, delete on student from rajesh;


3) Revoke all on student from raju;

5.2 Transaction: Concept, Properties & States of Transaction

5.2.1 Transaction Concept:

A transaction can be defined as a group of tasks. A transaction is a very small unit


of program and it may contain several low levels of tasks.

A transaction maintain atomicity, consistency, isolation, and durability i.e. known


as ACID properties.

5.2.2 Properties
the properties of transactions are ACID( Atomicity, consistency, isolation,
durability)

1. Atomicity: It is an all or none proposition.


When one transaction takes place, many operations occur under one transaction.
Atomicity means either all operations will take place property and reflect in the
database or
none of them will be reflected.

2.Consistency:
Consistency guarantees that a transaction never leaves your database in a half
finished state. It keeps the database consistent.

3. Isolation: Transactions are independent.


It is necessary to maintain isolation for the transactions. This means one
transaction should not be aware of another transaction getting executed. Also their
intermediate result should be kept hidden.

4. Durability: Committed data never lost


When a transaction gets completed successfully, it is important that the changes
made by the transaction should be preserved in database in spite of system failures.

5.2.3 States Of Transaction:


A transaction must be in one of the following states:

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.

3. Failed: when the normal execution can no longer proceed.

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. Committed: after successful completion

5.3 Database Backup: Types of Failures, Causes of Failure,Database backup


introduction, types of database backups:Physical & Logical

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.

Reasons for a transaction failure could be – logical errors, syntax errors

1. Logical errors: If a transaction cannot complete due to some code


error or an internal error condition, then the logical error occurs.
2. Syntax error: It occurs where the DBMS itself terminates an active
transaction because the database system is not able to execute it. For
example, The system aborts an active transaction due to resource
unavailability.

2. System Crash/system failure

System failure can occur due to power failure or other hardware


or software failure. Example: Operating system error.

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.

5.3.2. Causes of Failure

 network failure,
 system crash,
 natural disasters,
 carelessness,
 sabotage(corrupting the data intentionally),
 software errors, etc.

5.3.3. Database backup introduction

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.

 types of database backups:Physical & Logical

The backup is divided into two types:


1. Physical backup
2. Logical backup

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) Logical backup: Logical backup contains logical data which is extracted


from a database. It includes backup of logical data like procedure, function,
views etc.
It is not a sufficient protection against data loss without physical backup,
because logical backup provides only structural information.
5.4 Data Recovery – Recovery concepts , recovery techniques- roll forward
,Rollback

5.4.1 Recovery concept

Database backup Recovery: it restores the original data from backup.


Database recovery are used to restore the original data in system from backup.
Backward and forward recovery is two types of database recovery.

5.4.2. recovery techniques- roll forward ,Rollback

Data recovery techniques can be classified as:


1. Rolling forward / Roll forward: Applies Redo records to the
corresponding data blocks
The rule forward redoes the changes made by a transaction, after the
committed transaction.
It overwrites the changed value once again to ensure consistent.

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:

3. Log based recovery.


4. Shulow paging recovery
5. Checkpoints

3. Log based recovery.


It records sequence of log records, which includes all activities doue by
databuse users
It records the activities when user changes the database
In case of database failure, by referring the log records users can easily recover
the data
4. Shalow paging recovery:
This technique is the alternative foe log based recovery.
In this technique, database is divided into pages that can be stored on the disk
The page table is used to maintain the record of location of pages. In case of
database failure, page table is used to recover the parts of datahuse.
5. Checkpoints
Checkpoim records all communed transactions into logs
When system fails, it check log to determine recovery action.

5.5 Overview of Advanced database concepts:- DataWarehouse ,Data lakes ,


Data mining, Big data ,Mongo DB, DynamoDB,NTENTS:

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

DynamoDB is a hosted NoSQL database offered by Amazon Web Services


(AWS).

Amazon DynamoDB is a serverless, NoSQL database service that allows you to


develop modern applications at any scale. As a serverless database, you only pay
for what you use and DynamoDB scales to zero, has no cold starts, no version
upgrades, no maintenance windows, no patching, and no downtime maintenance.

MSBTE QUESTIONS ASSIGNMENT No. 5


Question Exam Marks
1 Explain state of transaction with the help of diagram. S-19 4M
With neat sketch describe Transaction states diagram. S-22 4M
2 Explain recovery techniques with example. S-19 4M
3 Write SQL command for following : S-19 6M
(i) Create user
(ii) Grant privileges to user
(iii) Remove privileges from user
4 Explain ACID properties of traction. W-19 4M
Explain transaction ACID properties. W-18 4M
Explain ACID properties of transaction. W-22 4M
Explain properties of transaction S-23 4M
Describe ACID properties of transaction. W-23 4M

5 Describe database backups with it’s types. W-19 4M

6 Describe database privileges. Write down the W-19 6M


procedure for granting & revoking privileges in
database objects to the users.
7 Explain database security with it’s requirements in W-18 4M
detail.
8 i) Create user ‘Rahul’. W-18 6M
ii) Grant create, select, insert, update, delete,
drop privilege to ‘Rahul’.
iii) Removes the select privilege from user
‘Rahul’
9 i) Create user ‘RAM’. S-22 6M
ii) Grant create, select, insert, update, delete
privileges to user ‘RAM’.
iii) Remove update privilege from user ‘RAM’
10 Write SQL command for following: S-24 6M
i) Create user
ii) Grant privileges to user
iii) Remove privileges from user
11 State the concept of database recovery S-22 4M
Explain database recovery techniques with example. S-24 4M
Explain Database Recovery techniques in detail. W-22 4M
12 State the causes of database failure. S-24 2M
Explain the most common types of database failures S-23 4M
Define failure. Enlist types of failure W-23 2M
13 List system privileges and object privileges. S-24 2M
14 Describe database privileges. Write down the W-23 6M
command for granting and revoking privileges on
database object to users

You might also like