SlideShare a Scribd company logo
ORACLE
DATABASE HOT
BACKUP AND
RECOVERY
Hot Backup Overview
Taking the backup while the database is up and running is called hot
backup
During hot backup database will be in fuzzy state and still users can
perform transactions which makes backup inconsistent
Whenever we place a tablespace or database in begin backup mode,
following happens
The corresponding datafiles header will be freezed i.e CKPT process will
not update latest SCN
Body of the datafile is still active i.e DBWRn will write the dirty blocks to
datafiles
After end backup, datafile header will be unfreezed and CKPT process
will update latest SCN immediately by taking that information from
controlfiles
During hot backup, we will observe much redo generated because
oracle will copy entire data block as redo entry into LBC. This is to avoid
fractured block
A block fracture occurs when a block is being read by the backup, and
being written to at the same time by DBWR. Because the OS (usually)
reads blocks at a different rate than Oracle, your OS copy will pull
pieces of an Oracle block at a time. What if the OS copy pulls half a
block, and while that is happening, the block is changed by DBWR?
When the OS copy pulls the second half of the block it will result in
mismatched halves, which Oracle would not know how to reconcile
This is also why the SCN of the datafile header does not change
when a tablespace enters hot backup mode. The current SCNs are
recorded in redo, but not in the datafile. This is to ensure that Oracle
will always recover over the datafile contents with redo entries. When
recovery occurs, the fractured datafile block will be replaced with a
complete block from redo, making it whole again
Note: Database should be in archivelog mode to perform hot backup
Taking hot backup
Put the database in begin backup mode
Copy all database related files to backup location. Create
a location on OS where you can copy backup files. Eg
/u02/db_backup/hot_bkp_12_jan/
Get the location of datafiles, controlfiles, redolog files
Copy above files using Linx cp command to backup location
Put DB in end backup mode
Take manual controlfile backup
Backup the archive logs generated during the begin backup and end
backup mode.
Copy above archive log files to the backup location using the Linux cp
command.
Sometimes you want to check which tablespaces inside
the database are specifically kept in BACKUP mode. Use
below query to get all the tablespaces which are ACTIVE
mode (means they are under BEGIN BACKUP mode).
Important queries
The following sample output shows that the example and
users tablespaces currently have ACTIVE status:
Parameter file recovery
There are three scenarios when you loose parameter file and how to
recover using hot backups.
Scenario 1: When you have parameter file backup
Let us simulate a failure. We assume that we already have taken the hot backup.
DB is up and running
Delete both pfile and spfile under $ORACLE_HOME/dbs
location
Connect to sqlplus and shutdown the database
Now start the database and it should throw below error
Recovering the parameter file:
Exit the sqlplus
Go to hot backup location
Copy parameter files (pfile & spfile) to $ORACLE_HOME/dbs location
Connect to sqlplus and start your database!
Scenario 2: When you do not have parameter file backup
Let us assume we do not have hot backup of the parameter files, then
follow below method to recovery your parameter file:
Goto alert log location (Generally
/u01/app/oracle/diag/rdbms/testdb/testdb/trace)
Cat the alert log file (cat alert_testdb.log)
Find last time database was started
Copy all the non-default parameters into notepad
Create a pfile under $ORACLE_HOME/dbs location
The file name should be init<sid>.ora
Paste all contents from notepad
Start the database!
From 11g onwards, you can recreate parameter file in case the database
is up and running. Even if you loose parameter file but database instance
is still running, we can recreate parameter file from memory:
Scenario 3: When you do not have parameter file
backup in 11g
Control file recovery
Simulate failure (we assume that hot backup is already taken).
Without shutting down the database, delete database control file at
OS level
Scenario 1: steps for control file incomplete recovery
Scenario 2: steps for control file complete recovery
Goto udump location and copy the first create
controlfile script to a file called control.sql
Note: After creating control files using above
procedure, there will be no SCN in that. So server
process will write the latest SCN to control files in
this situation by taking info from datafile header.
Redolog recovery
Let’s try to recovery our database with loss of redolog files. Simulate
a failure and let us delete redologs at OS level
Recover redo log file in archive log mode
What resetlogs will do?
Create new redolog files at OS level (location and size will be
taken from controlfile) if not already existing
Whenever database is opened with resetlogs option, we will say
database entered into new incarnation. If database is in new
incarnation, the backups which were taken till now are no more
useful. So, whenever we perform an incomplete recovery we
need to take full backup of database immediately
We can find the prev incarnation information of a database from
below query
Resets the log seq number (LSN) to 1, 2, 3 etc for the created
files
Tablespace recovery
Delete all the data files related to particular tablespace and follow
below recovery steps
Datafile recovery
Delete only one data file related to a tablespace and follow below
steps to recover the data file
System tablespace
recovery
Delete all the data files related to system tablespace and use below
steps to recover the system tablespace
Entire database
recovery
Let us simulate a failure (make sure you have already taken the
database backup). Delete all the data files, control files and redo
log files associated to the database.
Follow below steps to perform entire database recovery
Note: we can drop a single datafile using below command
When we use above command, it will delete the file at OS level, but
data dictionary will not be updated and never we can get back that
file even if we have backup. So, don’t use this in real time.
Datafile recovery
without backup
In case you do not have hot backup of the database or a particular
data file still you can recover entire data file but you need to have
all the archive logs from the day data file was first created.
To simulate this type of failure, do following:
Create a tablespace
Create user to store one table inside new tablespace
Delete data file at OS level
Now use below queries to recover the data file (note we do
not have any hot backup)
Courses | Projects | Bootcamps

