SlideShare a Scribd company logo
1 of 55
Download to read offline
RMAN – The Pocket Knife of a DBA
■  Presenter: Anton Els
Session Details:
@aelsnz
Introduction
■  Vice President Product Development
■  NZOUG Committee (VP)
■  Working with Oracle database since version 7
■  Interests Include:
▪  Linux, Docker, Oracle Databases, Oracle Backup and Recovery
■  Qualifications:
▪  Oracle Database 11g Certified Master
▪  Oracle 8i, 9i, 10g and 11g OCP
▪  Solaris 10 SCSA and Red Hat 5 RHCSA
▪  B.Sc. Mathematical Sciences and B.Sc. Hons Informatics
■  Presented at Collaborate, NZOUG and db tech showcase
2
Anton	
  Els	
  -­‐  @aelsnz
Where do I come from….
3
Who do I work for – Dbvisit Software Limited
■  Software Development Company
■  HQ in New Zealand
▪  US subsidiary and office in Czech Republic
■  Database Replication is our playground!
■  Worldwide leader in DR solutions for Oracle Standard Edition
■  Used in 110+ countries!
■  Product Engineers with “real world” DBA Experience
■  Regular presenters at OOW, Collaborate and NZOUG
■  Passionate about Oracle Technology
4
Agenda
■  What is RMAN, and some history
■  The RMAN environment
■  Recovery Catalog vs. Controlfile
■  Backupset vs. Image Copy
■  Backup, Restore and Recover commands
■  Incremental Backups
■  Advanced options
■  12c… how great are those new features!
■  Recovery Advisor
■  Reporting monitoring tips
What is RMAN?
■  Oracle Recovery Manager – RMAN
■  I see it as a “safety net” for DBAs
■  Helps you to be prepared for disasters
▪  Natural
▪  Human
▪  Hardware
■  Even if you have a standby database you still need backups!
▪  What-if:
—  Both primary / standby is lost
—  Logical corruption replicates through to your standby
RMAN helps you protect what is important
■  Database Files
■  Archive Logs
■  Control Files
■  Server Parameter Files
Do  not  forget  about  Oracle  So9ware  and  Opera=ng  System!
A bit of RMAN History
■  “Traditional backup and recovery”
▪  using BEGIN / END backup commands
alter tablespace … begin backup;
-> copy files somewhere
alter tablespace … end backup;
■  RMAN introduced in Oracle 8-8.1.7
▪  Support open / mounted database backups
▪  Incremental backup support (only modified blocks)
▪  Corrupt block detection
▪  Recovery catalog
▪  Support disk and tape backups
A bit of RMAN History
■  Improved in 9i
▪  Block media recovery
▪  Backup of spfile
▪  Improved controlfile auto backup
▪  FORCE option in the delete command
▪  Introduction of the DBNEWID
A bit of RMAN History
■  Key improvements in Oracle 10g
▪  Improved reporting
▪  Backup Compression (backup sets) (10.1)
▪  Backup Encryption (10.2)
▪  Unused Block Compression (10.2)
▪  Using incremental backup to roll a
standby database forward (10.2)
A bit of RMAN History
■  Key Improvements in 11g
▪  Fast Incremental Backups (block change tracking)
▪  Data Recovery Advisor
▪  Network-Aware Duplication
▪  Automatic Block Repair (11.2)
▪  Duplicate without target database connection (11.2)
A bit of RMAN History
■  Key Improvements in 12c
▪  SQL Commands in RMAN !!!
▪  Table Recovery (Auxiliary instance used)
▪  Improved Active Duplication (backup sets)
▪  Network-Enabled Restore (restore datafile from standby or primary)
▪  Improved multisection backup options (Incremental Backups and
Image Copies)
▪  Fast Standby database synchronization (Using Services)
▪  Multi-tenancy support
▪  Cross-Platform Backup/Restore
A bit of RMAN History
■  Key Improvements in 12c
▪  SQL Commands in RMAN !!!
▪  Table Recovery (Auxiliary instance used)
▪  Improved Active Duplication (backup sets)
▪  Network-Enabled Restore (restore datafile from standby or primary)
▪  Improved multisection backup options (Incremental Backups and
Image Copies)
▪  Fast Standby database synchronization (Using Services)
▪  Multi-tenancy support
▪  Cross-Platform Backup/Restore
Archivelog vs. No-Archivelog Mode
■  No-Archivelog Mode:
▪  Only Cold backups
—  Database is shutdown when performing backup – downtime!!
▪  Other … kind of backup methods include:
—  export/import
—  datapump
Archivelog vs. No-Archivelog Mode
■  Archivelog Mode
▪  Online Redo logs are archived
following a log switch
▪  Required for Online Backups
—  No Downtime
▪  Note: Does require extra disk space!
▪  Make sure you have sufficient redo log groups
SQL> connect / as sysdba
SQL> archive log list;
SQL> select log_mode from v$database;
SQL> show parameter recovery
SQL> shutdown immediate;
SQL> startup mount
SQL> alter database archivelog;
SQL> shutdown immediate;
SQL> startup
SQL> archive log list
SQL> select log_mode from v$database;
Start from a good base
The RMAN Environment
■  The “rman” command: rman nocatalog target /
Argument Value Description
-----------------------------------------------------------------------------
target quoted-string connect-string for target database
catalog quoted-string connect-string for recovery catalog
auxiliary quoted-string connect-string for auxiliary database
nocatalog none if specified, then no recovery catalog
cmdfile quoted-string name of input command file
log quoted-string name of output message log file
trace quoted-string name of output debugging message log file
append none if specified, log is opened in append mode
debug optional-args activate debugging
msgno none show RMAN-nnnn prefix for all messages
send quoted-string send a command to the media manager
pipe string building block for pipe names
script string name of catalog script to execute
using list of args arguments for rman variables
timeout integer number of seconds to wait for pipe input
checksyntax none check the command file for syntax errors
-----------------------------------------------------------------------------
Both single and double quotes (' or ") are accepted for a quoted-string.
Quotes are not required unless the string contains embedded white-space.
TIP	
  –	
  on	
  Unix	
  use	
  “oraenv”	
  

oracle@dbvlin103[/home/oracle]:  .	
  	
  oraenv	
  
ORACLE_SID  =  [oracle]  ?      proddb	
  
The  Oracle  base  remains  unchanged  with  value  /u01/app/oracle

oracle@dbvlin103[/home/oracle]:  env	
  |	
  grep	
  ORA	
  
ORACLE_SID=proddb
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1
The RMAN Environment
■  What  is  “kind  of”  wrong  with  example  below?
RMAN> backup datafile 1;
Starting backup at 03-OCT-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=261 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA/PRODDB/DATAFILE/system.260.858601171
channel ORA_DISK_1: starting piece 1 at 03-OCT-14
channel ORA_DISK_1: finished piece 1 at 03-OCT-14
…
…
Finished backup at 03-OCT-14
Why make things difficult?
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
21 Full 683.20M DISK 00:00:06 03-OCT-14
BP Key: 21 Status: AVAILABLE Compressed: NO Tag: TAG20141003T174234
Piece Name: /u02/backups/rman/proddb/15pk56ka_1_1
List of Datafiles in backup set 21
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 2785085 03-OCT-14 +DATA/PRODDB/DATAFILE/system.260.858601171
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
25 Full 683.20M DISK 00:00:14 03-OCT-14
BP Key: 25 Status: AVAILABLE Compressed: NO Tag: TAG20141003T174952
Piece Name: /u02/backups/rman/proddb/19pk5721_1_1
List of Datafiles in backup set 25
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 2785924 03-OCT-14 +DATA/PRODDB/DATAFILE/system.260.858601171
Make it easier! – set NLS_DATE_FORMAT
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
21 Full 683.20M DISK 00:00:06 03/10/2014:17:42:40
BP Key: 21 Status: AVAILABLE Compressed: NO Tag: TAG20141003T174234
Piece Name: /u02/backups/rman/proddb/15pk56ka_1_1
List of Datafiles in backup set 21
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------- ----
1 Full 2785085 03/10/2014:17:42:34 +DATA/PRODDB/DATAFILE/system.260.858601171
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
25 Full 683.20M DISK 00:00:14 03/10/2014:17:50:07
BP Key: 25 Status: AVAILABLE Compressed: NO Tag: TAG20141003T174952
Piece Name: /u02/backups/rman/proddb/19pk5721_1_1
List of Datafiles in backup set 25
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------- ----
1 Full 2785924 03/10/2014:17:49:53 +DATA/PRODDB/DATAFILE/system.260.858601171
NLS_DATE_FORMAT="dd/mm/yyyy:hh24:mi:ss"
The Default Configuration
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name PRODDB are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u02/backups/rman/proddb/cfc_%F';
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u02/backups/rman/proddb/%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/12.1.0/db_1/dbs/snapcf_proddb.f'; # default
The Default Configuration
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name PRODDB are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u02/backups/rman/proddb/cfc_%F';
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u02/backups/rman/proddb/%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/12.1.0/db_1/dbs/snapcf_proddb.f'; # default
Recovery Catalog vs. Controlfile
■  Which one is the correct one to use….
■  Advantages or reasons to consider a Recovery Catalog:
▪  More backup history can be stored
▪  Multiple databases
▪  When using Standby Databases
▪  When looking at using centralized stored scripts
▪  Monitoring
▪  Reporting
■  Using the Controlfile, keep in mind:
▪  CONTROLFILE_RECORD_KEEP_TIME
Backup Sets and Image Copies
■  Backup Set
▪  Default option
▪  Logical container
▪  Can contain one or more files
▪  Proprietary RMAN format
▪  Can be compressed
▪  Physical files on disk – called backup pieces
■  Image  Copies
▪  Powerful… but not as widely used
▪  Bit-by-Bit copy of the original file (They are Exactly the same!)
▪  Can be updated with incremental backups
▪  Can easily be switched to, reducing recovery time!!
Example using Backup Set
RMAN> run
{
backup
as compressed backupset
filesperset 10
database
format '/u02/backups/rman/proddb/db-%U';
backup as compressed backupset filesperset 30 archivelog all
format '/u02/backups/rman/proddb/arc-%U';
backup current controlfile format '/u02/backups/rman/proddb/ctl-%d-%I';
}
Starting backup at 04/10/2014:21:46:45
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003 name=+DATA/PRODDB/DATAFILE/sysaux.294.858601125
input datafile file number=00001 name=+DATA/PRODDB/DATAFILE/system.260.858601171
input datafile file number=00006 name=+DATA/PRODDB/DATAFILE/users.259.858601227
input datafile file number=00005 name=+DATA/PRODDB/DATAFILE/data.263.859037565
input datafile file number=00004 name=+DATA/PRODDB/DATAFILE/undotbs1.258.858601227
channel ORA_DISK_1: starting piece 1 at 04/10/2014:21:46:46
channel ORA_DISK_1: finished piece 1 at 04/10/2014:21:48:21
piece handle=/u02/backups/rman/proddb/db-1spk89a6_1_1 tag=FULLDBBKP comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:35
Finished backup at 04/10/2014:21:48:21
…
…
1	
  
2	
  
Example using Backup Copy
RMAN> run
{ backup as copy database TAG 'FRA_DBCOPY'; }
Note:	
  This  example  run  on  3  Node  11.2.0.4    RAC  database  with  sufficient  space  in  FRA  to  keep  a  copy  of  the  database.
Starting backup at 04/10/2014:21:48:44
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 instance=DEV1 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+DATA/dev/datafile/sysaux.275.858702333
output file name=+FRA/dev/datafile/sysaux.2874.860104127 tag=FRA_DBCOPY RECID=1 STAMP=860104162
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45
…
RMAN> list copy of database;
List of Datafile Copies
=======================
Key File S Completion Time Ckp SCN Ckp Time
------- ---- - ------------------- ---------- -------------------
2 1 A 04/10/2014:21:50:05 48308543 04/10/2014:21:49:30
Name: +FRA/dev/datafile/system.2757.860104173
Tag: FRA_DBCOPY
1 2 A 04/10/2014:21:49:22 48308515 04/10/2014:21:48:45
Name: +FRA/dev/datafile/sysaux.2874.860104127
Tag: FRA_DBCOPY
1	
  
2	
  
3	
  
Restoring is easy… if you have good backups
Restore	
  one	
  datafile	
  
	
  
RMAN> alter database datafile 5
offline;
RMAN> restore datafile 5;
RMAN> recover datafile 5;
RMAN> alter database datafile 5 online;
Restore	
  and	
  recover	
  database
RMAN> startup nomount;
RMAN> set dbid 598649033
RMAN> restore controlfile
from '/u02/backups/rman/proddb/ctl-PRODDB-598649033';
RMAN> alter database mount;
RMAN> restore database;
RMAN> recover database;
RMAN> alter database open resetlogs;
But what about Image Copies?
Switch	
  to	
  datafile	
  copy	
  
	
  
RMAN> alter database datafile 5
offline;
RMAN> switch datafile 5 to copy;
RMAN> recover datafile 5;
RMAN> alter database datafile 5
online;
Switch	
  database	
  to	
  Image	
  Copies
RMAN> startup mount;
RMAN> list copy of database;
RMAN> switch database to copy;
RMAN> recover database;
If complete recovery:
RMAN> alter database open;
If incomplete recovery:
RMAN> alter database open resetlogs;
Move database from file system to ASM
30
DEMO	
  
Remember control files… (continue from Demo)
■  Start database in nomount
■  Restore “copy” the controlfile into ASM:
RMAN> restore controlfile to '+DATA' from '/u02/oracle/oradata1/DEV2/control01.ctl';
■  Update spfile
ASMCMD> find +DATA/DEV2/ *
…
+DATA/DEV2/CONTROLFILE/current.281.887984443
…
SQL> alter system set control_files='+DATA/DEV2/CONTROLFILE/current.281.887984443'
scope=spfile;
■  Enable OMF and recovery area in ASM
SQL> alter system set db_create_file_dest='+DATA' scope=spfile;
SQL> alter system set db_recovery_file_dest='+FRA’ scope=spfile;
RMAN Channels
■  The RMAN Client does not:
▪  Perform backups, restores or recovery operations!
■  Database Server sessions perform this work
▪  Linux – Server process
▪  Windows – Thread within database service
■  Two Supported Device Types:
▪  DISK
▪  SBT (Tape Based Backups)
RMAN Channels - 3 Key Phases
■  Read Phase
■  Copy Phase (processing phase)
■  Write Phase
•  Valida=on
•  Compression
•  Encryp=on
Incremental Backups
■  1st Step - Full Level 0 Backup
rman> backup … incremental level 0 database …
■  Two types of Incremental Backups:
▪  Cumulative
rman> backup … incremental level 1 cumulative
database …
▪  Differential (default)
rman> backup … incremental level 1
database …
Mon	
   Tue	
   Wed	
   Thu	
   Fri	
  
FULL
|-­‐-­‐-­‐-­‐-­‐>
|-­‐-­‐-­‐-­‐-­‐-­‐
 -­‐-­‐-­‐-­‐-­‐-­‐>
|-­‐-­‐-­‐-­‐-­‐-­‐
 -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐
 -­‐-­‐-­‐-­‐-­‐-­‐>
|-­‐-­‐-­‐-­‐-­‐-­‐
 -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐
 -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐
 -­‐-­‐-­‐-­‐-­‐-­‐>
Mon	
   Tue	
   Wed	
   Thu	
   Fri	
  
FULL
|-­‐-­‐-­‐-­‐-­‐>
-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐
 |-­‐-­‐-­‐-­‐-­‐>
-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐
 -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐
 |-­‐-­‐-­‐-­‐-­‐>
-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐
 -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐
 -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐
 |-­‐-­‐-­‐-­‐-­‐>
Two Advanced Options (of many)
■  Updating Image Copies using Incremental Backups
▪  Create Backup:
rman> backup as copy incremental level 0 database format 
'/u02/oracle/oradata2/DEV2/%N-%f.dbf' TAG=‘inc_bkp_copy';
rman> backup incremental level 1
for recover of copy with tag 'inc_bkp_copy’ database;
▪  Apply incremental backup to image copy:
rman> recover copy of database with tag ’ inc_bkp_copy';
Recover Image Copy using Incremental Backup
37
DEMO	
  
Two Advanced Options (of many)
■  Block Change Tracking (10g+ and EE only)
▪  Default location DB_CREATE_FILE_DEST (OMF File)
▪  Minimum 10M (grows in 10M chunks)
▪  Enable:
sql> alter database enable block change tracking;
sql> alter database enable block change tracking
using file ‘/u01/oradata/blck-tracking’;
▪  Disable:
sql> alter database disable block change tracking;
12c… how great are those new features!
■  Four New Features that stood out for me:
▪  SQL Commands in RMAN
▪  Table Recovery
▪  Network-Enabled Restore / Recovery
▪  Rolling forward / synchronizing a Standby Database - Using Services
12c – SQL Commands in RMAN
No more: rman> sql ‘alter system switch logfile’;
Now: rman> alter system switch logfile;
RMAN> create table test (id number);
Statement processed
RMAN> select * from test;
no rows selected
RMAN> begin
2> for c1 in 1..20 loop
3> insert into test values (c1);
4> end loop;
5> end;
6> /
Statement processed
RMAN> select count(1) from test;
COUNT(1)
----------
20
RMAN> rollback;
Statement processed
RMAN> drop table test purge;
Statement processed
12c – Table Recovery
Pre-requisites:
■  Backups must be available
■  Target database must be:
▪  open Read / Write and in archivelog mode
Things to take into account
■  An Auxiliary Instance
■  Tablespace containing table is restored
■  Datapump used for table export/import
■  Disable table import using: NOTABLEIMPORT keyword
■  Make sure you have sufficient storage – auxiliary instance
Restore Table using RMAN (12c)
43
DEMO	
  
44
12c – Network-Enabled Restore/Recovery
■  Restore a datafile from a Primary / Standby
■  Using Services
■  Configure and Test Networking:
▪  listener.ora
▪  tnsnames.ora
■  SECTIONSIZE, encryption, compressed backupsets can be used
■  Improved restore | recover datafile Commands
rman> restore datafile n from service <service>;
rman> recover datafile n from service <service>;
12c – Network-Enabled Restore/Recovery
RMAN> alter database datafile 5 offline;
Statement processed
RMAN> restore datafile 5 from service proddb_dr;
Starting restore at 07/10/2014:13:06:28
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: using network backup set from service proddb_dr
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00005 to +DATA/PRODDB/DATAFILE/data.304.860260051
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
Finished restore at 07/10/2014:13:06:32
RMAN> recover datafile 5;
Starting recover at 07/10/2014:13:06:39
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 07/10/2014:13:06:40
RMAN> alter database datafile 5 online;
Statement processed
12c – Rolling Forward / Sync a Standby Database
Quick and easy recovery from:
■  Unrecoverable archive log gaps
■  No-logging operations
When using this method
•  Standby = Target
•  Primary = Auxiliary
Behind the scenes:
■  Standby database “current SCN” is obtained
■  Primary database incremental backup from this SCN
■  Incremental backup copied across network and applied to standby
12c – Rolling Forward / Sync a Standby Database
Example: (executed from standby server)
rman> connect target /
rman> connect auxiliary sys/<syspassword>@<your_primary_db_service>
rman> recover database from service <your_primary_db_service>
using compressed backupset;
Important last step
▪  Recreate the standby controlfile
—  Required as standby controlfile SCN lower than datafile SCN
—  Update datafile and tempfile names if required
Tip - Don’t forget about Data Recovery Advisor
■  Introduced in Oracle 11g
■  Three key commands:
rman> LIST failure
rman> ADVISE failure
rman> REPAIR failure
■  Not available when using Multi-tenancy - CDB/PDB
▪  Expected in 12.2
Reporting and Monitoring
■  Using RMAN:
▪  LIST command
▪  REPORT command
■  Using Database Queries:
▪  Monitor current running jobs:
—  v$session
—  v$session_longops
▪  Monitoring history:
—  v$rman_backup_job_details
—  v$rman_output
Reporting and Monitoring
SELECT command_id
, status
, start_time
, end_time
, time_taken_display
, input_type
, output_device_type
, input_bytes_display
, output_bytes_display
, output_bytes_per_sec_display
from v$rman_backup_job_details
where start_time > (sysdate-5)
order by start_time;
Rman> list backup;
Rman> list copy;
Rman> list copy of database;
Rman> list copy of datafile n;
Rman> report schema;
Rman> report need backup;
Rman> report obsolete;
RMAN is easy!
Start with the basics before making things too complex:
■  set NLS_DATE_FORMAT
■  SHOW ALL
■  CONFIGURE
■  BACKUP DATABASE
■  RESTORE | RECOVER DATABASE
■  RESTORE | RECOVER DATAFILE
Don’t forget about the VALIDATE options!!
Recommended Reading
•  Oracle Online Documentation
•  Oracle Database 12c Backup and Recovery Survival Guide
•  RMAN Recipes for Oracle Database 11g, A Problem-Solution Approach
•  Dbvisit Blog – http://blog.dbvisit.com
■  Change Control is there for a reason!
■ 
■  Document  your  Backup  and  Recovery  procedures!!!
But most important!
Questions?
Presented By: Anton Els
Company: Dbvisit Software Limited
Email: anton.els@dbvisit.com
Twitter: @aelsnz
Blog: http://blog.dbvisit.com/author/anton-els/

More Related Content

What's hot

Oracle 12c and its pluggable databases
Oracle 12c and its pluggable databasesOracle 12c and its pluggable databases
Oracle 12c and its pluggable databasesGustavo Rene Antunez
 
10 Problems with your RMAN backup script
10 Problems with your RMAN backup script10 Problems with your RMAN backup script
10 Problems with your RMAN backup scriptYury Velikanov
 
What’s new in oracle 12c recovery manager (rman)
What’s new in oracle 12c recovery manager (rman)What’s new in oracle 12c recovery manager (rman)
What’s new in oracle 12c recovery manager (rman)Satishbabu Gunukula
 
Install oracle binaris or clonse oracle home
Install oracle binaris or clonse oracle homeInstall oracle binaris or clonse oracle home
Install oracle binaris or clonse oracle homeSatishbabu Gunukula
 
Oracle Basics and Architecture
Oracle Basics and ArchitectureOracle Basics and Architecture
Oracle Basics and ArchitectureSidney Chen
 
Oracle 12c PDB insights
Oracle 12c PDB insightsOracle 12c PDB insights
Oracle 12c PDB insightsKirill Loifman
 
Oracle Linux and Oracle Database - A Trusted Combination
Oracle Linux and Oracle Database - A Trusted Combination Oracle Linux and Oracle Database - A Trusted Combination
Oracle Linux and Oracle Database - A Trusted Combination Guatemala User Group
 
Ensuring Data Protection Using Oracle Flashback Features - Presentation
Ensuring Data Protection Using Oracle Flashback Features - PresentationEnsuring Data Protection Using Oracle Flashback Features - Presentation
Ensuring Data Protection Using Oracle Flashback Features - PresentationPini Dibask
 
Oracle data guard configuration in 12c
Oracle data guard configuration in 12cOracle data guard configuration in 12c
Oracle data guard configuration in 12cuzzal basak
 
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...Markus Michalewicz
 
Understand oracle real application cluster
Understand oracle real application clusterUnderstand oracle real application cluster
Understand oracle real application clusterSatishbabu Gunukula
 
Oracle database 12c new features
Oracle database 12c new featuresOracle database 12c new features
Oracle database 12c new featuresRemote DBA Services
 
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 - whitepaperYury Velikanov
 
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
 
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 hostOsama Mustafa
 
Crating a Robust Performance Strategy
Crating a Robust Performance StrategyCrating a Robust Performance Strategy
Crating a Robust Performance StrategyGuatemala User Group
 
Oracle Database 12.1.0.2: New Features
Oracle Database 12.1.0.2: New FeaturesOracle Database 12.1.0.2: New Features
Oracle Database 12.1.0.2: New FeaturesDeiby Gómez
 

What's hot (20)

Oracle 12c and its pluggable databases
Oracle 12c and its pluggable databasesOracle 12c and its pluggable databases
Oracle 12c and its pluggable databases
 
10 Problems with your RMAN backup script
10 Problems with your RMAN backup script10 Problems with your RMAN backup script
10 Problems with your RMAN backup script
 
What’s new in oracle 12c recovery manager (rman)
What’s new in oracle 12c recovery manager (rman)What’s new in oracle 12c recovery manager (rman)
What’s new in oracle 12c recovery manager (rman)
 
Rac questions
Rac questionsRac questions
Rac questions
 
Install oracle binaris or clonse oracle home
Install oracle binaris or clonse oracle homeInstall oracle binaris or clonse oracle home
Install oracle binaris or clonse oracle home
 
Oracle Basics and Architecture
Oracle Basics and ArchitectureOracle Basics and Architecture
Oracle Basics and Architecture
 
Convert single instance to RAC
Convert single instance to RACConvert single instance to RAC
Convert single instance to RAC
 
Oracle 12c PDB insights
Oracle 12c PDB insightsOracle 12c PDB insights
Oracle 12c PDB insights
 
Oracle Linux and Oracle Database - A Trusted Combination
Oracle Linux and Oracle Database - A Trusted Combination Oracle Linux and Oracle Database - A Trusted Combination
Oracle Linux and Oracle Database - A Trusted Combination
 
Ensuring Data Protection Using Oracle Flashback Features - Presentation
Ensuring Data Protection Using Oracle Flashback Features - PresentationEnsuring Data Protection Using Oracle Flashback Features - Presentation
Ensuring Data Protection Using Oracle Flashback Features - Presentation
 
Oracle data guard configuration in 12c
Oracle data guard configuration in 12cOracle data guard configuration in 12c
Oracle data guard configuration in 12c
 
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
 
Understand oracle real application cluster
Understand oracle real application clusterUnderstand oracle real application cluster
Understand oracle real application cluster
 
Oracle 10g Introduction 1
Oracle 10g Introduction 1Oracle 10g Introduction 1
Oracle 10g Introduction 1
 
Oracle database 12c new features
Oracle database 12c new featuresOracle database 12c new features
Oracle database 12c new features
 
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 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
 
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
 
Crating a Robust Performance Strategy
Crating a Robust Performance StrategyCrating a Robust Performance Strategy
Crating a Robust Performance Strategy
 
Oracle Database 12.1.0.2: New Features
Oracle Database 12.1.0.2: New FeaturesOracle Database 12.1.0.2: New Features
Oracle Database 12.1.0.2: New Features
 

Similar to RMAN – The Pocket Knife of a DBA

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
 
Adventures in Dataguard
Adventures in DataguardAdventures in Dataguard
Adventures in DataguardJason Arneil
 
Oracle Enterprise Manager 12c - OEM12c Presentation
Oracle Enterprise Manager 12c - OEM12c PresentationOracle Enterprise Manager 12c - OEM12c Presentation
Oracle Enterprise Manager 12c - OEM12c PresentationFrancisco Alvarez
 
OGG Architecture Performance
OGG Architecture PerformanceOGG Architecture Performance
OGG Architecture PerformanceEnkitec
 
br_test_lossof-datafile_10g.doc
br_test_lossof-datafile_10g.docbr_test_lossof-datafile_10g.doc
br_test_lossof-datafile_10g.docLucky Ally
 
Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)
Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)
Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)Bobby Curtis
 
