RMAN
Recovery
Manager
BACKUP & RECOVERY
Veeratteshwaran Sridhar
Why Backup & Recovery
?
The purpose of a backup and recovery strategy is
to protect the database against data loss and
reconstruct the database after data loss.
RMAN
Backup
Hello Boss,
HelloDatabase
Boss..!!!Database
is Recovering
Recovered…!!!
Crash
Oracle Backup and Recovery
Techniques
 RMAN – Recovery Manager
 User Managed Backup
 EXP / EXPDP and IMP / IMPDP – Export Backup
What is RMAN – Recovery Manager
 It is an Oracle Utility that performs backup and recovery
tasks on your databases and automates administration of
your backup strategies.
 It greatly simplifies backing up, restoring, and
recovering database files.
 It is a feature of the Oracle database server and
does not require separate installation.
?
Question
In Which version of Oracle RMAN
Introduced?
 Oracle 7
 Oracle 8
 Oracle 9
RMAN (Recovery Manager) is a backup and recovery
manager supplied for Oracle databases (from version 8)
created by the Oracle Corporation. It provides database
backup, restore, and recovery capabilities addressing high
availability and disaster recovery concerns.
RMAN - Evolution
RMAN (Recovery Manager) is a backup and recovery
manager supplied for Oracle databases (from version 8)
created by the Oracle Corporation. It provides database
backup, restore, and recovery capabilities addressing high
availability and disaster recovery concerns.
Support for
Multitenancy
Data Recovery
Advisor
Recover
Table & Table
Partitions
Better Catalog
Management
Multisection
Backup
Image
Parallel
Copies
Backup of
SHOW
Same DatafileALL
NEWLY BORN
Cross-Platform
Backup & Restore
Improvements
Restartable
Backup
Duplicate
Proactive
Enhancements
Health Check
SHOW ALL
Enhancement
SQL Interface
Archivelog
Deletion
Policy
Automatic
Channel
Failover
Automatic
Block Repair
Drop
VirtualSYSBACKUP
Private
Database
Catalog
thru RMAN
Backup of
Archivelogs
Block
Change
Tracking
Components of RMAN
RMAN
TARGET
DATABASE
RMAN
CLIENT
FAST
RECOVERY
AREA
MEDIA
MANAGER
RECOVERY
CATALOG
RECOVERY
CATALOG
SCHEMA
Components of RMAN
TAPE DRIVE
TAPE DRIVE
TARGET
DATABASE
CONTROL FILE
STANDBY
DATABASE
RECOVERY
CATALOG
AUXILIARY
INSTANCE
RMAN CLIENT
RECOVER
CATALOG
SCHEMA
Benefits of RMAN
 Corrupted Blocks are detected and reported.
 Backs up and restores DATABASES,
TABLESPACES, DATAFILES, CONTROLFILES and
SPFILES.
 Can create a single Backup of all archive logs since
the last backup.
 Can delete archive logs after they are backed up.
 Can backup the Control File and SPFILE
automatically.
 Used for Cloning Databases and creating Standby
Databases.
RMAN Terminology
Image Copy
Full copy of a Single File
Backup Set
Oracle format for a package of Objects backed up
Channel
A server process on the target database
DB Incarnation
Incremented each resetlogs
Tag
A logical name assigned by a user to a backup set or image
copy. Tag=< name >
FEATURES
Closed Database
Backups
RECOVERY
MANAGER
Supported
USER MANAGED EXPORT BACKUP
Supported
Not Supported
Open Database
Backups
Supported
Supported
Requires Rollback or
Undo segments to
generate consistent
backups
Incremental Backups
Supported
Not Supported
Not Supported
Not Supported
Supported. But
Identifies corrupt
blocks in the Export
Log.
Corrupt Block
Detection
Supported
Not Supported. Files
to be backed up
Not Supported
should be copied
manually.
Not Supported. DBA
Supported. Catalog /
should maintain the Not Supported
NoCatalog
backup records.
Automatic
Specification of Files to Supported
include in the backup
Backup Repository
Backups to Media
Manager (Tapes)
Supported
Supported
Not Supported
Backup of
Initialization
Parameter
Supported
Supported
Not Supported
Backup of Password
and Networking Files
Not Supported
Supported
Not Supported
RMAN 12c – Some New Features
 SHOW ALL – RMAN Configuration Settings
 SQL Interface Improvements
 SYSBACKUP Privilege
 Multisection Backup Improvements
 Recovering Tables and Table Partitions using RMAN
