5/12/20

Backup and recovery of database



DATABASE MANAGEMENT SYSTEM

 
8. BACK UP AND RECOVERY:
Database backups; why plan backups?
Hardware protection and redundancy
Transaction logs.
Importance of backups
Database recovery



Introduction to database backup: -

1. An objectionable failure of data where a stable, secondary storage device gets corrupt and this causes lost of all valuable data that is stored inside them.
2. To overcome from that situation we need backup of data in other word we can say that database backup is storage of data that means the copy of the data.
3. Database backup is a type of safeguard against unexpected loss of data and application errors.
4. The protection of data against data loss is done by database backup.
5. Suppose due to some issue or any unexpected condition the original data has been lost, then by using database backup we can easily reconstruct our data.
6. Database backup is done through replication and can be done for a database and its server.


Why plan for backups?

Before we know why we plan for backups first we have to know about some causes of failures.
As we know that database includes a huge amount of data and transaction of data and the system crashes or failure, then it is very difficult to recover database.
Some common causes of failures of data: -

1. System crash: -
a. When there is a hardware or software failure or external failure like power failure these failures are known as system crash.
b. In system crash the data which are in the secondary storage in not affected because lots of integrity of database, checkpoint prevents the loss of data from the secondary memory.

2. Transaction failure: -
a. Due to logical errors in the code transaction failure occur which affected only few tables or processes.
b. Transaction failure occur when there are system errors i.e. deadlock or unavailability of system resources.
c. There is an ACID property in each transaction and if we fail to maintain the ACID properties are causes the failure of database.

3. Network failure: -
a. When a client-server configuration or distributed database system are connected by communication systems the network failure occurs.

4. Disk failure: -
a. Disk failure occurs when there are issues with hard disks some of them are formation of disks from bad sectors, disk head crash, and unavailability of disk like that.

5. Media failure: -
a. The most dangerous failure is media failure because of it take more time to recover than any other kind of failure.
b. The example of media failure is disk controller or disk head crash.  

If we want our important data will remain safe and secure, we have to plan for data backups. If any of the failure occur and there is loss of important data if we have backup of our data then we can easily get them.

Types of backups: -

The backup are dividing into two types: -
       1. Physical backup: -
a. Backups of the physical files used in storing and recovering your database such as data files, control files, archived redo logs, and log files are comes under physical backups.
b. Physical backup is a copy of files storing database information to some other location i.e. disk, magnetic tape.
c. The foundations of the recovery mechanism in the database are physical backups.

      2. Logical backups: -
a. Logical data which is extracted from a database is logical backup.
b. Logical backup includes backup of data like views, procedures, functions, tables.
c. Logical backup is a useful supplement to physical backups in many circumstances. Logical backup provides only structural information.

Hardware protection: -

1. Hardware protection or hardware security is a penetrability protection that comes in the form of a physical device rather than software that is installed on the hardware of a computer system.
2.  The term Hardware protection also refers to the protection of the physical system from the harm.
3. Hardware protection can belong to a device used to scan a system or monitor network traffic.
4. Hardware protection can provide more robust security than software is capable and it provide an additional layer of security for important systems.
5. If anyone wants to assess the security of a hardware device, its become necessary to consider penetrability existing from its manufacture as well as other potential sources such as code and the devices data I/O on a network.
6. Systems which controls the color and intensity of lights in Wi-Fi LED foe a dwelling they not require much security.

Redundancy: -

1. Data redundancy is an organization of data issue that allows the unnecessary duplication of data in your database.
2. Data redundancy means having more than one copies of data or multiple data in same database
3. A change or modification in redundant data requires that you make changes to multiple fields of a database.
4. In a database data redundancy can be found, which is an organized collection of structured data thats stored by a computer system or the cloud?
5. Example, suppose a retailer entered the products they stick in their database by mistake same product gets entered twice then data redundancy take place.
6. Some advantages of Data redundancy are as follow: -
a. Alternative data backup method: -
Data redundancies offer an extra layer of protection and activate the backup by replicating data to another system.
b. Better data security: -
If you have same data stored in two or more separate places it can protect an organization in the event of a cyber attack or beach, beach is an event that can result in lost time and money as well as damaged reputation.
c. Faster data access and updates: -
If our data is redundant, employees of our company enjoy fast access and quick updates because the necessary information’s are available on more than one system i.e. multiple system
d.  Improved data reliability: -
                                                                                Reliable data is complete and accurate. Organizations can use data redundancy to double check data and confirm data is correct and complete.
