SlideShare a Scribd company logo
Anar Godjaev

Backup & Recovery Procedure
Anar Godjaev
Introduction
In general, backup and recovery refers to the various strategies and procedures involved in
protecting your database against data loss and reconstructing the database after any kind of data
loss.
Oracle various kinds of backup like Physical, Logical.
Physical Backup is backups of physical files used in database like controlfile, datafile and
archivelog files.
Logical Backup contain logical data, like table and procedure, exported from the database with
oracle export utility and stored in binary format

1. Type of failures
Following are the types of failures that require recovery from the backup:
•

User Error
User errors occur when, either due to an error in application logic or a manual misstep; data
in your database is changed or deleted incorrectly. Data loss due to user error includes such
missteps as dropping important tables or deleting or changing the contents of a table. While
user training and careful management of privileges can prevent most user errors, your
backup strategy determines how gracefully you recover the lost data when user error does
cause data loss.

•

Media Failure
A media failure is the failure of a read or write of a disk file required to run the database, due
to a physical problem with the disk such as a head crash. Any database file can be vulnerable
to a media failure.

2. Backup options in Oracle
•

Physical backups




•

Cold (off-line) backup




Full database only
Require downtime
Not flexible for point in time recovery

Hot (on-line) backup

Different types of backups: full, incremental,
archive logs

No need of database downtime

Database can be recovered to any point in
time ,based on backup retention period

Logical backups



Logical copy of data in the database (like tables, packages)
Can be taken either with Export/Import tools or with Data Pump (10g/11g)
Anar Godjaev

3. Perform backup and recovery based on physical backups
There are two ways to perform backup and recovery based on physical backups:
•

Recovery Manager (RMAN)
RMAN is as a tool (with command-line client and Enterprise Manager GUI interfaces) that
integrates with sessions running on the Oracle server to perform backup and recovery activity

•

User Managed
In user managed backup user has to make the periodic backup of all the datafiles, control
files, parameter files using operating system commands and recovery the database using
SQL* Plus recovery command

4. Recovery Manager (RMAN)
RMAN can back up entire database; all datafiles in a tablespace, selected datafiles, control
files and archived redo log files.
•

Benefits of RMAN









RMAN is a tool that comes at no extra cost. It is available free with the Oracle Database.
Supports incremental backup strategies
Supports parallel operations (Multiple Channels for Backup and Restore)
RMAN can detect corrupted blocks
Controlfiles and spfile of database can be configured to automatically backup by RMAN
Knows what needs to be backup
Knows what is required for the recovery
Remembers location of the backup sets

5. RMAN Incremental Backup
RMAN incremental backups back up only datafile blocks that have changed since a specified
previous backup. Incremental backups can be of full databases, individual tablespaces or
datafiles. For full backups, if database is in ARCHIVELOG mode, you can make incremental
backups if the database is open; if the database is in NOARCHIVELOG mode, then you can
only make incremental backups after a consistent shutdown.
•

Level 0 and Level 1 Incremental Backups
Incremental backups can be either level 0 or level 1. A level 0 incremental backup, which is
the base for subsequent incremental backups, copies all blocks containing data, backing the
datafile up into a backup set just as a full backup would.
Incremental level 1 backup can be of two types


Differential Backup
It backs up all blocks changed after the most recent incremental backup at level 1 or 0
Anar Godjaev


Cumulative Backup
It backs up all blocks changed after the most recent incremental backup at level 0.
The size and the time to take backup solely depend upon the number of modified and
incremental backup level.

6. RMAN Setup
•

RMAN configuration
RMAN has been configured to support the backup and recover strategies. The backup
strategy is as follows,



•

A level zero backup on Sundays
A level one cumulative backup on the remaining days

RMAN configuration parameters
The configuration parameters are as follows


Configure RMAN to backup the control file after each backup.
CONFIGURE CONTROLFILE AUTOBACKUP ON;



Configure RMAN to write controlfile autobackups to the /backup directory.
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
'<backup_path>/%F';



Configure RMAN to use <no of cpu> disk channels for backup, restore, recovery, and
maintenance operations.
CONFIGURE DEVICE TYPE DISK PARALLELISM <no of cpu>;



Configure the channel to use <no of cpu> disk channels for backup, restore, recovery,
and maintenance operations.
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT ‘<path for backup>/ ora_df%t_s%s_s
%p';