Backups
 Support for Multitenant Architecture
Duplicate Enhancements
RMAN 12c
RMAN Configuration Settings
SHOW ALL;
In RMAN 11g
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 OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
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 ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO
'/oracle/product/11.2.0.3/db_1/dbs/snapcf_proddb.f'; # default
In RMAN 12c – Non CDB
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name RMANDB are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
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
'/oracle/product/12.1.0/db_1/dbs/snapcf_RMANDB.f'; # default
In RMAN 12c – CDB
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name TEST12C are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
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
'/localfs/orasrc/product/db/12.2.0.1/dbs/snapcf_TEST12C.f'; # default
?
Question
How can you RESET all the configuration settings of
RMAN to DEFAULT using a single command?
execute dbms_backup_restore.resetConfig;
SQL> conn / as sysdba
SQL> execute dbms_backup_restore.resetConfig;
PL/SQL procedure successfully completed.
RMAN 12c
SQL Interface Improvements
SQL Interface Improvements
 Till Oracle 11g, to run the SQL commands in the RMAN prompt we need to use
SQL Keyword.
 SQL keyword is required preceding any SQL statements when used in RMAN.
RMAN> sql ‘sql statement’;
 In Oracle 12c RMAN, to run the SQL commands in the RMAN prompt, the use of
SQL keyword has been eliminated. Now RMAN has been more friendly to SQL
commands.
RMAN> sql statement;
In RMAN 11g
RMAN> sql "alter database datafile
'+DATA_GRP/proddb/datafile/users.259.851949575'' offline";
sql statement: alter database datafile
''+DATA_GRP/proddb/datafile/users.259.851949575'' offline
Below we can see the datafile belonging to USERS tablespace is OFFLINE.
SQL> select file#,name,status from v$datafile;
FILE#
-----1
2
3
4
5
6
NAME
-----------------------------------------------------------------------+DATA_GRP/proddb/datafile/system.256.848660835
+DATA_GRP/proddb/datafile/sysaux.257.848660835
+DATA_GRP/proddb/datafile/undotbs1.258.848660835
+DATA_GRP/proddb/datafile/users.259.851949575
+DATA_GRP/proddb/datafile/example.265.848660933
+DATA_GRP/proddb/datafile/tbsrman.267.848663633
STATUS
------SYSTEM
ONLINE
ONLINE
OFFLINE
ONLINE
ONLINE
In RMAN 12c
We can use the common SQL syntax without starting the command with the
keyword SQL or the necessity to include double or single quotes.
It's the same SQL command we use on a SqlPlus session.
RMAN> alter database datafile '/vol1/oradata/RMANDB/users01.dbf' offline;
Statement processed
SQL> select name,status from v$datafile;
NAME
-------------------------------/vol1/oradata/RMANDB/system01.dbf
/vol1/oradata/RMANDB/example01.dbf
/vol1/oradata/RMANDB/sysaux01.dbf
/vol1/oradata/RMANDB/undotbs01.dbf
/vol2/tbsrman01.dbf
/vol1/oradata/RMANDB/users01.dbf
STATUS
-------------SYSTEM
ONLINE
ONLINE
ONLINE
ONLINE
OFFLINE
In RMAN 11g – Insert Statements
RMAN> sql "insert into scott.dept values (50, ''IT'',''INDIA'')";
sql statement: insert into scott.dept values (50, ''IT'',''INDIA'')
RMAN> sql "commit";
sql statement: commit
SQL> select * from scott.dept;
DEPTNO DNAME
---------- ----------50
IT
10
ACCOUNTING
20
RESEARCH
30
SALES
40
OPERATIONS
LOC
------------INDIA
NEW YORK
DALLAS
CHICAGO
BOSTON
In RMAN 12c – Insert Statements
RMAN> insert into scott.dept values (50, ‘IT’,‘INDIA’);
Statement processed
RMAN> commit;
Statement processed
SQL> select * from scott.dept;
DEPTNO DNAME
---------- ----------50
IT
10
ACCOUNTING
20
RESEARCH
30
SALES
40
OPERATIONS
LOC
------------INDIA
NEW YORK
DALLAS
CHICAGO
BOSTON
In a similar way we can also issue create table statements,
update statements etc., in RMAN Prompt without any
trouble of quotations like single quotes or double quotes and
also without the Preceding SQL keyword.
What About SELECT and
DES[CRIBE] Statements?
In RMAN 11g
In Oracle 11g, It will not allow us to run SELECT and DESC[RIBE] commands in
RMAN Prompt.
RMAN> sql "select instance_name,status from v$instance";
sql statement: select instance_name,status from v$instance
RMAN> sql 'desc v$instance';
sql statement: desc v$instance
RMAN00571:================================================
RMAN-00569: ===============ERROR MESSAGE STACK FOLLOWS=====
RMAN00571:================================================
RMAN-03009: failure of sql command on default channel at 02/22/2015 16:11:53
RMAN-11003: failure during parse/execution of SQL statement: desc v$instance
ORA-00900: invalid SQL statement
In RMAN 12c
In Oracle 12c, We can also run SELECT and DESC[RIBE] commands in RMAN
Prompt.
RMAN> select instance_name,status from v$instance;
INSTANCE_NAME
--------------------------RMANDB
STATUS
-----------OPEN
RMAN> desc dual
Name
------------DUMMY
Null?
------
Type
------------VARCHAR2(1)
?
Question
When was Transportable Tablespace Feature
introduced?
 Oracle 7
 Oracle 8
 Oracle 9