More Related Content

What's hot

Oracle Database Overview
Oracle Database OverviewOracle Database Overview
Oracle Database Overview
honglee71
 
Boot process
Boot processBoot process
Boot process
Salman Memon
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to Unix
Nishant Munjal
 
Oracle Architecture
Oracle ArchitectureOracle Architecture
Oracle Architecture
Neeraj Singh
 
Overview of oracle database
Overview of oracle databaseOverview of oracle database
Overview of oracle database
Samar Prasad
 
12. oracle database architecture
12. oracle database architecture12. oracle database architecture
12. oracle database architecture
Amrit Kaur
 
Less05 asm instance
Less05 asm instanceLess05 asm instance
Less05 asm instance
Amit Bhalla
 
Rman Presentation
Rman PresentationRman Presentation
Rman Presentation
Rick van Ek
 
Networking in Windows Operating System
Networking in Windows Operating SystemNetworking in Windows Operating System
Networking in Windows Operating System
Mohammed Adam
 
Linux System Programming - File I/O
Linux System Programming - File I/O Linux System Programming - File I/O
Linux System Programming - File I/O
YourHelper1
 
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsYour tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
John Kanagaraj
 
ASM
ASMASM
Linux booting Process
Linux booting ProcessLinux booting Process
Linux booting Process
Gaurav Sharma
 
RAID
RAIDRAID
Disk management
Disk managementDisk management
Disk management
Agnas Jasmine
 
File management
File managementFile management
File management
Vishal Singh
 
Database backup & recovery
Database backup & recoveryDatabase backup & recovery
Database backup & recovery
Mustafa Khan
 
MySQL ppt
MySQL ppt MySQL ppt
MySQL ppt
AtharvaSawant10
 
BACKUP & RECOVERY IN DBMS
BACKUP & RECOVERY IN DBMSBACKUP & RECOVERY IN DBMS
BACKUP & RECOVERY IN DBMS
BaivabiNayak
 
Backup And Recovery
Backup And RecoveryBackup And Recovery
Backup And Recovery
Wynthorpe
 

What's hot (20)

Oracle Database Overview
Oracle Database OverviewOracle Database Overview
Oracle Database Overview
 
Boot process
Boot processBoot process
Boot process
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to Unix
 
Oracle Architecture
Oracle ArchitectureOracle Architecture
Oracle Architecture
 
Overview of oracle database
Overview of oracle databaseOverview of oracle database
Overview of oracle database
 