•

RMAN backup scripts


The level 0 backup script is as follows:
RMAN> BACKUP INCREMENTAL LEVEL 0 DATABASE PLUS ARCHIVELOG;



The level 1 backup script is as follows:
RMAN> BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE PLUS ARCHIVELOG;
Anar Godjaev
•

RMAN restore and recovery scenarios
Case 1: Datafile recovery
This section assumes that datafile 5 has been damaged and needs to be restored and
recovered, and that the current controlfile and all other datafiles are intact. The database is
open during the restore and recovery.
The steps are:


Offline the datafile that needs recovery
RMAN> SQL 'ALTER DATABASE DATAFILE 5 OFFLINE';



Restore the datafile from backups
RMAN> RESTORE DATAFILE 5;



Recover the datafile
RMAN> RECOVER DATAFILE 5;



Make online recovered datafile
RMAN> SQL 'ALTER DATABASE DATAFILE 5 ONLINE';

Case 2: Tablespace recovery
This section assumes that tablespace tbs_5, containing datafiles 5, 6, and 7 has been
damaged and needs to be restored and recovered, and that the current controlfile and all
other datafiles are intact. The database is open during the restore and recovery.
The steps are:


Offline the tablespace that needs recovery
RMAN> SQL 'ALTER TABLESPACE TBS_5 OFFLINE';



Restore the tablespace from backups
RMAN> RESTORE TABLESPACE TBS_5;



Recover the tablespace
RMAN>RECOVER TABLESPACE TBS_5;



Online the recovered tablespace
RMAN>SQL 'ALTER TABLESPACE TBS_5 ONLINE';
Anar Godjaev
Case 3: Disaster recovery
This section assumes that all control files, data files and parameter files are lost. To perform
recovery in this case, the initialization parameters needs to be restored manually by editing
the default initialization parameter file available in the ORACLE_HOME path and set the
parameters according to the requirements. Then use RMAN to restore and recover the
database as described below.
The commands below assume that all initialization parameter files are restored and the
complete directory structures for datafiles are recreated.


Login to RMAN command prompt
$rman target /



Set the DBID of the database
Set dbid <DBID of database to restore>



Start the database in nomount mode
RMAN> STARTUP NOMOUNT;



Restore the control file from backup
RMAN>RESTORE CONTROLFILE FROM ‘<path_of_backup>/<latest controlfile from backup>;



Change the database from nomunt mode to mount mode
RMAN> ALTER DATABASE MOUNT;



Restore the database
RMAN> RESTORE DATABASE;



Recover the database
RMAN> RECOVER DATABASE;



Open the database with resetlogs
RMAN> ALTER DATABASE OPEN RESETLOGS;

You must take a new whole database backup after resetlogs, since backups of previous
incarnation are not easily usable.
Anar Godjaev
Case 3: Disaster recovery
This section assumes that all control files, data files and parameter files are lost. To perform
recovery in this case, the initialization parameters needs to be restored manually by editing
the default initialization parameter file available in the ORACLE_HOME path and set the
parameters according to the requirements. Then use RMAN to restore and recover the
database as described below.
The commands below assume that all initialization parameter files are restored and the
complete directory structures for datafiles are recreated.


Login to RMAN command prompt
$rman target /



Set the DBID of the database
Set dbid <DBID of database to restore>



Start the database in nomount mode
RMAN> STARTUP NOMOUNT;



Restore the control file from backup
RMAN>RESTORE CONTROLFILE FROM ‘<path_of_backup>/<latest controlfile from backup>;



Change the database from nomunt mode to mount mode
RMAN> ALTER DATABASE MOUNT;



Restore the database
RMAN> RESTORE DATABASE;



Recover the database
RMAN> RECOVER DATABASE;



Open the database with resetlogs
RMAN> ALTER DATABASE OPEN RESETLOGS;

You must take a new whole database backup after resetlogs, since backups of previous
incarnation are not easily usable.

More Related Content

What's hot

RMAN – The Pocket Knife of a DBA
RMAN – The Pocket Knife of a DBA RMAN – The Pocket Knife of a DBA
RMAN – The Pocket Knife of a DBA
Guatemala User Group
 
Backup and recovery in oracle
Backup and recovery in oracleBackup and recovery in oracle
Backup and recovery in oracle
sadegh salehi
 