Transportable Tablespace was introduced in Oracle 8i. Database’s source and
destination must match the Block Size. OS must be same across the Source and
Target.
RMAN 12c
SYSBACKUP Privilege
In RMAN 11g
 Till Oracle 11g , users required SYSDBA privilege to backup the database. There
were no separate roles given to the user who does the Backup and Recovery
Operations.
[oracle@localhost ~]$ rman
Recovery Manager: Release 11.2.0.3.0 - Production on Sun Feb 22 17:00:05 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
RMAN> connect target /
connected to target database: PRODDB (DBID=588708646)

RMAN connects you to the target Database or Auxiliary database with
the SYSDBA privilege. If you do not have this privilege, then the connection fails.
 You can connect as SYSDBA using a password file or using operating system
authentication.
 You do not need to specify the SYSDBA option because RMAN uses this option
implicitly and automatically. You must only have the SYSDBA privilege to
connect to the target database.
In RMAN 12c
 In Oracle 12c a new Predefined role exclusively for Backup and Recovery has
been introduced.
SYSBACKUP
 This role is created with the database creation.
 The SYSBACKUP privilege allows the DBA to perform RMAN backup commands
without additional privileges.
 With RMAN you have same authentication options that are available with
SQL*Plus, which are Operating system authentication and password file
authentication.
RMAN> connect target "/ as sysbackup"
connected to target database: RMANDB (DBID=3659344729)
 SYSBACKUP does not include data access privilege, such as SELECT ANY TABLE.
 When you don’t specify the role explicitly then the default used is as SYSDBA.
RMAN 12c
Multisection Backup Improvements
In RMAN 11g

Multi-Section option was introduced in Oracle 11g to handle large Datafiles
backups.

Using this option RMAN can split up or break up a large file into sections during
the backup and recovery.

This improves the performance of backup and recovery of a large Datafiles.
Multi-Section option can be used in Oracle 11g for the below,
1. Backup using Backup sets.
2. Full Backups using Backup sets.
3. Incremental level 0 backups using Backup sets.