12. oracle database architecture
12. oracle database architecture12. oracle database architecture
12. oracle database architecture
 
Less05 asm instance
Less05 asm instanceLess05 asm instance
Less05 asm instance
 
Rman Presentation
Rman PresentationRman Presentation
Rman Presentation
 
Networking in Windows Operating System
Networking in Windows Operating SystemNetworking in Windows Operating System
Networking in Windows Operating System
 
Linux System Programming - File I/O
Linux System Programming - File I/O Linux System Programming - File I/O
Linux System Programming - File I/O
 
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsYour tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
 
ASM
ASMASM
ASM
 
Linux booting Process
Linux booting ProcessLinux booting Process
Linux booting Process
 
RAID
RAIDRAID
RAID
 
Disk management
Disk managementDisk management
Disk management
 
File management
File managementFile management
File management
 
Database backup & recovery
Database backup & recoveryDatabase backup & recovery
Database backup & recovery
 
MySQL ppt
MySQL ppt MySQL ppt
MySQL ppt
 
BACKUP & RECOVERY IN DBMS
BACKUP & RECOVERY IN DBMSBACKUP & RECOVERY IN DBMS
BACKUP & RECOVERY IN DBMS
 
Backup And Recovery
Backup And RecoveryBackup And Recovery
Backup And Recovery
 

Similar to Oracle database hot backup and recovery

Les 06 Perform Rec
Les 06 Perform RecLes 06 Perform Rec
Les 06 Perform Rec
vivaankumar
 
Mid term &amp; final- preparation- student-review(Oracle)
Mid term &amp; final- preparation- student-review(Oracle)Mid term &amp; final- preparation- student-review(Oracle)
Mid term &amp; final- preparation- student-review(Oracle)
than sare
 
[Altibase] 13 backup and recovery
[Altibase] 13 backup and recovery[Altibase] 13 backup and recovery
[Altibase] 13 backup and recovery
altistory
 
Backup andrecoverychecklist
Backup andrecoverychecklistBackup andrecoverychecklist
Backup andrecoverychecklist
praveen_01236
 
Oracle11g notes
Oracle11g notesOracle11g notes
Oracle11g notes
Manish Mudhliyar
 
Less14 Br Concepts
Less14 Br ConceptsLess14 Br Concepts
Less14 Br Concepts
vivaankumar
 
Hotbackup
HotbackupHotbackup
Hotbackup
oracle documents
 
Xpp c user_rec
Xpp c user_recXpp c user_rec
Xpp c user_rec
Femi Adeyemi
 
Backup andrecoverychecklist
Backup andrecoverychecklistBackup andrecoverychecklist
Backup andrecoverychecklist
مسلم islam
 
Missing redo logs in oracle
Missing redo logs in oracleMissing redo logs in oracle
Missing redo logs in oracle
Bolisetty Srinivas
 
control_file.pdf
control_file.pdfcontrol_file.pdf
control_file.pdf
ssuser81e72b1
 
Backup&recovery
Backup&recoveryBackup&recovery
Backup&recovery
Vinay Thota
 
Controlfilemanagement
ControlfilemanagementControlfilemanagement
Controlfilemanagement
Vinay Thota
 
Les 07 Rman Rec
Les 07 Rman RecLes 07 Rman Rec
Les 07 Rman Rec
vivaankumar
 
Rman cloning when both directory and db name are same.
Rman cloning when both directory and db name are same.Rman cloning when both directory and db name are same.
Rman cloning when both directory and db name are same.
subhani shaik
 
Rman cloning when both directory and db name are same.
Rman cloning when both directory and db name are same.Rman cloning when both directory and db name are same.
Rman cloning when both directory and db name are same.
subhani shaik
 
Oracle Database Backup
Oracle Database BackupOracle Database Backup
Oracle Database Backup
Handy_Backup
 
Les 07 rman_rec
Les 07 rman_recLes 07 rman_rec
Les 07 rman_rec
Femi Adeyemi
 