Dba 3+ exp qus
Dba 3+ exp qusDba 3+ exp qus
Dba 3+ exp quskrreddy21
 
Oracle data guard configuration in 12c
Oracle data guard configuration in 12cOracle data guard configuration in 12c
Oracle data guard configuration in 12c
uzzal basak
 
RMAN in 12c: The Next Generation (PPT)
RMAN in 12c: The Next Generation (PPT)RMAN in 12c: The Next Generation (PPT)
RMAN in 12c: The Next Generation (PPT)
Gustavo Rene Antunez
 
Oracle Database Backups and Disaster Recovery @ Autodesk
Oracle Database Backups and Disaster Recovery @ AutodeskOracle Database Backups and Disaster Recovery @ Autodesk
Oracle Database Backups and Disaster Recovery @ AutodeskAlan Williams
 
Oracle Basics and Architecture
Oracle Basics and ArchitectureOracle Basics and Architecture
Oracle Basics and ArchitectureSidney Chen
 
Oracle database 12c new features
Oracle database 12c new featuresOracle database 12c new features
Oracle database 12c new features
Remote DBA Services
 
Why virtual private catalog?
Why virtual private catalog?Why virtual private catalog?
Why virtual private catalog?
Satishbabu Gunukula
 
Dataguard presentation
Dataguard presentationDataguard presentation
Dataguard presentation
Vimlendu Kumar
 
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive PresentationNabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
Nabil Nawaz
 
Les 02 config
Les 02 configLes 02 config
Les 02 config
Femi Adeyemi
 
High Availability And Oracle Data Guard 11g R2
High Availability And Oracle Data Guard 11g R2High Availability And Oracle Data Guard 11g R2
High Availability And Oracle Data Guard 11g R2
Mario Redón Luz
 

What's hot (20)

RMAN – The Pocket Knife of a DBA
RMAN – The Pocket Knife of a DBA RMAN – The Pocket Knife of a DBA
RMAN – The Pocket Knife of a DBA
 
Backup and recovery in oracle
Backup and recovery in oracleBackup and recovery in oracle
Backup and recovery in oracle
 
Dba 3+ exp qus
Dba 3+ exp qusDba 3+ exp qus
Dba 3+ exp qus
 
Oracle data guard configuration in 12c
Oracle data guard configuration in 12cOracle data guard configuration in 12c
Oracle data guard configuration in 12c
 
Oracle Data Guard
Oracle Data GuardOracle Data Guard
Oracle Data Guard
 
RMAN in 12c: The Next Generation (PPT)
RMAN in 12c: The Next Generation (PPT)RMAN in 12c: The Next Generation (PPT)
RMAN in 12c: The Next Generation (PPT)
 
Rac questions
Rac questionsRac questions
Rac questions
 
Oracle Database Backups and Disaster Recovery @ Autodesk
Oracle Database Backups and Disaster Recovery @ AutodeskOracle Database Backups and Disaster Recovery @ Autodesk
Oracle Database Backups and Disaster Recovery @ Autodesk
 
Les 03 catalog
Les 03 catalogLes 03 catalog
Les 03 catalog
 
Oracle Basics and Architecture
Oracle Basics and ArchitectureOracle Basics and Architecture
Oracle Basics and Architecture
 
Oracle database 12c new features
Oracle database 12c new featuresOracle database 12c new features
Oracle database 12c new features
 
Less04 Instance
Less04 InstanceLess04 Instance
Less04 Instance
 
Why virtual private catalog?
Why virtual private catalog?Why virtual private catalog?
Why virtual private catalog?
 
Dataguard presentation
Dataguard presentationDataguard presentation
Dataguard presentation
 
Data Guard Architecture & Setup
Data Guard Architecture & SetupData Guard Architecture & Setup
Data Guard Architecture & Setup
 
Xpp c user_rec
Xpp c user_recXpp c user_rec
Xpp c user_rec
 
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive PresentationNabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
 
Les 02 config
Les 02 configLes 02 config
Les 02 config
 
Les 08 tune_rman
Les 08 tune_rmanLes 08 tune_rman
Les 08 tune_rman
 
High Availability And Oracle Data Guard 11g R2
High Availability And Oracle Data Guard 11g R2High Availability And Oracle Data Guard 11g R2
High Availability And Oracle Data Guard 11g R2
 