SECTION SIZE is the keyword used and each channel will create separate
files within the backup sets and backup the database in parallel.

This option can only be used to backup the Datafiles.

We can not use this option to backup the Control Files.
In RMAN 11g
SQL> select file_id,file_name,bytes/1024/1024 size_mb from
dba_data_files;where file_id=5;
FILE_ID FILE_NAME
---------- ---------------------------------------------------------------------------5
+DATA_GRP/proddb/datafile/example.265.848660933
SIZE_MB
------------345.625
When trying to backup as copy the datafile 5 using SECTION SIZE
option,
RMAN> backup as copy section size 100M datafile 5;
Starting backup at 22-FEB-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=52 device type=DISK
RMAN-00571: =================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS======
RMAN-00571:=================================================
RMAN-03002: failure of backup command at 02/22/2015 18:08:14
RMAN-06580: the SECBYTES option cannot be used with AS COPY
In RMAN 12c
 From Oracle 12c RMAN, Multisection Backups are supported for the
below.,
1. Backup using Backup sets and Image Copies
2. Full Backups using Backup sets and Image Copies
3. Incremental level 0 backups and higher than level 0
 If we specify the SECTION SIZE larger than the actual Datafile size,
then RMAN does not use the Multisection option.
 The following example creates a multisection backup of the database
using image copies,
BACKUP AS COPY SECTION SIZE 500M DATABASE;
 The following example creates Multisection level 1
incremental backup,
BACKUP INCREMENTAL LEVEL 1 SECTION SIZE 500M DATABASE;
In RMAN 12c
SQL> select file_id,file_name,bytes/1024/1024 Size_MB from
dba_data_files where file_id=2;
FILE_ID FILE_NAME
SIZE_MB
------------------------------------------------------------- -------------2
/vol1/oradata/RMANDB/example01.dbf 358.125
RMAN> backup as copy section size 100M datafile 2;
Starting backup at 22-FEB-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=44 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/vol1/oradata/RMANDB/example01.dbf
backing up blocks 1 through 12800
output file name=/oracle/fast_recovery_area/RMANDB/datafile/o1_mf_example_bgmoq5kt_.dbf
tag=TAG20150222T184725
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/vol1/oradata/RMANDB/example01.dbf
backing up blocks 12801 through 25600
output file name=/oracle/fast_recovery_area/RMANDB/datafile/o1_mf_example_bgmoq5kt_.dbf
tag=TAG20150222T184725
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/vol1/oradata/RMANDB/example01.dbf
backing up blocks 25601 through 38400
output file name=/oracle/fast_recovery_area/RMANDB/datafile/o1_mf_example_bgmoq5kt_.dbf
tag=TAG20150222T184725
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:04
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/vol1/oradata/RMANDB/example01.dbf
backing up blocks 38401 through 45840
output file name=/oracle/fast_recovery_area/RMANDB/datafile/o1_mf_example_bgmoq5kt_.dbf
tag=TAG20150222T184725
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 22-FEB-15
In RMAN 12c
RMAN> configure device type disk parallelism 4 backup type to backupset;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters are successfully stored
released channel: ORA_DISK_1
RMAN> backup as copy section size 100M datafile 2;
Starting backup at 22-FEB-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=44 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=40 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=43 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=58 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/vol1/oradata/RMANDB/example01.dbf
backing up blocks 1 through 12800
channel ORA_DISK_2: starting datafile copy
input datafile file number=00002 name=/vol1/oradata/RMANDB/example01.dbf
backing up blocks 12801 through 25600
channel ORA_DISK_3: starting datafile copy
input datafile file number=00002 name=/vol1/oradata/RMANDB/example01.dbf
backing up blocks 25601 through 38400
channel ORA_DISK_4: starting datafile copy
input datafile file number=00002 name=/vol1/oradata/RMANDB/example01.dbf
backing up blocks 38401 through 45840
output file name=/oracle/fast_recovery_area/RMANDB/datafile/o1_mf_example_bgmp0psq_.dbf tag=TAG20150222T185230
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:08
output file name=/oracle/fast_recovery_area/RMANDB/datafile/o1_mf_example_bgmp0psq_.dbf tag=TAG20150222T185230
channel ORA_DISK_2: datafile copy complete, elapsed time: 00:00:07
output file name=/oracle/fast_recovery_area/RMANDB/datafile/o1_mf_example_bgmp0psq_.dbf tag=TAG20150222T185230
channel ORA_DISK_3: datafile copy complete, elapsed time: 00:00:07
output file name=/oracle/fast_recovery_area/RMANDB/datafile/o1_mf_example_bgmp0psq_.dbf tag=TAG20150222T185230
channel ORA_DISK_4: datafile copy complete, elapsed time: 00:00:07
Finished backup at 22-FEB-15
RMAN 12c
Table and Table Partition Recovery
In RMAN 11g
 Using Database Point-in-Time Recovery (DBPITR).
 Using Tablespace Point-in-Time Recovery (TSPITR).
 Using Recycle Bin.
 Using Flashback Table command.