IMSDB - DBRC
IMSDB - DBRCIMSDB - DBRC
IMSDB - DBRC
Srinimf-Slides
 
Standby db creation commands
Standby db creation commandsStandby db creation commands
Standby db creation commands
Piyush Kumar
 

Similar to Oracle database hot backup and recovery (20)

Les 06 Perform Rec
Les 06 Perform RecLes 06 Perform Rec
Les 06 Perform Rec
 
Mid term &amp; final- preparation- student-review(Oracle)
Mid term &amp; final- preparation- student-review(Oracle)Mid term &amp; final- preparation- student-review(Oracle)
Mid term &amp; final- preparation- student-review(Oracle)
 
[Altibase] 13 backup and recovery
[Altibase] 13 backup and recovery[Altibase] 13 backup and recovery
[Altibase] 13 backup and recovery
 
Backup andrecoverychecklist
Backup andrecoverychecklistBackup andrecoverychecklist
Backup andrecoverychecklist
 
Oracle11g notes
Oracle11g notesOracle11g notes
Oracle11g notes
 
Less14 Br Concepts
Less14 Br ConceptsLess14 Br Concepts
Less14 Br Concepts
 
Hotbackup
HotbackupHotbackup
Hotbackup
 
Xpp c user_rec
Xpp c user_recXpp c user_rec
Xpp c user_rec
 
Backup andrecoverychecklist
Backup andrecoverychecklistBackup andrecoverychecklist
Backup andrecoverychecklist
 
Missing redo logs in oracle
Missing redo logs in oracleMissing redo logs in oracle
Missing redo logs in oracle
 
control_file.pdf
control_file.pdfcontrol_file.pdf
control_file.pdf
 
Backup&recovery
Backup&recoveryBackup&recovery
Backup&recovery
 
Controlfilemanagement
ControlfilemanagementControlfilemanagement
Controlfilemanagement
 
Les 07 Rman Rec
Les 07 Rman RecLes 07 Rman Rec
Les 07 Rman Rec
 
Rman cloning when both directory and db name are same.
Rman cloning when both directory and db name are same.Rman cloning when both directory and db name are same.
Rman cloning when both directory and db name are same.
 
Rman cloning when both directory and db name are same.
Rman cloning when both directory and db name are same.Rman cloning when both directory and db name are same.
Rman cloning when both directory and db name are same.
 
Oracle Database Backup
Oracle Database BackupOracle Database Backup
Oracle Database Backup
 
Les 07 rman_rec
Les 07 rman_recLes 07 rman_rec
Les 07 rman_rec
 
IMSDB - DBRC
IMSDB - DBRCIMSDB - DBRC
IMSDB - DBRC
 
Standby db creation commands
Standby db creation commandsStandby db creation commands
Standby db creation commands
 

More from Arun Sharma

Important Linux Commands
Important Linux CommandsImportant Linux Commands
Important Linux Commands
Arun Sharma
 
Oracle Golden Gate Functions
Oracle Golden Gate FunctionsOracle Golden Gate Functions
Oracle Golden Gate Functions
Arun Sharma
 
Oracle Golden Gate Bidirectional Replication
Oracle Golden Gate Bidirectional ReplicationOracle Golden Gate Bidirectional Replication
Oracle Golden Gate Bidirectional Replication
Arun Sharma
 
Install Oracle 12c Golden Gate On Oracle Linux
Install Oracle 12c Golden Gate On Oracle LinuxInstall Oracle 12c Golden Gate On Oracle Linux
Install Oracle 12c Golden Gate On Oracle Linux
Arun Sharma
 
Configure Golden Gate Initial Load and Change Sync
Configure Golden Gate Initial Load and Change SyncConfigure Golden Gate Initial Load and Change Sync
Configure Golden Gate Initial Load and Change Sync
Arun Sharma
 
Oracle TKPROF Utility
Oracle TKPROF UtilityOracle TKPROF Utility
Oracle TKPROF Utility
Arun Sharma
 
Oracle Segment Advisor
Oracle Segment AdvisorOracle Segment Advisor
Oracle Segment Advisor
Arun Sharma
 