FIXING BLOCK CORRUPTION (RMAN) on 11G
FIXING BLOCK CORRUPTION (RMAN) on 11GFIXING BLOCK CORRUPTION (RMAN) on 11G
FIXING BLOCK CORRUPTION (RMAN) on 11GN/A
 
Oow14 con7681-rman-1
Oow14 con7681-rman-1Oow14 con7681-rman-1
Oow14 con7681-rman-1Dan Glasscock
 
Rman 12c new_features
Rman 12c new_featuresRman 12c new_features
Rman 12c new_featuresNabi Abdul
 
Running E-Business Suite Database on Oracle Database Appliance
Running E-Business Suite Database on Oracle Database ApplianceRunning E-Business Suite Database on Oracle Database Appliance
Running E-Business Suite Database on Oracle Database ApplianceMaris Elsins
 
Using oracle12c pluggable databases to archive
Using oracle12c pluggable databases to archiveUsing oracle12c pluggable databases to archive
Using oracle12c pluggable databases to archiveSecure-24
 
Extreme replication at IOUG Collaborate 15
Extreme replication at IOUG Collaborate 15Extreme replication at IOUG Collaborate 15
Extreme replication at IOUG Collaborate 15Bobby Curtis
 
Oracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture PerformanceOracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture PerformanceEnkitec
 
