Week 1-Session 1

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 16

Database Backup

• Database Backup is storage of data that means


the copy of the data.
• It is a safeguard against unexpected data loss
and application errors.
• It protects the database against data loss.
• If the original data is lost, then using the
backup it can reconstructed.
• The backups are divided into two types,
1. Physical Backup
2. Logical Backup
Physical backups

• Physical Backups are the backups of the


physical files used in storing and recovering
your database, such as datafiles, 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 offline storage like magnetic tape.
2. Logical backup
• Logical Backup contains logical data which is
extracted from a database.
• It includes backup of logical data like views,
procedures, functions, tables, etc.
• It is a useful supplement to physical backups in
many circumstances but  not a sufficient
protection against data loss without physical
backups, because logical backup provides only
structural information
Database Security

• Database security refers to the collective measures used to


protect and secure a database or database management
software from illegitimate use and malicious threats and attacks.

 It is a broad term that includes a multitude of processes, tools


and methodologies that ensure security within a database
environment.
 Database security covers and enforces security on all
aspects and components of databases.

 This includes:
• Data stored in database
• Database server
• Database management system (DBMS)
• Other database workflow applications
• Database security is generally planned, implemented
and maintained by a database administrator and or
other information security professional.
What is Concurrency ?

• Concurrency is the ability of a database to allow multiple users to


affect multiple transactions.

• This is one of the main properties that separates a database from


other forms of data storage like spreadsheets.

• The ability to offer concurrency is unique to databases.

• Spreadsheets or other flat file means of storage are often


compared to databases, but they differ in this one important
regard.

• Spreadsheets cannot offer several users the ability to view and


work on the different data in the same file, because once the first
user opens the file it is locked to other users.

• Other users can read the file, but may not edit data.
Problems caused by concurrency
•  For example, when one user is changing data
but has not yet saved (committed) that data,
then the database should not allow other
users who query the same data to view the
changed, unsaved data. Instead the user
should only view the original data.
Potential problems of Concurrency
• Lost Updates occur when multiple transactions select the same row
and update the row based on the value selected

• Uncommitted dependency issues occur when the second transaction


selects a row which is updated by another transaction (dirty read)

• Non-Repeatable Read occurs when a second transaction is trying to


access the same row several times and reads different data each time.

• Incorrect Summary issue occurs when one transaction takes summary


over the value of all the instances of a repeated data-item, and second
transaction update few instances of that specific data-item. In that
situation, the resulting summary does not reflect a correct result.
Example
Assume that two people who go to electronic kiosks at the same time
to buy a movie ticket for the same movie and the same show time .

• However, there is only one seat left in for the movie show in that
particular theatre. Without concurrency control, it is possible that
both moviegoers will end up purchasing a ticket.

• However, concurrency control method does not allow this to


happen.

• Both moviegoers can still access information written in the movie


seating database.

• But concurrency control only provides a ticket to the buyer who has
completed the transaction process first.
Concurrency Control Protocols

• Lock-Based Protocols
• Two Phase
• Timestamp-Based Protocols
• Validation-Based Protocols
Lock-based Protocols

• A lock is a data variable which is associated with a data item.

• This lock signifies that operations that can be performed on the data item.
• Locks help synchronize access to the database items by concurrent transactions.

• All lock requests are made to the concurrency-control manager.


• Transactions proceed only once the lock request is granted.

• Binary Locks: A Binary lock on a data item can either locked or unlocked states.

• Shared/exclusive: This type of locking mechanism separates the locks based on


their uses. If a lock is acquired on a data item to perform a write operation, it is
called an exclusive lock.
Shared Lock (S):

• A shared lock is also called a Read-only lock.

• With the shared lock, the data item can be shared between
transactions.

• This is because you will never have permission to update data


on the data item.

• For example, consider a case where two transactions are


reading the account balance of a person. The database will let
them read by placing a shared lock. However, if another
transaction wants to update that account's balance, shared
lock prevent it until the reading process is over.
2. Exclusive Lock (X):

• With the Exclusive Lock, a data item can be read as well as written.

• This is exclusive and can't be held concurrently on the same data item.

• X-lock is requested using lock-x instruction.

• Transactions may unlock the data item after finishing the 'write' operation.

• For example, when a transaction needs to update the account balance of a


person. You can allows this transaction by placing X lock on it. Therefore,
when the second transaction wants to read or write, exclusive lock prevent
this operation.
• THANKYOU !

• QUESTIONS ????

You might also like