Oracle 11g Installation With ASM and Data Guard Setup
Oracle 11g Installation With ASM and Data Guard SetupOracle 11g Installation With ASM and Data Guard Setup
Oracle 11g Installation With ASM and Data Guard Setup
Arun Sharma
 
Oracle 11g to 12c Upgrade With Data Guard and ASM
Oracle 11g to 12c  Upgrade With Data Guard and ASMOracle 11g to 12c  Upgrade With Data Guard and ASM
Oracle 11g to 12c Upgrade With Data Guard and ASM
Arun Sharma
 
Oracle 11g to 12c Rolling Upgrade
Oracle 11g to 12c Rolling UpgradeOracle 11g to 12c Rolling Upgrade
Oracle 11g to 12c Rolling Upgrade
Arun Sharma
 
Convert Physical Standby Into Logical Standby
Convert Physical Standby Into Logical StandbyConvert Physical Standby Into Logical Standby
Convert Physical Standby Into Logical Standby
Arun Sharma
 
Enable Fast Start Failover Data Guard Broker
Enable Fast Start Failover Data Guard BrokerEnable Fast Start Failover Data Guard Broker
Enable Fast Start Failover Data Guard Broker
Arun Sharma
 
Data Guard Broker Failover
Data Guard Broker FailoverData Guard Broker Failover
Data Guard Broker Failover
Arun Sharma
 
Oracle Data Guard Physical Standby Configuration
Oracle Data Guard Physical Standby ConfigurationOracle Data Guard Physical Standby Configuration
Oracle Data Guard Physical Standby Configuration
Arun Sharma
 
Schedule RMAN Backups On Windows
Schedule RMAN Backups On WindowsSchedule RMAN Backups On Windows
Schedule RMAN Backups On Windows
Arun Sharma
 
RMAN Backup Compression Types
RMAN Backup Compression TypesRMAN Backup Compression Types
RMAN Backup Compression Types
Arun Sharma
 
Scheduling Jobs With DBMA_Scheduler
Scheduling Jobs With DBMA_SchedulerScheduling Jobs With DBMA_Scheduler
Scheduling Jobs With DBMA_Scheduler
Arun Sharma
 
Oracle User Management
Oracle User ManagementOracle User Management
Oracle User Management
Arun Sharma
 
Create Directory Under ASM Diskgroup
Create Directory Under ASM DiskgroupCreate Directory Under ASM Diskgroup
Create Directory Under ASM Diskgroup
Arun Sharma
 
Create Diskgroup Sqlplus Command
Create Diskgroup Sqlplus CommandCreate Diskgroup Sqlplus Command
Create Diskgroup Sqlplus Command
Arun Sharma
 

More from Arun Sharma (20)

Important Linux Commands
Important Linux CommandsImportant Linux Commands
Important Linux Commands
 
Oracle Golden Gate Functions
Oracle Golden Gate FunctionsOracle Golden Gate Functions
Oracle Golden Gate Functions
 
Oracle Golden Gate Bidirectional Replication
Oracle Golden Gate Bidirectional ReplicationOracle Golden Gate Bidirectional Replication
Oracle Golden Gate Bidirectional Replication
 
Install Oracle 12c Golden Gate On Oracle Linux
Install Oracle 12c Golden Gate On Oracle LinuxInstall Oracle 12c Golden Gate On Oracle Linux
Install Oracle 12c Golden Gate On Oracle Linux
 
Configure Golden Gate Initial Load and Change Sync
Configure Golden Gate Initial Load and Change SyncConfigure Golden Gate Initial Load and Change Sync
Configure Golden Gate Initial Load and Change Sync
 
Oracle TKPROF Utility
Oracle TKPROF UtilityOracle TKPROF Utility
Oracle TKPROF Utility
 
Oracle Segment Advisor
Oracle Segment AdvisorOracle Segment Advisor
Oracle Segment Advisor
 