EM12C High Availability without SLB and RAC
EM12C High Availability without SLB and RACEM12C High Availability without SLB and RAC
EM12C High Availability without SLB and RACSecure-24
 

Similar to RMAN – The Pocket Knife of a DBA (20)

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)
 
Adventures in Dataguard
Adventures in DataguardAdventures in Dataguard
Adventures in Dataguard
 
oracle dba
oracle dbaoracle dba
oracle dba
 
Oracle Enterprise Manager 12c - OEM12c Presentation
Oracle Enterprise Manager 12c - OEM12c PresentationOracle Enterprise Manager 12c - OEM12c Presentation
Oracle Enterprise Manager 12c - OEM12c Presentation
 
OGG Architecture Performance
OGG Architecture PerformanceOGG Architecture Performance
OGG Architecture Performance
 
br_test_lossof-datafile_10g.doc
br_test_lossof-datafile_10g.docbr_test_lossof-datafile_10g.doc
br_test_lossof-datafile_10g.doc
 
Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)
Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)
Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)
 
FIXING BLOCK CORRUPTION (RMAN) on 11G
FIXING BLOCK CORRUPTION (RMAN) on 11GFIXING BLOCK CORRUPTION (RMAN) on 11G
FIXING BLOCK CORRUPTION (RMAN) on 11G
 