Viewers also liked

Step by Step Restore rman to different host
Step by Step Restore rman to different hostStep by Step Restore rman to different host
Step by Step Restore rman to different host
Osama Mustafa
 
RMAN best practices for RAC
RMAN best practices for RACRMAN best practices for RAC
RMAN best practices for RAC
Syed Hussain
 
Oracle database 12 c on oracle linux 7.3
Oracle database 12 c on oracle linux 7.3Oracle database 12 c on oracle linux 7.3
Oracle database 12 c on oracle linux 7.3
suk kim
 
10 Problems with your RMAN backup script - whitepaper
10 Problems with your RMAN backup script - whitepaper10 Problems with your RMAN backup script - whitepaper
10 Problems with your RMAN backup script - whitepaper
Yury Velikanov
 
Oracle Exadata Interview Questions and Answers
Oracle Exadata Interview Questions and AnswersOracle Exadata Interview Questions and Answers
Oracle Exadata Interview Questions and Answers
Exadatadba
 
12c on RHEL7
12c on RHEL712c on RHEL7
12c on RHEL7
Osama Mustafa
 
1 - Introduction to PL/SQL
1 - Introduction to PL/SQL1 - Introduction to PL/SQL
1 - Introduction to PL/SQL
rehaniltifat
 
Asm disk group migration from
Asm disk group migration from Asm disk group migration from
Asm disk group migration from Anar Godjaev
 
Oracle GoldenGate
Oracle GoldenGateOracle GoldenGate
Oracle GoldenGate
Anar Godjaev
 
Oracle Golden Gate
Oracle Golden GateOracle Golden Gate
Oracle Golden GateAnar Godjaev
 
How to protect your sensitive data using oracle database vault / Creating and...
How to protect your sensitive data using oracle database vault / Creating and...How to protect your sensitive data using oracle database vault / Creating and...
How to protect your sensitive data using oracle database vault / Creating and...
Anar Godjaev
 

Viewers also liked (15)

Step by Step Restore rman to different host
Step by Step Restore rman to different hostStep by Step Restore rman to different host
Step by Step Restore rman to different host
 
RMAN best practices for RAC
RMAN best practices for RACRMAN best practices for RAC
RMAN best practices for RAC
 
Oracle database 12 c on oracle linux 7.3
Oracle database 12 c on oracle linux 7.3Oracle database 12 c on oracle linux 7.3
Oracle database 12 c on oracle linux 7.3
 
10 Problems with your RMAN backup script - whitepaper
10 Problems with your RMAN backup script - whitepaper10 Problems with your RMAN backup script - whitepaper
10 Problems with your RMAN backup script - whitepaper
 
Oracle Exadata Interview Questions and Answers
Oracle Exadata Interview Questions and AnswersOracle Exadata Interview Questions and Answers
Oracle Exadata Interview Questions and Answers
 
forms builder
forms builderforms builder
forms builder
 
12c on RHEL7
12c on RHEL712c on RHEL7
12c on RHEL7
 
1 - Introduction to PL/SQL
1 - Introduction to PL/SQL1 - Introduction to PL/SQL
1 - Introduction to PL/SQL
 
Asm disk group migration from
Asm disk group migration from Asm disk group migration from
Asm disk group migration from
 
Table Partitions
Table PartitionsTable Partitions
Table Partitions
 
Oracle GoldenGate
Oracle GoldenGateOracle GoldenGate
Oracle GoldenGate
 
Wait Interface
Wait InterfaceWait Interface
Wait Interface
 
Tuning SGA
Tuning SGATuning SGA
Tuning SGA
 
Oracle Golden Gate
Oracle Golden GateOracle Golden Gate
Oracle Golden Gate
 
How to protect your sensitive data using oracle database vault / Creating and...
How to protect your sensitive data using oracle database vault / Creating and...How to protect your sensitive data using oracle database vault / Creating and...
How to protect your sensitive data using oracle database vault / Creating and...
 

Similar to Backup and Recovery Procedure

Les 05 Create Bu
Les 05 Create BuLes 05 Create Bu
Les 05 Create Bu
vivaankumar
 
Backups And Recovery
Backups And RecoveryBackups And Recovery
Backups And Recovery
asifmalik110
 