In RMAN 12c
 From 12c, RMAN enables us to recover tables and table
partitions at a point-in-time without affecting other objects in
the database.
 RECOVER TABLE is the command used to recover table and
table partitions from an RMAN Backup.
 Uses Database Backups and Archived Redo Logs for Recovery.
 The Recovery happens at an Auxiliary location. Uses an
automatically created and maintained Auxiliary instance.
 User need to specify the auxiliary database location using
AUXILIARY DESTINATION clause in the RECOVERY command.
 The database remains online. During Recovery other objects
are not disturbed.
Table Recovery – Useful in below
Scenarios
 When the object has Logical corruption or dropped.
 When there is no sufficient undo to perform Flashback table.
 When DDL operation modified the structure and you want to
recover the data (Flashback cannot rewind the structural
changes).
 If you need to recover a small number of tables to a point-intime.
Table Recovery – Pre-Requisites
 Database must be in ARCHIVELOG mode and read-write mode.
 At least one full backup is available along with archived logs.
 Enough disk space is available on the database server for
auxiliary instance.
 If present, any dependent objects to include in recovery.
 COMPATIBLE parameter must be set to 11.1.0 or higher to
recover table partition.
Table Recovery – Steps
 Determine the backup which has the tables or table partitions
that needs to recover to specified point-in-time.
 Create auxiliary database and recover the tables or table
partitions until specified point-in-time.
 Take a data dump export with recovered tables or table
partitions.
 Import the dump into target database.
 Rename the recovered tables or table partitions in the target
database.
 Clean-up the Auxiliary Instance.