Les 02 config
Les 02 configLes 02 config
Les 02 config
 
Oow14 con7681-rman-1
Oow14 con7681-rman-1Oow14 con7681-rman-1
Oow14 con7681-rman-1
 
Rman 12c new_features
Rman 12c new_featuresRman 12c new_features
Rman 12c new_features
 
Running E-Business Suite Database on Oracle Database Appliance
Running E-Business Suite Database on Oracle Database ApplianceRunning E-Business Suite Database on Oracle Database Appliance
Running E-Business Suite Database on Oracle Database Appliance
 
Using oracle12c pluggable databases to archive
Using oracle12c pluggable databases to archiveUsing oracle12c pluggable databases to archive
Using oracle12c pluggable databases to archive
 
Extreme replication at IOUG Collaborate 15
Extreme replication at IOUG Collaborate 15Extreme replication at IOUG Collaborate 15
Extreme replication at IOUG Collaborate 15
 
Less04 Instance
Less04 InstanceLess04 Instance
Less04 Instance
 
Flashback in OCI
Flashback in OCIFlashback in OCI
Flashback in OCI
 
8i standby
8i standby8i standby
8i standby
 
Oracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture PerformanceOracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture Performance
 
EM12C High Availability without SLB and RAC
EM12C High Availability without SLB and RACEM12C High Availability without SLB and RAC
EM12C High Availability without SLB and RAC
 