Oracle OCP Backup Exam
Oracle OCP Backup ExamOracle OCP Backup Exam
Oracle OCP Backup ExamInprise Group
 
Oracle ocp backup exam
Oracle ocp backup examOracle ocp backup exam
Oracle ocp backup examsriram raj
 
Les 02 Config Rec
Les 02 Config RecLes 02 Config Rec
Les 02 Config Rec
vivaankumar
 
Les 06 Perform Rec
Les 06 Perform RecLes 06 Perform Rec
Les 06 Perform Rec
vivaankumar
 
Les 07 Rman Rec
Les 07 Rman RecLes 07 Rman Rec
Les 07 Rman Rec
vivaankumar
 
Collaborate 2012 - RMAN Eliminate the mystery
Collaborate 2012 - RMAN Eliminate the mysteryCollaborate 2012 - RMAN Eliminate the mystery
Collaborate 2012 - RMAN Eliminate the mystery
Nelson Calero
 
Ioug tip book11_gunukula
Ioug tip book11_gunukulaIoug tip book11_gunukula
Ioug tip book11_gunukula
Satishbabu Gunukula
 
Backup & recovery with rman
Backup & recovery with rmanBackup & recovery with rman
Backup & recovery with rman
itsabidhussain
 
Oracle Database Backup
Oracle Database BackupOracle Database Backup
Oracle Database Backup
Handy_Backup
 
Databaseadmonfundamentalitprosdcchapter6
Databaseadmonfundamentalitprosdcchapter6Databaseadmonfundamentalitprosdcchapter6
Databaseadmonfundamentalitprosdcchapter6
Julián Castiblanco
 
8 i rman_love_it
8 i rman_love_it8 i rman_love_it
8 i rman_love_it
Anil Pandey
 
Rman backup and recovery 11g new features
Rman backup and recovery 11g new featuresRman backup and recovery 11g new features
Rman backup and recovery 11g new features
Nabi Abdul
 

Similar to Backup and Recovery Procedure (20)

Less15 Backups
Less15 BackupsLess15 Backups
Less15 Backups
 
Les 05 Create Bu
Les 05 Create BuLes 05 Create Bu
Les 05 Create Bu
 
Backup&recovery
Backup&recoveryBackup&recovery
Backup&recovery
 
Backups And Recovery
Backups And RecoveryBackups And Recovery
Backups And Recovery
 
Oracle OCP Backup Exam
Oracle OCP Backup ExamOracle OCP Backup Exam
Oracle OCP Backup Exam
 
Oracle ocp backup exam
Oracle ocp backup examOracle ocp backup exam
Oracle ocp backup exam
 
Les 02 Config Rec
Les 02 Config RecLes 02 Config Rec
Les 02 Config Rec
 
Les 07 rman_rec
Les 07 rman_recLes 07 rman_rec
Les 07 rman_rec
 
Les 06 Perform Rec
Les 06 Perform RecLes 06 Perform Rec
Les 06 Perform Rec
 
Les 07 Rman Rec
Les 07 Rman RecLes 07 Rman Rec
Les 07 Rman Rec
 
5895640.ppt
5895640.ppt5895640.ppt
5895640.ppt
 
Collaborate 2012 - RMAN Eliminate the mystery
Collaborate 2012 - RMAN Eliminate the mysteryCollaborate 2012 - RMAN Eliminate the mystery
Collaborate 2012 - RMAN Eliminate the mystery
 
Ioug tip book11_gunukula
Ioug tip book11_gunukulaIoug tip book11_gunukula
Ioug tip book11_gunukula
 
Backup & recovery with rman
Backup & recovery with rmanBackup & recovery with rman
Backup & recovery with rman
 
Les 05 create_bu
Les 05 create_buLes 05 create_bu
Les 05 create_bu
 
Rmanpres
RmanpresRmanpres
Rmanpres
 
Oracle Database Backup
Oracle Database BackupOracle Database Backup
Oracle Database Backup
 
Databaseadmonfundamentalitprosdcchapter6
Databaseadmonfundamentalitprosdcchapter6Databaseadmonfundamentalitprosdcchapter6
Databaseadmonfundamentalitprosdcchapter6
 
8 i rman_love_it
8 i rman_love_it8 i rman_love_it
8 i rman_love_it
 
