You are on page 1of 34

Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.

) Database Security & Transaction Processing

Database management system


Matoshri Aasarabai Polytechnic, Nashik

Department of Computer Engineering


Name of staff
A V Dixit

Database management system 1


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Unit 5 Database Security &


Transaction Processing

• Introduction to database Security


• Database privileges:
System privileges and object privileges
• Transaction
States of transaction
• Database backup
• Database recovery
Database management system 2
Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Session Outline
• Introduction to database Security
• Data security requirements
• Types of database users
• Create user alter user and delete user

Database management system 3


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Introduction to database security

• Database security involves protecting the database from


unauthorized access, modifications or destruction.
• Database security is important component of any
organization.
• The database designers not only protect data for smooth
conditioning but also have responsibility to protect
privacy of individuals.

Database management system 4


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Data security requirements

Data security requirements come up from need to protect


data: From accidental loss, from intentional unauthorized
use
The basic security standards which technology can ensure
are:
• Confidentiality
• Integrity
• Availability
Database management system 5
Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Types of database users

• Application Programmer:- who writes application


programs
• End users:- who access database from terminal end
• Database users- Querying database for decision making
• DBA (Database Administrator)- DBA is responsible for
everything related to database.

Database management system 6


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Creating, altering and deleting users

• Create user- this command is used to create new user


with password
• Syntax:
• Create user username identified by password;
• E.g. CREATE USER john IDENTIFIED BY abcd1234;

Database management system 7


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Permission types

• Create:- Enables users to create database/tables


• Select:- Enables users to retrieve data
• Insert:- Enables users to add new entries in tables
• Update:- enables users to modify existing entries in
tables
• Delete:- Enables users to delete entries
• Drop:- Enables users to delete entire database /tables

Database management system 8


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Drop and alter user

• Drop:- This command is used to remove one or more


MYSQL accounts
• Syntax:- DROP user [IF EXISTS] user…

• Alter :- This command is used to modify SQL account or


type of user privileges.

Database management system 9


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Session assignment

• Q. Explain data security requirements.


• Q. Which are types of database users?
• Q. Explain how to create and alter user with one
example.

THANK YOU
Contact mail- anklesh.dixit@gmail.com

10
Database management system
Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Database management system


Matoshri Aasarabai Polytechnic, Nashik

Department of Computer Engineering


Name of staff
A V Dixit

Database management system 11


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Session Outline
• Database privileges
• Grant Command
• Revoke command
• Transaction
• State of transaction

Database management system 12


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Database privileges

• System privileges:- A system privilege is right to perform


a particular action or to perform an action on any object
of a particular type.
• E.g. Alter index, Alter procedure, alter sequence, alter
table, alter view

Database management system 13


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Database privileges

• Object privilege:- An object privilege is the right to


perform a particular action on an object or to access
another users object.
• E.g. Delete, execute, index, Insert, select, Update

Database management system 14


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Grant Command
• Grant:- this command is used to assign
privileges
• Syntax:-
GRANT privilege_name ON object_name TO {user-name |PUBLIC| role_name}
[WITH GRANT OPTION];
Where,
privilege_name- Access, right or privilege granted to user
Object_name- name of object like table view procedure etc.
User_name- name of user
PUBLIC:- used to grant access rights to all user
role_name- set of privileges grouped together
WITH GRANT OPTION:- allows user to grant access rights to other user.
e.g. GRANT SELECT ON student TO users1;

Database management system 15


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Revoke command

• Revoke :- This command is used to remove assigned


privilege.
• Syntax:-
REVOKE privilege_name ON object_name FROM
{user_name |PUBLIC| role_name};
• E.G REVOKE select ON student from user1;

Database management system 16


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Transaction

• A transaction is unit of program execution that access


and possibly updates various data items.
• Transaction ACID properties.
1 Atomicity
2. Consistency
3. Isolation
4. Durability
Database management system 17
Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

State of transaction