1
Table Recovery
Backup the
Database
RMAN> backup as backupset incremental level 0 database plus
archivelog;
SQL> select to_char(sysdate, 'DD-MON-YYYY HH24:MI:SS
am'),current_scn from v$database;
SYSDATE
----------------------------------24-FEB-2015 00:51:12 am
Check the current
SCN / Time
CURRENT_SCN
----------------------2017619
SQL> drop table TEST;
Drop the Table
Table dropped.
SQL> desc TEST
ERROR:
ORA-04043: object TEST does not exist
Check if the Table
Exists
Table Recovery
Connect to
RMAN
[oracle@Oracle12c ~]$ rman target /
Recovery Manager: Release 12.1.0.1.0 - Production on Tue Feb 24
00:52:03 2015
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights
reserved.
connected to target database: RMANDB (DBID=3659344729)
Recover Table
RMAN> RECOVER TABLE SCOTT."TEST" UNTIL TIME
"to_date('24-FEB-2015 00:51:12','DD-MON-YYYY:HH24:MI:SS')"
AUXILIARY DESTINATION '/backup' DATAPUMP DESTINATION
'/backup' DUMP FILE 'testdump.dmp';
Table Recovery – How it Works?
1. Creating automatic instance, with
SID='axEy'
initialization parameters used for automatic instance:
db_name=RMANDB
db_unique_name=axEy_pitr_RMANDB
compatible=12.1.0.0.0
db_block_size=8192
db_files=200
sga_target=1G
processes=80
diagnostic_dest=/oracle
db_create_file_dest=/backup
log_archive_dest_1='location=/backup'
#No auxiliary parameter file used
Table Recovery – How it Works?
2. Restore of the Control File for the Auxiliary
Instance
contents of Memory Script:
{
# set requested point in time
set until time "to_date('24-FEB-2015 00:51:12','DD-MONYYYY:HH24:MI:SS')";
# restore the controlfile
restore clone controlfile;
# mount the controlfile
sql clone 'alter database mount clone database';
# archive current online log
sql 'alter system archive log current';
}
Table Recovery – How it Works?
3. A list of Datafiles that will be restored, followed by
their restore and recovery in the auxiliary instance.
contents of Memory Script:
{
# set requested point in time
set until time "to_date('24-FEB-2015 00:51:12','DD-MON-YYYY:HH24:MI:SS')";
# set destinations for recovery set and auxiliary set datafiles
set newname for clone datafile 1 to new;
set newname for clone datafile 4 to new;
set newname for clone datafile 3 to new;
set newname for clone tempfile 1 to new;
# switch all tempfiles
switch clone tempfile all;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile 1, 4, 3;
switch clone datafile all;
}
contents of Memory Script:
{
# set requested point in time
set until time "to_date('24-FEB-2015 00:51:12','DD-MON-YYYY:HH24:MI:SS')";
# online the datafiles restored or switched
sql clone "alter database datafile 6 online";
# recover and open resetlogs
recover clone database tablespace "USERS", "SYSTEM", "UNDOTBS1", "SYSAUX" delete
archivelog;
alter clone database open resetlogs;
}
Table Recovery – How it Works?
4. Export of tables from the auxiliary instance via Oracle
Data Pump.
contents of Memory Script:
{
# create directory for datapump import
sql "create or replace directory TSPITR_DIROBJ_DPDIR as ''
/backup''";
# create directory for datapump export
sql clone "create or replace directory TSPITR_DIROBJ_DPDIR as ''
/backup''";
}
executing Memory Script
sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/backup'‘
sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/backup'‘
Performing export of tables...
EXPDP> Starting "SYS"."TSPITR_EXP_axEy_ugii":
EXPDP> Estimate in progress using BLOCKS method...
EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
EXPDP> Total estimation using BLOCKS method: 64 KB
EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
EXPDP> Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
EXPDP> Processing object type
TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
EXPDP> . . exported "SCOTT"."TEST"
5.539 KB
3 rows
EXPDP> Master table "SYS"."TSPITR_EXP_axEy_ugii" successfully loaded/unloaded
EXPDP> ******************************************************************************
EXPDP> Dump file set for SYS.TSPITR_EXP_axEy_ugii is:
EXPDP> /backup/testdump.dmp
EXPDP> Job "SYS"."TSPITR_EXP_axEy_ugii" successfully completed at Tue Feb 24 00:54:34 2015
elapsed 0 00:00:31
Export completed
Table Recovery – How it Works?
5. Import of tables, constraints, indexes, and other
dependent objects into the target database from the Data
Pump export file.
contents of Memory Script:
{
# shutdown clone before import
shutdown clone abort
}
executing Memory Script
Oracle instance shut down
Performing import of tables...
IMPDP> Master table "SYS"."TSPITR_IMP_axEy_Ewrg" successfully loaded/unloaded
IMPDP> Starting "SYS"."TSPITR_IMP_axEy_Ewrg":
IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
IMPDP> . . imported "SCOTT"."TEST"
5.539 KB
3 rows
IMPDP> Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
IMPDP> Processing object type
TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
IMPDP> Processing object type
TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
IMPDP> Job "SYS"."TSPITR_IMP_axEy_Ewrg" successfully completed at Tue Feb 24
00:54:42 2015 elapsed 0 00:00:02
Import completed
Table Recovery – How it Works?
6. Clean-up of the Auxiliary Instance.
Removing automatic instance
Automatic instance removed
auxiliary instance file
/backup/RMANDB/datafile/o1_mf_temp_bgpzkdmn_.tmp deleted
auxiliary instance file
/backup/AXEY_PITR_RMANDB/onlinelog/o1_mf_3_bgpzl21n_.log deleted
auxiliary instance file
/backup/AXEY_PITR_RMANDB/onlinelog/o1_mf_2_bgpzl0q8_.log deleted
auxiliary instance file
/backup/AXEY_PITR_RMANDB/onlinelog/o1_mf_1_bgpzkzlr_.log deleted
auxiliary instance file
/backup/AXEY_PITR_RMANDB/datafile/o1_mf_users_bgpzky0x_.dbf
deleted
auxiliary instance file
/backup/RMANDB/datafile/o1_mf_sysaux_bgpzhy1m_.dbf deleted
auxiliary instance file
/backup/RMANDB/datafile/o1_mf_undotbs1_bgpzhy13_.dbf deleted
auxiliary instance file
/backup/RMANDB/datafile/o1_mf_system_bgpzhy16_.dbf deleted
auxiliary instance file /backup/RMANDB/controlfile/o1_mf_bgpzhq7j_.ctl
deleted
auxiliary instance file testdump.dmp deleted
Finished recover at 24-FEB-15
RMAN 12c
Support for Multitenant Architecture
Oracle 12c Multitenant Architecture
 Multitenant Architecture was introduced in Oracle 12c.
 The Architecture consists of Container Database and Pluggable
Databases.
 RMAN 12c provides full support for backup and recovery of
these Container and Pluggable databases.
 You can backup the Entire Container Database. It is similar to
a Full Backup of a Non-CDB database.
 Backing up a Container Database includes all the Pluggable
Databases and Archive Logs.
Oracle 12c Multitenancy
RMAN 12c in Multitenant Architecture
BACKUP COMMANDS
 Backing up the Whole CDB or Non-CDB Database
RMAN> BACKUP DATABASE;
 Backing up a Pluggable Database(s)
RMAN> BACKUP PLUGGABLE DATABASE PDB1;
RMAN> BACKUP PLUGGABLE DATABASE PDB1, PDB2;
 Backing up a ROOT Container Database
RMAN> BACKUP PLUGGABLE DATABASE ROOT;
 Backing up a Tablespace of a Pluggable Database
RMAN> BACKUP TABLESPACE PDB1:TEST_TBS;
RMAN 12c in Multitenant Architecture
RECOVER COMMANDS
 Recover the Whole CDB or Non-CDB Database
RMAN> RECOVER DATABASE;
 Recover a Pluggable Database(s)
RMAN> RECOVER PLUGGABLE DATABASE PDB1;
RMAN> RECOVER PLUGGABLE DATABASE PDB1, PDB2;
 Recover a ROOT Container Database
RMAN> RECOVER PLUGGABLE DATABASE ROOT;
 Recover a Tablespace of a Pluggable Database
RMAN> RECOVER TABLESPACE PDB1:TEST_TBS;
RMAN 12c
DUPLICATE Enhancements
RMAN 12c Duplicate Enhancements
 On using DUPLICATE command Database is Created and
Opened with RESETLOGS.
 In 12c a Clause has been introduced NOOPEN.
 The Database will be created and will not be Opened.
 NOOPEN clause is used as below.,
RMAN> DUPLICATE TARGET DATABASE TO DUPDB
FROM ACTIVE DATABASE NOOPEN;
RMAN 12c Duplicate Enhancements
NOOPEN Clause is used in the below Situations.,
 If any modifications needed to the Initialization Parameters
before opening the database.
 If you plan to create a database for Upgrade or open with the
Upgrade mode (Startup Upgrade).
Thank You..!!!