Rman backup and recovery 11g new features
Rman backup and recovery 11g new featuresRman backup and recovery 11g new features
Rman backup and recovery 11g new features
 

More from Anar Godjaev

how to protect your sensitive data using oracle database vault
how to protect your sensitive data using oracle database vaulthow to protect your sensitive data using oracle database vault
how to protect your sensitive data using oracle database vaultAnar Godjaev
 
Database Vault / Verinin Güvenliği
Database Vault /  Verinin GüvenliğiDatabase Vault /  Verinin Güvenliği
Database Vault / Verinin GüvenliğiAnar Godjaev
 
Oracle 10g Database Server Kurulum
Oracle 10g Database Server KurulumOracle 10g Database Server Kurulum
Oracle 10g Database Server KurulumAnar Godjaev
 
DataPump ile Single Parititon Export
DataPump ile Single Parititon ExportDataPump ile Single Parititon Export
DataPump ile Single Parititon ExportAnar Godjaev
 
Redologlar ve Yöneti̇mi̇
Redologlar ve Yöneti̇mi̇Redologlar ve Yöneti̇mi̇
Redologlar ve Yöneti̇mi̇Anar Godjaev
 
Veri̇tabani ve Kullanici Yöneti̇mi̇
Veri̇tabani ve Kullanici Yöneti̇mi̇Veri̇tabani ve Kullanici Yöneti̇mi̇
Veri̇tabani ve Kullanici Yöneti̇mi̇Anar Godjaev
 
Instance ve Media Bozukluklarını Inceleme
Instance ve Media Bozukluklarını IncelemeInstance ve Media Bozukluklarını Inceleme
Instance ve Media Bozukluklarını IncelemeAnar Godjaev
 
Conditional Control
Conditional ControlConditional Control
Conditional ControlAnar Godjaev
 
Audit Mekani̇zmasi
Audit Mekani̇zmasiAudit Mekani̇zmasi
Audit Mekani̇zmasiAnar Godjaev
 
Backup and Recovery
Backup and RecoveryBackup and Recovery
Backup and RecoveryAnar Godjaev
 
Oracle Managed Files
Oracle Managed FilesOracle Managed Files
Oracle Managed FilesAnar Godjaev
 
Recovery Manager (RMAN)
Recovery Manager (RMAN)Recovery Manager (RMAN)
Recovery Manager (RMAN)Anar Godjaev
 

More from Anar Godjaev (20)

how to protect your sensitive data using oracle database vault
how to protect your sensitive data using oracle database vaulthow to protect your sensitive data using oracle database vault
how to protect your sensitive data using oracle database vault
 
Database Vault / Verinin Güvenliği
Database Vault /  Verinin GüvenliğiDatabase Vault /  Verinin Güvenliği
Database Vault / Verinin Güvenliği
 
Oracle 10g Database Server Kurulum
Oracle 10g Database Server KurulumOracle 10g Database Server Kurulum
Oracle 10g Database Server Kurulum
 
DataPump ile Single Parititon Export
DataPump ile Single Parititon ExportDataPump ile Single Parititon Export
DataPump ile Single Parititon Export
 
Redologlar ve Yöneti̇mi̇
Redologlar ve Yöneti̇mi̇Redologlar ve Yöneti̇mi̇
Redologlar ve Yöneti̇mi̇
 
Contraints
ContraintsContraints
Contraints
 
Oracle SQL
Oracle SQLOracle SQL
Oracle SQL
 
Veri̇tabani ve Kullanici Yöneti̇mi̇
Veri̇tabani ve Kullanici Yöneti̇mi̇Veri̇tabani ve Kullanici Yöneti̇mi̇
Veri̇tabani ve Kullanici Yöneti̇mi̇
 
Instance ve Media Bozukluklarını Inceleme
Instance ve Media Bozukluklarını IncelemeInstance ve Media Bozukluklarını Inceleme
Instance ve Media Bozukluklarını Inceleme
 
Conditional Control
Conditional ControlConditional Control
Conditional Control
 
PL/SQL Blocks
PL/SQL BlocksPL/SQL Blocks
PL/SQL Blocks
 
Audit Mekani̇zmasi
Audit Mekani̇zmasiAudit Mekani̇zmasi
Audit Mekani̇zmasi
 
Parallel Server
Parallel ServerParallel Server
Parallel Server
 