Oracle 11g Installation With ASM and Data Guard Setup
Oracle 11g Installation With ASM and Data Guard SetupOracle 11g Installation With ASM and Data Guard Setup
Oracle 11g Installation With ASM and Data Guard Setup
 
Oracle 11g to 12c Upgrade With Data Guard and ASM
Oracle 11g to 12c  Upgrade With Data Guard and ASMOracle 11g to 12c  Upgrade With Data Guard and ASM
Oracle 11g to 12c Upgrade With Data Guard and ASM
 
Oracle 11g to 12c Rolling Upgrade
Oracle 11g to 12c Rolling UpgradeOracle 11g to 12c Rolling Upgrade
Oracle 11g to 12c Rolling Upgrade
 
Convert Physical Standby Into Logical Standby
Convert Physical Standby Into Logical StandbyConvert Physical Standby Into Logical Standby
Convert Physical Standby Into Logical Standby
 
Enable Fast Start Failover Data Guard Broker
Enable Fast Start Failover Data Guard BrokerEnable Fast Start Failover Data Guard Broker
Enable Fast Start Failover Data Guard Broker
 
Data Guard Broker Failover
Data Guard Broker FailoverData Guard Broker Failover
Data Guard Broker Failover
 
Oracle Data Guard Physical Standby Configuration
Oracle Data Guard Physical Standby ConfigurationOracle Data Guard Physical Standby Configuration
Oracle Data Guard Physical Standby Configuration
 
Schedule RMAN Backups On Windows
Schedule RMAN Backups On WindowsSchedule RMAN Backups On Windows
Schedule RMAN Backups On Windows
 
RMAN Backup Compression Types
RMAN Backup Compression TypesRMAN Backup Compression Types
RMAN Backup Compression Types
 
Scheduling Jobs With DBMA_Scheduler
Scheduling Jobs With DBMA_SchedulerScheduling Jobs With DBMA_Scheduler
Scheduling Jobs With DBMA_Scheduler
 
Oracle User Management
Oracle User ManagementOracle User Management
Oracle User Management
 
Create Directory Under ASM Diskgroup
Create Directory Under ASM DiskgroupCreate Directory Under ASM Diskgroup
Create Directory Under ASM Diskgroup
 
Create Diskgroup Sqlplus Command
Create Diskgroup Sqlplus CommandCreate Diskgroup Sqlplus Command
Create Diskgroup Sqlplus Command
 

Recently uploaded

Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
pavan998932
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
lorraineandreiamcidl
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 

Recently uploaded (20)

Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 

