Unit 5
Unit 5
Unit 5
Here,
• The commit operation of the transaction that performs the dirty read is delayed.
• This ensures that it still has a chance to recover if the uncommitted transaction
fails later
Recoverability
Example
• Consider;
Recoverability
Example
Here,
• T2 performs a dirty read operation.
• The commit operation of T2 is delayed till T1 commits or roll backs.
• T1 commits later.
• T2 is now allowed to commit.
• In case, T1 would have failed, T2 has a chance to recover by rolling
back.
Recovery
Facilities
Backup mechanism
• periodic backup copies of the database.
• copy both the database and the log files without stopping system
• complete or incremental backup – stored offline
logging facilities
• keep track of state of transactions and database changes
checkpoint facility
• enables updates to be considered permanent
recovery manager
• allows system to restore database to a consistent state following failure
Recovery
Recovery Techniques
• Undoing – If a transaction crashes, then the recovery manager may undo transactions
i.e. reverse the operations of a transaction. This involves examining a transaction for the
log entry write_item(T, x, old_value, new_value) and setting the value of item x in the
database to old-value.There are two major techniques for recovery from non-
catastrophic transaction failures: deferred updates and immediate updates.
• Deferred update – This technique does not physically update the database on disk until
a transaction has reached its commit point. Before reaching commit, all transaction
updates are recorded in the local transaction workspace. If a transaction fails before
reaching its commit point, it will not have changed the database in any way so UNDO is
not needed. It may be necessary to REDO the effect of the operations that are recorded
in the local transaction workspace, because their effect may not yet have been written
in the database. Hence, a deferred update is also known as the No-undo/redo algorithm
Recovery
Recovery Techniques
• Immediate update – In the immediate update, the database may be updated by some operations of a
transaction before the transaction reaches its commit point. However, these operations are recorded in a log
on disk before they are applied to the database, making recovery still possible. If a transaction fails to reach
its commit point, the effect of its operation must be undone i.e. the transaction must be rolled back hence
we require both undo and redo. This technique is known as undo/redo algorithm.
• Caching/Buffering – In this one or more disk pages that include data items to be updated are cached into
main memory buffers and then updated in memory before being written back to disk. A collection of in-
memory buffers called the DBMS cache is kept under control of DBMS for holding these buffers. A directory
is used to keep track of which database items are in the buffer. A dirty bit is associated with each buffer,
which is 0 if the buffer is not modified else 1 if modified.
• Shadow paging – It provides atomicity and durability. A directory with n entries is constructed, where the ith
entry points to the ith database page on the link. When a transaction began executing the current directory
is copied into a shadow directory. When a page is to be modified, a shadow page is allocated in which
changes are made and when it is ready to become durable, all pages that refer to original are updated to
refer new replacement page
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
1. Database server
2. Database management system (DBMS)
3. Other database workflow applications
• Database security is generally planned, implemented and maintained by a database
administrator and or other information security professional.
Database Security
• Basically, database security is any form of security used to protect
databases and the information they contain from compromise. Examples of
how stored data can be protected include:
• Software – software is used to ensure that people can’t gain access to the
database through viruses, hacking, or any similar process.
• Physical controls – an example of a physical component of database security
could be the constant monitoring of the database by company personnel to
allow them to identify any potential weaknesses and/or compromises.
• Administrative controls – this refers to things like the use of passwords,
restricting the access of certain people to certain parts of the database, or
blocking the access of some company personnel altogether.
Database Security
Why is database security important?
• Database security is more than just important: it is essential to any company with any online component.
Sufficient database security prevents data being lost or compromised, which may have serious
ramifications for the company both in terms of finances and reputation. Database security helps:
1. Company’s block attacks, including ransom ware and breached firewalls, which in turn keeps sensitive
information safe.
2. Prevent malware or viral infections which can corrupt data, bring down a network, and spread to all end
point devices.
3. Ensure that physical damage to the server doesn’t result in the loss of data.
4. Prevent data loss through corruption of files or programming errors.
• As you will see, database security places an obligation on you and your business to keep sensitive data
stored correctly, and used appropriately. Complying with regulations and the applicable law not only
reduces the risk of information being mishandled, but it protects you from both costly legal ramifications
and lost customer confidence. Investment in Database security will ensure you have done your due
diligence in terms of data protection.
Database Security Steps
Ensure Physical Database Security
• In the traditional sense this means keeping your database server in a secure, locked environment with access controls in
place to keep unauthorized people out. But it also means keeping the database on a separate physical machine, removed
from the machines running application or web servers.
Use Web Application and Database Firewalls
• Your database server should be protected from database security threats by a firewall, which denies access to traffic by
default. The only traffic allowed through should come from specific application or web servers that need to access the
data. The firewall should also protect your database from initiating outbound connections unless there is a specific need to
do so.
Harden Your Database to Fullest Extent Possible
• Clearly it's important to ensure that the database you are using is still supported by the vendor or open source project
responsible for it, and that you are running the most up-to-date version of the database software with all database
security patches installed to remove known vulnerabilities.
Encrypt Your Data
• It is standard procedure in many organizations to encrypt stored data, but it's important to ensure that backup data is also
encrypted and stored separately from the decryption keys. (Not, for example, stored in encrypted form but alongside the
keys in plaintext.) As well as encrypting data at rest, it's also important to ensure confidential data is encrypted in motion
over your network to protect against database security threats.
Database Security Steps
Minimize Value of Your Database
• Attackers can only get their hands on what is stored in a database, so ensure that you are not storing any
confidential information that doesn't need to be there. Actively manage the data so you can delete any
information that you don't need from the database. Data that must be retained for compliance or other purposes
can be moved to more secure storage – perhaps offline -- which is less susceptible to database security threats.
Manage Database Access Tightly
• You should aim for the least number of people possible to have access to the database. Administrators should
have only the bare minimum privileges they need to do their job, and only during periods while they need access.
For smaller organizations this may not be practical, but at the very least permissions should be managed using
groups or roles rather than granted directly.
Audit and Monitor Database Activity
• This includes monitoring logins (and attempted logins) to the operating system and database and reviewing logs
regularly to detect anomalous activity.
• Effective monitoring should allow you to spot when an account has been compromised, when an employee is
carrying out suspicious activities or when your database is under attack. It should also help you determine if users
are sharing accounts, and alert you if accounts are created without your permission (for example, by a hacker).