Backup and Recovery
Backup and RecoveryBackup and Recovery
Backup and Recovery
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
LogMiner
LogMinerLogMiner
LogMiner
 
Undo Management
Undo ManagementUndo Management
Undo Management
 
ASM
ASMASM
ASM
 
Oracle Managed Files
Oracle Managed FilesOracle Managed Files
Oracle Managed Files
 
Recovery Manager (RMAN)
Recovery Manager (RMAN)Recovery Manager (RMAN)
Recovery Manager (RMAN)
 

Recently uploaded

Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 

Recently uploaded (20)

Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 

Backup and Recovery Procedure

  • 1. Anar Godjaev Backup & Recovery Procedure
  • 2. Anar Godjaev Introduction In general, backup and recovery refers to the various strategies and procedures involved in protecting your database against data loss and reconstructing the database after any kind of data loss. Oracle various kinds of backup like Physical, Logical. Physical Backup is backups of physical files used in database like controlfile, datafile and archivelog files. Logical Backup contain logical data, like table and procedure, exported from the database with oracle export utility and stored in binary format 1. Type of failures Following are the types of failures that require recovery from the backup: • User Error User errors occur when, either due to an error in application logic or a manual misstep; data in your database is changed or deleted incorrectly. Data loss due to user error includes such missteps as dropping important tables or deleting or changing the contents of a table. While user training and careful management of privileges can prevent most user errors, your backup strategy determines how gracefully you recover the lost data when user error does cause data loss. • Media Failure A media failure is the failure of a read or write of a disk file required to run the database, due to a physical problem with the disk such as a head crash. Any database file can be vulnerable to a media failure. 2. Backup options in Oracle • Physical backups   • Cold (off-line) backup    Full database only Require downtime Not flexible for point in time recovery Hot (on-line) backup  Different types of backups: full, incremental, archive logs  No need of database downtime  Database can be recovered to any point in time ,based on backup retention period Logical backups   Logical copy of data in the database (like tables, packages) Can be taken either with Export/Import tools or with Data Pump (10g/11g)
  • 3. Anar Godjaev 3. Perform backup and recovery based on physical backups There are two ways to perform backup and recovery based on physical backups: • Recovery Manager (RMAN) RMAN is as a tool (with command-line client and Enterprise Manager GUI interfaces) that integrates with sessions running on the Oracle server to perform backup and recovery activity • User Managed In user managed backup user has to make the periodic backup of all the datafiles, control files, parameter files using operating system commands and recovery the database using SQL* Plus recovery command 4. Recovery Manager (RMAN) RMAN can back up entire database; all datafiles in a tablespace, selected datafiles, control files and archived redo log files. • Benefits of RMAN         RMAN is a tool that comes at no extra cost. It is available free with the Oracle Database. Supports incremental backup strategies Supports parallel operations (Multiple Channels for Backup and Restore) RMAN can detect corrupted blocks Controlfiles and spfile of database can be configured to automatically backup by RMAN Knows what needs to be backup Knows what is required for the recovery Remembers location of the backup sets 5. RMAN Incremental Backup RMAN incremental backups back up only datafile blocks that have changed since a specified previous backup. Incremental backups can be of full databases, individual tablespaces or datafiles. For full backups, if database is in ARCHIVELOG mode, you can make incremental backups if the database is open; if the database is in NOARCHIVELOG mode, then you can only make incremental backups after a consistent shutdown. • Level 0 and Level 1 Incremental Backups Incremental backups can be either level 0 or level 1. A level 0 incremental backup, which is the base for subsequent incremental backups, copies all blocks containing data, backing the datafile up into a backup set just as a full backup would. Incremental level 1 backup can be of two types  Differential Backup It backs up all blocks changed after the most recent incremental backup at level 1 or 0
  • 4. Anar Godjaev  Cumulative Backup It backs up all blocks changed after the most recent incremental backup at level 0. The size and the time to take backup solely depend upon the number of modified and incremental backup level. 6. RMAN Setup • RMAN configuration RMAN has been configured to support the backup and recover strategies. The backup strategy is as follows,   • A level zero backup on Sundays A level one cumulative backup on the remaining days RMAN configuration parameters The configuration parameters are as follows  Configure RMAN to backup the control file after each backup. CONFIGURE CONTROLFILE AUTOBACKUP ON;  Configure RMAN to write controlfile autobackups to the /backup directory. CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '<backup_path>/%F';  Configure RMAN to use <no of cpu> disk channels for backup, restore, recovery, and maintenance operations. CONFIGURE DEVICE TYPE DISK PARALLELISM <no of cpu>;  Configure the channel to use <no of cpu> disk channels for backup, restore, recovery, and maintenance operations. CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT ‘<path for backup>/ ora_df%t_s%s_s %p'; • RMAN backup scripts  The level 0 backup script is as follows: RMAN> BACKUP INCREMENTAL LEVEL 0 DATABASE PLUS ARCHIVELOG;  The level 1 backup script is as follows: RMAN> BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE PLUS ARCHIVELOG;
  • 5. Anar Godjaev • RMAN restore and recovery scenarios Case 1: Datafile recovery This section assumes that datafile 5 has been damaged and needs to be restored and recovered, and that the current controlfile and all other datafiles are intact. The database is open during the restore and recovery. The steps are:  Offline the datafile that needs recovery RMAN> SQL 'ALTER DATABASE DATAFILE 5 OFFLINE';  Restore the datafile from backups RMAN> RESTORE DATAFILE 5;  Recover the datafile RMAN> RECOVER DATAFILE 5;  Make online recovered datafile RMAN> SQL 'ALTER DATABASE DATAFILE 5 ONLINE'; Case 2: Tablespace recovery This section assumes that tablespace tbs_5, containing datafiles 5, 6, and 7 has been damaged and needs to be restored and recovered, and that the current controlfile and all other datafiles are intact. The database is open during the restore and recovery. The steps are:  Offline the tablespace that needs recovery RMAN> SQL 'ALTER TABLESPACE TBS_5 OFFLINE';  Restore the tablespace from backups RMAN> RESTORE TABLESPACE TBS_5;  Recover the tablespace RMAN>RECOVER TABLESPACE TBS_5;  Online the recovered tablespace RMAN>SQL 'ALTER TABLESPACE TBS_5 ONLINE';
  • 6. Anar Godjaev Case 3: Disaster recovery This section assumes that all control files, data files and parameter files are lost. To perform recovery in this case, the initialization parameters needs to be restored manually by editing the default initialization parameter file available in the ORACLE_HOME path and set the parameters according to the requirements. Then use RMAN to restore and recover the database as described below. The commands below assume that all initialization parameter files are restored and the complete directory structures for datafiles are recreated.  Login to RMAN command prompt $rman target /  Set the DBID of the database Set dbid <DBID of database to restore>  Start the database in nomount mode RMAN> STARTUP NOMOUNT;  Restore the control file from backup RMAN>RESTORE CONTROLFILE FROM ‘<path_of_backup>/<latest controlfile from backup>;  Change the database from nomunt mode to mount mode RMAN> ALTER DATABASE MOUNT;  Restore the database RMAN> RESTORE DATABASE;  Recover the database RMAN> RECOVER DATABASE;  Open the database with resetlogs RMAN> ALTER DATABASE OPEN RESETLOGS; You must take a new whole database backup after resetlogs, since backups of previous incarnation are not easily usable.
  • 7. Anar Godjaev Case 3: Disaster recovery This section assumes that all control files, data files and parameter files are lost. To perform recovery in this case, the initialization parameters needs to be restored manually by editing the default initialization parameter file available in the ORACLE_HOME path and set the parameters according to the requirements. Then use RMAN to restore and recover the database as described below. The commands below assume that all initialization parameter files are restored and the complete directory structures for datafiles are recreated.  Login to RMAN command prompt $rman target /  Set the DBID of the database Set dbid <DBID of database to restore>  Start the database in nomount mode RMAN> STARTUP NOMOUNT;  Restore the control file from backup RMAN>RESTORE CONTROLFILE FROM ‘<path_of_backup>/<latest controlfile from backup>;  Change the database from nomunt mode to mount mode RMAN> ALTER DATABASE MOUNT;  Restore the database RMAN> RESTORE DATABASE;  Recover the database RMAN> RECOVER DATABASE;  Open the database with resetlogs RMAN> ALTER DATABASE OPEN RESETLOGS; You must take a new whole database backup after resetlogs, since backups of previous incarnation are not easily usable.