• Following are the states of transaction


1. ACTIVE
2. PARTIALLY COMMITED
3. COMMITTED
4. FAILED
5. TERMINATED
Database management system 18
Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

State transaction Diagram

Partially


Active Committed
Committed
Read, Write
BEGIN End trans. commit

Failed Terminated

Abort Abort

Database management system 19


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

States of transaction

• Active:- A transaction goes into an active state


immediately after it starts execution. In this phase READ or
WRITE operation can be issued.
• Partially Committed:- When the transaction ends, it moves
to the partially committed state

Database management system 20


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

States of transaction

• Committed:- If the check in the partially committed


state is successful, the transaction is reached to its
commit point and enters into committed state.
• Failed:- A transaction can go to the failed state, if
one of the checks fails or if the transaction is
aborted during the active state.
• Terminated:- The terminated state is indication of
transaction leaving the system.

Database management system 21


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Session assignment

• Q. Explain database privileges.


• Q. Explain Grant and Revoke command with
example.
• Q. Explain states of transaction with one
example.

THANK YOU
Contact mail- anklesh.dixit@gmail.com

22
Database management system
Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Database management system


Matoshri Aasarabai Polytechnic, Nashik

Department of Computer Engineering


Name of staff
A V Dixit

Database management system 23


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Session Outline

• Database Backup
• Types of backups
• Database Recovery
• Recovery techniques

Database management system 24


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Database Backup

• To understand need of database backup, first understand


failure & failure categories.
• 1. Physical- It is usually caused by hardware failure
• 2. Design- It is usually caused by software failure.
• 3. Operations- It is caused by poor human intervention
• 4. Environmental- It is caused due to external causes like
earthquake, temperature conditions..

Database management system 25


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Database backup

• Database backup is a storage of data that means the copy


of data.
• If the original data is lost then using backup it can be
reconstructed.
• Types of backup:
1. Physical backup
2. Logical backup

Database management system 26


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Types of backup

• Physical backup:- Physical backups are the backups of the


physical files used in storing and recovering database,
such as data files, control files, log files etc.
• Logical Backup:- Logical backup contains logical data
which is extracted from database.
• It includes Backup of logical data like views procedure,
functions tables etc.

Database management system 27


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Importance of backups

• Planning and testing backup


• Determines speed and success of recovery
• Physical backup can extract data from physical storage.
E.g. OS
• Logical data extracts data using SQL from the database
and store it in binary file.

Database management system 28


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Database recovery

• Recovery is a process of restoring a database to the


correct state in the event of failure.
• Classified into two parts:
1. Rolling forward:- Applies redo records to related data
blocks.
2. Rolling back applies rollback segments to the data files

Database management system 29


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Log based recovery

• Logs are sequence of records that maintain the records of


actions performed by transaction.
• Two methods to create log file and updating database
1. Deferred database modification- logs created & stored
in stable storage system.
2. Immediate database modification. – after creating
each log record database is modifies for each step for
log entry immediately.

Database management system 30


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Recovery with concurrent transaction

• When two transactions are executed in parallel the


created logs are difficult to recover.
• To overcome this Checkpoints are used.
• Checkpoints are also known as savepoints.
• It is a mechanism where all the previous logs are removed
from the system and stored permanently in storage
system.

Database management system 31


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Recovery

• 1. Recovery system read the log files from end to start


check point.
• It maintains undo log and redo log
• All the transactions in the undo log are undone and their
logs are removed.
• All the transactions in the redo log are removed and then
redone before saving their logs.

Database management system 32


Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

Session assignment

• Q. Write a short note on database backup?


• Which are database backup? Explain in short.
• Explain database recover concept.

THANK YOU
Contact mail- anklesh.dixit@gmail.com

33
Database management system
Matoshri Aasarabai Polytechnic, Nashik (Comp Engg.) Database Security & Transaction Processing

THANK
YOU
Database management system 34

You might also like