Oracle database hot backup and recovery

  • 2. Hot Backup Overview Taking the backup while the database is up and running is called hot backup During hot backup database will be in fuzzy state and still users can perform transactions which makes backup inconsistent Whenever we place a tablespace or database in begin backup mode, following happens The corresponding datafiles header will be freezed i.e CKPT process will not update latest SCN
  • 3. Body of the datafile is still active i.e DBWRn will write the dirty blocks to datafiles After end backup, datafile header will be unfreezed and CKPT process will update latest SCN immediately by taking that information from controlfiles During hot backup, we will observe much redo generated because oracle will copy entire data block as redo entry into LBC. This is to avoid fractured block
  • 4. A block fracture occurs when a block is being read by the backup, and being written to at the same time by DBWR. Because the OS (usually) reads blocks at a different rate than Oracle, your OS copy will pull pieces of an Oracle block at a time. What if the OS copy pulls half a block, and while that is happening, the block is changed by DBWR? When the OS copy pulls the second half of the block it will result in mismatched halves, which Oracle would not know how to reconcile This is also why the SCN of the datafile header does not change when a tablespace enters hot backup mode. The current SCNs are recorded in redo, but not in the datafile. This is to ensure that Oracle will always recover over the datafile contents with redo entries. When recovery occurs, the fractured datafile block will be replaced with a complete block from redo, making it whole again Note: Database should be in archivelog mode to perform hot backup
  • 5. Taking hot backup Put the database in begin backup mode Copy all database related files to backup location. Create a location on OS where you can copy backup files. Eg /u02/db_backup/hot_bkp_12_jan/
  • 6. Get the location of datafiles, controlfiles, redolog files Copy above files using Linx cp command to backup location
  • 7. Put DB in end backup mode Take manual controlfile backup
  • 8. Backup the archive logs generated during the begin backup and end backup mode. Copy above archive log files to the backup location using the Linux cp command.
  • 9. Sometimes you want to check which tablespaces inside the database are specifically kept in BACKUP mode. Use below query to get all the tablespaces which are ACTIVE mode (means they are under BEGIN BACKUP mode). Important queries
  • 10. The following sample output shows that the example and users tablespaces currently have ACTIVE status:
  • 11. Parameter file recovery There are three scenarios when you loose parameter file and how to recover using hot backups.
  • 12. Scenario 1: When you have parameter file backup Let us simulate a failure. We assume that we already have taken the hot backup. DB is up and running Delete both pfile and spfile under $ORACLE_HOME/dbs location Connect to sqlplus and shutdown the database Now start the database and it should throw below error
  • 13. Recovering the parameter file: Exit the sqlplus Go to hot backup location Copy parameter files (pfile & spfile) to $ORACLE_HOME/dbs location Connect to sqlplus and start your database!
  • 14. Scenario 2: When you do not have parameter file backup Let us assume we do not have hot backup of the parameter files, then follow below method to recovery your parameter file: Goto alert log location (Generally /u01/app/oracle/diag/rdbms/testdb/testdb/trace) Cat the alert log file (cat alert_testdb.log) Find last time database was started Copy all the non-default parameters into notepad
  • 15. Create a pfile under $ORACLE_HOME/dbs location The file name should be init<sid>.ora Paste all contents from notepad Start the database!
  • 16. From 11g onwards, you can recreate parameter file in case the database is up and running. Even if you loose parameter file but database instance is still running, we can recreate parameter file from memory: Scenario 3: When you do not have parameter file backup in 11g
  • 17. Control file recovery Simulate failure (we assume that hot backup is already taken). Without shutting down the database, delete database control file at OS level
  • 18. Scenario 1: steps for control file incomplete recovery Scenario 2: steps for control file complete recovery
  • 19. Goto udump location and copy the first create controlfile script to a file called control.sql Note: After creating control files using above procedure, there will be no SCN in that. So server process will write the latest SCN to control files in this situation by taking info from datafile header.
  • 20. Redolog recovery Let’s try to recovery our database with loss of redolog files. Simulate a failure and let us delete redologs at OS level
  • 21. Recover redo log file in archive log mode What resetlogs will do? Create new redolog files at OS level (location and size will be taken from controlfile) if not already existing
  • 22. Whenever database is opened with resetlogs option, we will say database entered into new incarnation. If database is in new incarnation, the backups which were taken till now are no more useful. So, whenever we perform an incomplete recovery we need to take full backup of database immediately We can find the prev incarnation information of a database from below query Resets the log seq number (LSN) to 1, 2, 3 etc for the created files
  • 23. Tablespace recovery Delete all the data files related to particular tablespace and follow below recovery steps
  • 24. Datafile recovery Delete only one data file related to a tablespace and follow below steps to recover the data file
  • 25. System tablespace recovery Delete all the data files related to system tablespace and use below steps to recover the system tablespace
  • 26. Entire database recovery Let us simulate a failure (make sure you have already taken the database backup). Delete all the data files, control files and redo log files associated to the database.
  • 27. Follow below steps to perform entire database recovery Note: we can drop a single datafile using below command When we use above command, it will delete the file at OS level, but data dictionary will not be updated and never we can get back that file even if we have backup. So, don’t use this in real time.
  • 28. Datafile recovery without backup In case you do not have hot backup of the database or a particular data file still you can recover entire data file but you need to have all the archive logs from the day data file was first created.
  • 29. To simulate this type of failure, do following: Create a tablespace Create user to store one table inside new tablespace Delete data file at OS level
  • 30. Now use below queries to recover the data file (note we do not have any hot backup)
  • 31. Courses | Projects | Bootcamps