Tuesday 1 April 2014

Wha is Deadlock?

A deadlock occurs when two or more session are waiting for data locked by each other, resulting in all the sessions being blocked.
Oracle automatically detects and resolves deadlocks by rolling back the statement associated with the transaction that detects the deadlock.


Error in alert file: Ora 00060



In above case deadlock occurs.

because each one have lock on each other tables.
1) like when user 1 updates t1 it put lock on it, at same time user2 updates t2 it put lock on it.
2) then user 1 updates t2,at same time user 2 updates on t1.
3) When user 1 tries to commit on it doesn't allow to commit since t2 hv lock by user2.
4) when user 2 tries to commit on it doesn't allow to commit since t1 hv lock by user1.

RMAN Backup type (Differential & Cumulative)

RMAN backup types

RMAN incremental backup for an Oracle DB

Sometimes we need to backup the database changes only from the last backup (only the last changes are backed up). This is an incremental backup. There are 2 types of incremental backup: DIFFERENTIAL (by default) & CUMULATIVE.

NOTE: The incremental backups are only for the DATA files.




DIFFERENTIAL backup = which backs up all blocks changed after the most recent incremental backup at level 1 or 0. (See Picture 1). The following RMAN command is used to take a DIFFERENTIAL database backup:

RMAN> BACKUP INCREMENTAL LEVEL 1 DATABASE;






CUMULATIVE backup =  which backs up all blocks changed after the most recent incremental backup at level 0. (See Picture 2)
The following RMAN command is used to take a CUMULATIVE database backup:

RMAN> BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;


The advantages of each types of incremental backup



Here are the advantages of each types of incremental backup:


Advantages of the DIFFERENTIAL backup
 
  • Less space disk used
  • Less network traffic
  • Less time to take a backup

Advantages of the CUMULATIVE backup
  • Less time to recover