Cloning 2
Cloning 2Cloning 2
Cloning 2
 

More from Guatemala User Group

La transformacion digital en nuestra vida cotidiana. Un vistazo a las APIs
La transformacion digital en nuestra vida cotidiana. Un vistazo a las APIsLa transformacion digital en nuestra vida cotidiana. Un vistazo a las APIs
La transformacion digital en nuestra vida cotidiana. Un vistazo a las APIsGuatemala User Group
 
Cloud Integration for Human Resources: Connect with Your talent in the Cloud
Cloud Integration for Human Resources: Connect with Your talent in the CloudCloud Integration for Human Resources: Connect with Your talent in the Cloud
Cloud Integration for Human Resources: Connect with Your talent in the CloudGuatemala User Group
 
Improving the Performance of PL/SQL function calls from SQL
Improving the Performance of PL/SQL function calls from SQLImproving the Performance of PL/SQL function calls from SQL
Improving the Performance of PL/SQL function calls from SQLGuatemala User Group
 
Gestión de infraestructura tomcat/Tom EE con tfactory
Gestión de infraestructura tomcat/Tom EE con tfactoryGestión de infraestructura tomcat/Tom EE con tfactory
Gestión de infraestructura tomcat/Tom EE con tfactoryGuatemala User Group
 
Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Guatemala User Group
 
Introduction to Oracle Clusterware 12c
Introduction to Oracle Clusterware 12cIntroduction to Oracle Clusterware 12c
Introduction to Oracle Clusterware 12cGuatemala User Group
 
Upgrade/Migrate to Oracle 12c: Live and Uncensored!
Upgrade/Migrate to Oracle 12c: Live and Uncensored!Upgrade/Migrate to Oracle 12c: Live and Uncensored!
Upgrade/Migrate to Oracle 12c: Live and Uncensored!Guatemala User Group
 
How to Upgrade Hundreds or Thousands of Databases
How to Upgrade Hundreds or Thousands of DatabasesHow to Upgrade Hundreds or Thousands of Databases
How to Upgrade Hundreds or Thousands of DatabasesGuatemala User Group
 
Deep Dive: More Oracle Data Pump Performance Tips and Tricks
Deep Dive: More Oracle Data Pump Performance Tips and TricksDeep Dive: More Oracle Data Pump Performance Tips and Tricks
Deep Dive: More Oracle Data Pump Performance Tips and TricksGuatemala User Group
 
How Oracle Single/Multitenant will change a DBA's life
How Oracle Single/Multitenant will change a DBA's lifeHow Oracle Single/Multitenant will change a DBA's life
How Oracle Single/Multitenant will change a DBA's lifeGuatemala User Group
 
SOA y Microservices Diferencias y Aplicaciones
SOA y Microservices Diferencias y AplicacionesSOA y Microservices Diferencias y Aplicaciones
SOA y Microservices Diferencias y AplicacionesGuatemala User Group
 
It's raining data! Oracle databases in the cloud
It's raining data! Oracle databases in the cloudIt's raining data! Oracle databases in the cloud
It's raining data! Oracle databases in the cloudGuatemala User Group
 
The best Oracle Database 12c Tuning Features for Developers
The best Oracle Database 12c Tuning Features for DevelopersThe best Oracle Database 12c Tuning Features for Developers
The best Oracle Database 12c Tuning Features for DevelopersGuatemala User Group
 

More from Guatemala User Group (20)

La transformacion digital en nuestra vida cotidiana. Un vistazo a las APIs
La transformacion digital en nuestra vida cotidiana. Un vistazo a las APIsLa transformacion digital en nuestra vida cotidiana. Un vistazo a las APIs
La transformacion digital en nuestra vida cotidiana. Un vistazo a las APIs
 
Cloud Integration for Human Resources: Connect with Your talent in the Cloud
Cloud Integration for Human Resources: Connect with Your talent in the CloudCloud Integration for Human Resources: Connect with Your talent in the Cloud
Cloud Integration for Human Resources: Connect with Your talent in the Cloud
 
Oracle 12c New Features
Oracle 12c New FeaturesOracle 12c New Features
Oracle 12c New Features
 
Best Features of Multitenant 12c
Best Features of Multitenant 12cBest Features of Multitenant 12c
Best Features of Multitenant 12c
 
Why to Upgrade to Oracle 12c
Why to Upgrade to Oracle 12cWhy to Upgrade to Oracle 12c
Why to Upgrade to Oracle 12c
 
ADF 12c como Backend
ADF 12c como BackendADF 12c como Backend
ADF 12c como Backend
 
Improving the Performance of PL/SQL function calls from SQL
Improving the Performance of PL/SQL function calls from SQLImproving the Performance of PL/SQL function calls from SQL
Improving the Performance of PL/SQL function calls from SQL
 
Integracion Continua en Oracle ADF
Integracion Continua en Oracle ADFIntegracion Continua en Oracle ADF
Integracion Continua en Oracle ADF
 
Gestión de infraestructura tomcat/Tom EE con tfactory
Gestión de infraestructura tomcat/Tom EE con tfactoryGestión de infraestructura tomcat/Tom EE con tfactory
Gestión de infraestructura tomcat/Tom EE con tfactory
 
Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!
 
Introduction to Oracle Clusterware 12c
Introduction to Oracle Clusterware 12cIntroduction to Oracle Clusterware 12c
Introduction to Oracle Clusterware 12c
 
What's next after Upgrade to 12c
What's next after Upgrade to 12cWhat's next after Upgrade to 12c
What's next after Upgrade to 12c
 
Upgrade/Migrate to Oracle 12c: Live and Uncensored!
Upgrade/Migrate to Oracle 12c: Live and Uncensored!Upgrade/Migrate to Oracle 12c: Live and Uncensored!
Upgrade/Migrate to Oracle 12c: Live and Uncensored!
 
How to Upgrade Hundreds or Thousands of Databases
How to Upgrade Hundreds or Thousands of DatabasesHow to Upgrade Hundreds or Thousands of Databases
How to Upgrade Hundreds or Thousands of Databases
 
Deep Dive: More Oracle Data Pump Performance Tips and Tricks
Deep Dive: More Oracle Data Pump Performance Tips and TricksDeep Dive: More Oracle Data Pump Performance Tips and Tricks
Deep Dive: More Oracle Data Pump Performance Tips and Tricks
 
How Oracle Single/Multitenant will change a DBA's life
How Oracle Single/Multitenant will change a DBA's lifeHow Oracle Single/Multitenant will change a DBA's life
How Oracle Single/Multitenant will change a DBA's life
 