7. Some disadvantages of data redundancy are as follows: -
a. Increase in data corruption: -
When data becomes damaged because of errors in writing, reading, storage, and processing then data corruption is occurred.
b. Increase database size: -
Data redundancy can increase the size of data and complexity of database.
c. Increase in cost: -
Due to Data redundancy more data is created it causes increase in cost of storage which causes a serious issue in an organization.
d. Possible data inconsistency: -
Data redundancy occurs when the same data exists in more than one place or multiple places, data inconsistency occurs when the same data exists in different format in multiple tables.
Transaction logs: -
1. A database management system (DBMS) uses a transaction log which keeps track of all transactions that are used to update the database.
2. The information stored in the transaction log is used by the Database management system (DBMS) for a requirement of recovery which triggered by a ROLLBACK statement.
3. Relational DBMSs use the transaction log to recover a database forward to a currently consistence state.
4. DBMS executes transaction log to modify the database and it can also automatically updates the transaction log.
5. The data which is stored by transaction log: -
a. There is a record for the beginning of the transaction.
b. Component for each transaction i.e. SQL statement.
c. Which operation is performed such as updates, insert, delete.
d. Name of the objects which are affected by the transaction i.e. name of the table.
e. For the same transaction there is a pointer to the previous and next transaction.
6. Entries of the logs are sequential in nature and transaction logs are split up to small field called virtual log files.
7. When a virtual log file is full the transactions are automatically move to the next virtual log file.








Importance of backup: -
1. Backup helps against failure of media, software, operating system and another kind of failures such as serious data crash.
2. Backup also determines the speed and success of the recovery.
3. Backup extracts data from physical storage i.e. data from disk to tape, OS is an example of physical backup.
4. Backup extracts data using SQL form the database and store it as a binary file.
5. Backup like logical backup is used to restore database objects into the database.
Database recovery:  -
1. The process of restoring a database to the correct state in the event of a failure is called recovery.
2. Recovery insures that the databases are reliable and remains in consistent state in case of a failure.
3. Data recovery is the process of restoring the database and the datas which are in consistent state which may include restoring lost data up to the point of the event i.e.  System crash.
4. Recovery of database are classified into two parts they are as follow: -
a. Rolling forward: -It applies records can be redoing to the corresponding data blocks.
b. Rolling back: -It applies rollback segments to the data files. Rolling back is stored in transaction tables.
5. When a DBMS recovers from a crash, it should maintain the following steps: -
a. To check the states of all transactions those are being executed.
b. The DBMS must ensure the atomicity of the transaction if a transaction in the middle of some operation.
c. Recover must check whether the transaction can be completed now or it needs to be rolled back.
d. If the transaction in an inconsistent state no transaction would be allowed to leave the DBMS

Log based recovery: -
   
1. The sequence of records that maintain the records of actions performed by a transaction is known as Log.
2. Log-based recovery of each transaction in maintained in some stable storage and if any failure occurs it can be recovered from there to recovery database.
3. The information about the transaction being executed, values that have been modified and transaction state is contain by the log.
4. The below logs are written for transaction: -
Log 1: writes “START” log to initiated a transaction
Log :
Log 2: Transaction modifies the address from one place to another, let “Delhi” to “Bihar”.
Log:
Log 3: Transaction is completed, the log indices the end of the transaction.
Log:
We can create log files and updating database by using this two method: -
1. Deferred database modification
2.  Immediate database modification






















9 comments:

Please do not enter any spam link in the comment box and use English and Hindi language for comment.

Latest Update

Key Components of XML

Popular Posts