Integration Cloud Service vs SOA
Integration Cloud Service vs SOAIntegration Cloud Service vs SOA
Integration Cloud Service vs SOA
 
SOA y Microservices Diferencias y Aplicaciones
SOA y Microservices Diferencias y AplicacionesSOA y Microservices Diferencias y Aplicaciones
SOA y Microservices Diferencias y Aplicaciones
 
It's raining data! Oracle databases in the cloud
It's raining data! Oracle databases in the cloudIt's raining data! Oracle databases in the cloud
It's raining data! Oracle databases in the cloud
 
The best Oracle Database 12c Tuning Features for Developers
The best Oracle Database 12c Tuning Features for DevelopersThe best Oracle Database 12c Tuning Features for Developers
The best Oracle Database 12c Tuning Features for Developers
 

Recently uploaded

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 

Recently uploaded (20)

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

RMAN – The Pocket Knife of a DBA

  • 1. RMAN – The Pocket Knife of a DBA ■  Presenter: Anton Els Session Details: @aelsnz
  • 2. Introduction ■  Vice President Product Development ■  NZOUG Committee (VP) ■  Working with Oracle database since version 7 ■  Interests Include: ▪  Linux, Docker, Oracle Databases, Oracle Backup and Recovery ■  Qualifications: ▪  Oracle Database 11g Certified Master ▪  Oracle 8i, 9i, 10g and 11g OCP ▪  Solaris 10 SCSA and Red Hat 5 RHCSA ▪  B.Sc. Mathematical Sciences and B.Sc. Hons Informatics ■  Presented at Collaborate, NZOUG and db tech showcase 2 Anton  Els  -­‐  @aelsnz
  • 3. Where do I come from…. 3
  • 4. Who do I work for – Dbvisit Software Limited ■  Software Development Company ■  HQ in New Zealand ▪  US subsidiary and office in Czech Republic ■  Database Replication is our playground! ■  Worldwide leader in DR solutions for Oracle Standard Edition ■  Used in 110+ countries! ■  Product Engineers with “real world” DBA Experience ■  Regular presenters at OOW, Collaborate and NZOUG ■  Passionate about Oracle Technology 4
  • 5. Agenda ■  What is RMAN, and some history ■  The RMAN environment ■  Recovery Catalog vs. Controlfile ■  Backupset vs. Image Copy ■  Backup, Restore and Recover commands ■  Incremental Backups ■  Advanced options ■  12c… how great are those new features! ■  Recovery Advisor ■  Reporting monitoring tips
  • 6. What is RMAN? ■  Oracle Recovery Manager – RMAN ■  I see it as a “safety net” for DBAs ■  Helps you to be prepared for disasters ▪  Natural ▪  Human ▪  Hardware ■  Even if you have a standby database you still need backups! ▪  What-if: —  Both primary / standby is lost —  Logical corruption replicates through to your standby
  • 7. RMAN helps you protect what is important ■  Database Files ■  Archive Logs ■  Control Files ■  Server Parameter Files Do  not  forget  about  Oracle  So9ware  and  Opera=ng  System!
  • 8. A bit of RMAN History ■  “Traditional backup and recovery” ▪  using BEGIN / END backup commands alter tablespace … begin backup; -> copy files somewhere alter tablespace … end backup; ■  RMAN introduced in Oracle 8-8.1.7 ▪  Support open / mounted database backups ▪  Incremental backup support (only modified blocks) ▪  Corrupt block detection ▪  Recovery catalog ▪  Support disk and tape backups
  • 9. A bit of RMAN History ■  Improved in 9i ▪  Block media recovery ▪  Backup of spfile ▪  Improved controlfile auto backup ▪  FORCE option in the delete command ▪  Introduction of the DBNEWID
  • 10. A bit of RMAN History ■  Key improvements in Oracle 10g ▪  Improved reporting ▪  Backup Compression (backup sets) (10.1) ▪  Backup Encryption (10.2) ▪  Unused Block Compression (10.2) ▪  Using incremental backup to roll a standby database forward (10.2)
  • 11. A bit of RMAN History ■  Key Improvements in 11g ▪  Fast Incremental Backups (block change tracking) ▪  Data Recovery Advisor ▪  Network-Aware Duplication ▪  Automatic Block Repair (11.2) ▪  Duplicate without target database connection (11.2)
  • 12. A bit of RMAN History ■  Key Improvements in 12c ▪  SQL Commands in RMAN !!! ▪  Table Recovery (Auxiliary instance used) ▪  Improved Active Duplication (backup sets) ▪  Network-Enabled Restore (restore datafile from standby or primary) ▪  Improved multisection backup options (Incremental Backups and Image Copies) ▪  Fast Standby database synchronization (Using Services) ▪  Multi-tenancy support ▪  Cross-Platform Backup/Restore
  • 13. A bit of RMAN History ■  Key Improvements in 12c ▪  SQL Commands in RMAN !!! ▪  Table Recovery (Auxiliary instance used) ▪  Improved Active Duplication (backup sets) ▪  Network-Enabled Restore (restore datafile from standby or primary) ▪  Improved multisection backup options (Incremental Backups and Image Copies) ▪  Fast Standby database synchronization (Using Services) ▪  Multi-tenancy support ▪  Cross-Platform Backup/Restore
  • 14. Archivelog vs. No-Archivelog Mode ■  No-Archivelog Mode: ▪  Only Cold backups —  Database is shutdown when performing backup – downtime!! ▪  Other … kind of backup methods include: —  export/import —  datapump
  • 15. Archivelog vs. No-Archivelog Mode ■  Archivelog Mode ▪  Online Redo logs are archived following a log switch ▪  Required for Online Backups —  No Downtime ▪  Note: Does require extra disk space! ▪  Make sure you have sufficient redo log groups SQL> connect / as sysdba SQL> archive log list; SQL> select log_mode from v$database; SQL> show parameter recovery SQL> shutdown immediate; SQL> startup mount SQL> alter database archivelog; SQL> shutdown immediate; SQL> startup SQL> archive log list SQL> select log_mode from v$database;
  • 16. Start from a good base
  • 17. The RMAN Environment ■  The “rman” command: rman nocatalog target / Argument Value Description ----------------------------------------------------------------------------- target quoted-string connect-string for target database catalog quoted-string connect-string for recovery catalog auxiliary quoted-string connect-string for auxiliary database nocatalog none if specified, then no recovery catalog cmdfile quoted-string name of input command file log quoted-string name of output message log file trace quoted-string name of output debugging message log file append none if specified, log is opened in append mode debug optional-args activate debugging msgno none show RMAN-nnnn prefix for all messages send quoted-string send a command to the media manager pipe string building block for pipe names script string name of catalog script to execute using list of args arguments for rman variables timeout integer number of seconds to wait for pipe input checksyntax none check the command file for syntax errors ----------------------------------------------------------------------------- Both single and double quotes (' or ") are accepted for a quoted-string. Quotes are not required unless the string contains embedded white-space. TIP  –  on  Unix  use  “oraenv”   oracle@dbvlin103[/home/oracle]:  .    oraenv   ORACLE_SID  =  [oracle]  ?      proddb   The  Oracle  base  remains  unchanged  with  value  /u01/app/oracle oracle@dbvlin103[/home/oracle]:  env  |  grep  ORA   ORACLE_SID=proddb ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1
  • 18. The RMAN Environment ■  What  is  “kind  of”  wrong  with  example  below? RMAN> backup datafile 1; Starting backup at 03-OCT-14 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=261 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=+DATA/PRODDB/DATAFILE/system.260.858601171 channel ORA_DISK_1: starting piece 1 at 03-OCT-14 channel ORA_DISK_1: finished piece 1 at 03-OCT-14 … … Finished backup at 03-OCT-14
  • 19. Why make things difficult? BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 21 Full 683.20M DISK 00:00:06 03-OCT-14 BP Key: 21 Status: AVAILABLE Compressed: NO Tag: TAG20141003T174234 Piece Name: /u02/backups/rman/proddb/15pk56ka_1_1 List of Datafiles in backup set 21 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 2785085 03-OCT-14 +DATA/PRODDB/DATAFILE/system.260.858601171 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 25 Full 683.20M DISK 00:00:14 03-OCT-14 BP Key: 25 Status: AVAILABLE Compressed: NO Tag: TAG20141003T174952 Piece Name: /u02/backups/rman/proddb/19pk5721_1_1 List of Datafiles in backup set 25 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 2785924 03-OCT-14 +DATA/PRODDB/DATAFILE/system.260.858601171
  • 20. Make it easier! – set NLS_DATE_FORMAT BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ ------------------- 21 Full 683.20M DISK 00:00:06 03/10/2014:17:42:40 BP Key: 21 Status: AVAILABLE Compressed: NO Tag: TAG20141003T174234 Piece Name: /u02/backups/rman/proddb/15pk56ka_1_1 List of Datafiles in backup set 21 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- ------------------- ---- 1 Full 2785085 03/10/2014:17:42:34 +DATA/PRODDB/DATAFILE/system.260.858601171 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ ------------------- 25 Full 683.20M DISK 00:00:14 03/10/2014:17:50:07 BP Key: 25 Status: AVAILABLE Compressed: NO Tag: TAG20141003T174952 Piece Name: /u02/backups/rman/proddb/19pk5721_1_1 List of Datafiles in backup set 25 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- ------------------- ---- 1 Full 2785924 03/10/2014:17:49:53 +DATA/PRODDB/DATAFILE/system.260.858601171 NLS_DATE_FORMAT="dd/mm/yyyy:hh24:mi:ss"
  • 21. The Default Configuration RMAN> show all; using target database control file instead of recovery catalog RMAN configuration parameters for database with db_unique_name PRODDB are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u02/backups/rman/proddb/cfc_%F'; CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1; CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u02/backups/rman/proddb/%U'; CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/12.1.0/db_1/dbs/snapcf_proddb.f'; # default
  • 22. The Default Configuration RMAN> show all; using target database control file instead of recovery catalog RMAN configuration parameters for database with db_unique_name PRODDB are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u02/backups/rman/proddb/cfc_%F'; CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1; CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u02/backups/rman/proddb/%U'; CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/12.1.0/db_1/dbs/snapcf_proddb.f'; # default
  • 23. Recovery Catalog vs. Controlfile ■  Which one is the correct one to use…. ■  Advantages or reasons to consider a Recovery Catalog: ▪  More backup history can be stored ▪  Multiple databases ▪  When using Standby Databases ▪  When looking at using centralized stored scripts ▪  Monitoring ▪  Reporting ■  Using the Controlfile, keep in mind: ▪  CONTROLFILE_RECORD_KEEP_TIME
  • 24.
  • 25. Backup Sets and Image Copies ■  Backup Set ▪  Default option ▪  Logical container ▪  Can contain one or more files ▪  Proprietary RMAN format ▪  Can be compressed ▪  Physical files on disk – called backup pieces ■  Image  Copies ▪  Powerful… but not as widely used ▪  Bit-by-Bit copy of the original file (They are Exactly the same!) ▪  Can be updated with incremental backups ▪  Can easily be switched to, reducing recovery time!!
  • 26. Example using Backup Set RMAN> run { backup as compressed backupset filesperset 10 database format '/u02/backups/rman/proddb/db-%U'; backup as compressed backupset filesperset 30 archivelog all format '/u02/backups/rman/proddb/arc-%U'; backup current controlfile format '/u02/backups/rman/proddb/ctl-%d-%I'; } Starting backup at 04/10/2014:21:46:45 using channel ORA_DISK_1 channel ORA_DISK_1: starting compressed full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00003 name=+DATA/PRODDB/DATAFILE/sysaux.294.858601125 input datafile file number=00001 name=+DATA/PRODDB/DATAFILE/system.260.858601171 input datafile file number=00006 name=+DATA/PRODDB/DATAFILE/users.259.858601227 input datafile file number=00005 name=+DATA/PRODDB/DATAFILE/data.263.859037565 input datafile file number=00004 name=+DATA/PRODDB/DATAFILE/undotbs1.258.858601227 channel ORA_DISK_1: starting piece 1 at 04/10/2014:21:46:46 channel ORA_DISK_1: finished piece 1 at 04/10/2014:21:48:21 piece handle=/u02/backups/rman/proddb/db-1spk89a6_1_1 tag=FULLDBBKP comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:35 Finished backup at 04/10/2014:21:48:21 … … 1   2  
  • 27. Example using Backup Copy RMAN> run { backup as copy database TAG 'FRA_DBCOPY'; } Note:  This  example  run  on  3  Node  11.2.0.4    RAC  database  with  sufficient  space  in  FRA  to  keep  a  copy  of  the  database. Starting backup at 04/10/2014:21:48:44 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=20 instance=DEV1 device type=DISK channel ORA_DISK_1: starting datafile copy input datafile file number=00002 name=+DATA/dev/datafile/sysaux.275.858702333 output file name=+FRA/dev/datafile/sysaux.2874.860104127 tag=FRA_DBCOPY RECID=1 STAMP=860104162 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45 … RMAN> list copy of database; List of Datafile Copies ======================= Key File S Completion Time Ckp SCN Ckp Time ------- ---- - ------------------- ---------- ------------------- 2 1 A 04/10/2014:21:50:05 48308543 04/10/2014:21:49:30 Name: +FRA/dev/datafile/system.2757.860104173 Tag: FRA_DBCOPY 1 2 A 04/10/2014:21:49:22 48308515 04/10/2014:21:48:45 Name: +FRA/dev/datafile/sysaux.2874.860104127 Tag: FRA_DBCOPY 1   2   3  
  • 28. Restoring is easy… if you have good backups Restore  one  datafile     RMAN> alter database datafile 5 offline; RMAN> restore datafile 5; RMAN> recover datafile 5; RMAN> alter database datafile 5 online; Restore  and  recover  database RMAN> startup nomount; RMAN> set dbid 598649033 RMAN> restore controlfile from '/u02/backups/rman/proddb/ctl-PRODDB-598649033'; RMAN> alter database mount; RMAN> restore database; RMAN> recover database; RMAN> alter database open resetlogs;
  • 29. But what about Image Copies? Switch  to  datafile  copy     RMAN> alter database datafile 5 offline; RMAN> switch datafile 5 to copy; RMAN> recover datafile 5; RMAN> alter database datafile 5 online; Switch  database  to  Image  Copies RMAN> startup mount; RMAN> list copy of database; RMAN> switch database to copy; RMAN> recover database; If complete recovery: RMAN> alter database open; If incomplete recovery: RMAN> alter database open resetlogs;
  • 30. Move database from file system to ASM 30 DEMO  
  • 31.
  • 32. Remember control files… (continue from Demo) ■  Start database in nomount ■  Restore “copy” the controlfile into ASM: RMAN> restore controlfile to '+DATA' from '/u02/oracle/oradata1/DEV2/control01.ctl'; ■  Update spfile ASMCMD> find +DATA/DEV2/ * … +DATA/DEV2/CONTROLFILE/current.281.887984443 … SQL> alter system set control_files='+DATA/DEV2/CONTROLFILE/current.281.887984443' scope=spfile; ■  Enable OMF and recovery area in ASM SQL> alter system set db_create_file_dest='+DATA' scope=spfile; SQL> alter system set db_recovery_file_dest='+FRA’ scope=spfile;
  • 33. RMAN Channels ■  The RMAN Client does not: ▪  Perform backups, restores or recovery operations! ■  Database Server sessions perform this work ▪  Linux – Server process ▪  Windows – Thread within database service ■  Two Supported Device Types: ▪  DISK ▪  SBT (Tape Based Backups)
  • 34. RMAN Channels - 3 Key Phases ■  Read Phase ■  Copy Phase (processing phase) ■  Write Phase •  Valida=on •  Compression •  Encryp=on
  • 35. Incremental Backups ■  1st Step - Full Level 0 Backup rman> backup … incremental level 0 database … ■  Two types of Incremental Backups: ▪  Cumulative rman> backup … incremental level 1 cumulative database … ▪  Differential (default) rman> backup … incremental level 1 database … Mon   Tue   Wed   Thu   Fri   FULL |-­‐-­‐-­‐-­‐-­‐> |-­‐-­‐-­‐-­‐-­‐-­‐ -­‐-­‐-­‐-­‐-­‐-­‐> |-­‐-­‐-­‐-­‐-­‐-­‐ -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐ -­‐-­‐-­‐-­‐-­‐-­‐> |-­‐-­‐-­‐-­‐-­‐-­‐ -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐ -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐ -­‐-­‐-­‐-­‐-­‐-­‐> Mon   Tue   Wed   Thu   Fri   FULL |-­‐-­‐-­‐-­‐-­‐> -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐ |-­‐-­‐-­‐-­‐-­‐> -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐ -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐ |-­‐-­‐-­‐-­‐-­‐> -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐ -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐ -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐ |-­‐-­‐-­‐-­‐-­‐>
  • 36. Two Advanced Options (of many) ■  Updating Image Copies using Incremental Backups ▪  Create Backup: rman> backup as copy incremental level 0 database format  '/u02/oracle/oradata2/DEV2/%N-%f.dbf' TAG=‘inc_bkp_copy'; rman> backup incremental level 1 for recover of copy with tag 'inc_bkp_copy’ database; ▪  Apply incremental backup to image copy: rman> recover copy of database with tag ’ inc_bkp_copy';
  • 37. Recover Image Copy using Incremental Backup 37 DEMO  
  • 38.
  • 39. Two Advanced Options (of many) ■  Block Change Tracking (10g+ and EE only) ▪  Default location DB_CREATE_FILE_DEST (OMF File) ▪  Minimum 10M (grows in 10M chunks) ▪  Enable: sql> alter database enable block change tracking; sql> alter database enable block change tracking using file ‘/u01/oradata/blck-tracking’; ▪  Disable: sql> alter database disable block change tracking;
  • 40. 12c… how great are those new features! ■  Four New Features that stood out for me: ▪  SQL Commands in RMAN ▪  Table Recovery ▪  Network-Enabled Restore / Recovery ▪  Rolling forward / synchronizing a Standby Database - Using Services
  • 41. 12c – SQL Commands in RMAN No more: rman> sql ‘alter system switch logfile’; Now: rman> alter system switch logfile; RMAN> create table test (id number); Statement processed RMAN> select * from test; no rows selected RMAN> begin 2> for c1 in 1..20 loop 3> insert into test values (c1); 4> end loop; 5> end; 6> / Statement processed RMAN> select count(1) from test; COUNT(1) ---------- 20 RMAN> rollback; Statement processed RMAN> drop table test purge; Statement processed
  • 42. 12c – Table Recovery Pre-requisites: ■  Backups must be available ■  Target database must be: ▪  open Read / Write and in archivelog mode Things to take into account ■  An Auxiliary Instance ■  Tablespace containing table is restored ■  Datapump used for table export/import ■  Disable table import using: NOTABLEIMPORT keyword ■  Make sure you have sufficient storage – auxiliary instance
  • 43. Restore Table using RMAN (12c) 43 DEMO  
  • 44. 44
  • 45. 12c – Network-Enabled Restore/Recovery ■  Restore a datafile from a Primary / Standby ■  Using Services ■  Configure and Test Networking: ▪  listener.ora ▪  tnsnames.ora ■  SECTIONSIZE, encryption, compressed backupsets can be used ■  Improved restore | recover datafile Commands rman> restore datafile n from service <service>; rman> recover datafile n from service <service>;
  • 46. 12c – Network-Enabled Restore/Recovery RMAN> alter database datafile 5 offline; Statement processed RMAN> restore datafile 5 from service proddb_dr; Starting restore at 07/10/2014:13:06:28 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: using network backup set from service proddb_dr channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00005 to +DATA/PRODDB/DATAFILE/data.304.860260051 channel ORA_DISK_1: restore complete, elapsed time: 00:00:03 Finished restore at 07/10/2014:13:06:32 RMAN> recover datafile 5; Starting recover at 07/10/2014:13:06:39 using channel ORA_DISK_1 starting media recovery media recovery complete, elapsed time: 00:00:01 Finished recover at 07/10/2014:13:06:40 RMAN> alter database datafile 5 online; Statement processed
  • 47. 12c – Rolling Forward / Sync a Standby Database Quick and easy recovery from: ■  Unrecoverable archive log gaps ■  No-logging operations When using this method •  Standby = Target •  Primary = Auxiliary Behind the scenes: ■  Standby database “current SCN” is obtained ■  Primary database incremental backup from this SCN ■  Incremental backup copied across network and applied to standby
  • 48. 12c – Rolling Forward / Sync a Standby Database Example: (executed from standby server) rman> connect target / rman> connect auxiliary sys/<syspassword>@<your_primary_db_service> rman> recover database from service <your_primary_db_service> using compressed backupset; Important last step ▪  Recreate the standby controlfile —  Required as standby controlfile SCN lower than datafile SCN —  Update datafile and tempfile names if required
  • 49. Tip - Don’t forget about Data Recovery Advisor ■  Introduced in Oracle 11g ■  Three key commands: rman> LIST failure rman> ADVISE failure rman> REPAIR failure ■  Not available when using Multi-tenancy - CDB/PDB ▪  Expected in 12.2
  • 50. Reporting and Monitoring ■  Using RMAN: ▪  LIST command ▪  REPORT command ■  Using Database Queries: ▪  Monitor current running jobs: —  v$session —  v$session_longops ▪  Monitoring history: —  v$rman_backup_job_details —  v$rman_output
  • 51. Reporting and Monitoring SELECT command_id , status , start_time , end_time , time_taken_display , input_type , output_device_type , input_bytes_display , output_bytes_display , output_bytes_per_sec_display from v$rman_backup_job_details where start_time > (sysdate-5) order by start_time; Rman> list backup; Rman> list copy; Rman> list copy of database; Rman> list copy of datafile n; Rman> report schema; Rman> report need backup; Rman> report obsolete;
  • 52. RMAN is easy! Start with the basics before making things too complex: ■  set NLS_DATE_FORMAT ■  SHOW ALL ■  CONFIGURE ■  BACKUP DATABASE ■  RESTORE | RECOVER DATABASE ■  RESTORE | RECOVER DATAFILE Don’t forget about the VALIDATE options!!
  • 53. Recommended Reading •  Oracle Online Documentation •  Oracle Database 12c Backup and Recovery Survival Guide •  RMAN Recipes for Oracle Database 11g, A Problem-Solution Approach •  Dbvisit Blog – http://blog.dbvisit.com
  • 54. ■  Change Control is there for a reason! ■  ■  Document  your  Backup  and  Recovery  procedures!!! But most important!
  • 55. Questions? Presented By: Anton Els Company: Dbvisit Software Limited Email: anton.els@dbvisit.com Twitter: @aelsnz Blog: http://blog.dbvisit.com/author/anton-els/