Professional Documents
Culture Documents
Database - HA
ABSTRACT
Oracle Recovery Manager (Oracle RMAN) has evolved since being released in version 8i. With the newest version
of Oracle 12c, RMAN has great new features that will allow you to reduce your down time in case of a disaster. In this
session paper you will learn about the new features that were introduced in Oracle 12c and how can you take advantage of
them from the first day you upgrade to this version.
TARGET AUDIENCE
This paper will be beneficial for anyone who is beginning to use Oracles Recovery Manager and for those who are already
using it, but want to understand the several new features of RMAN in Oracle 12c.
EXECUTIVE SUMMARY
Learner will be able to:
Understand what is RMAN and how has it evolved along versions of Oracle
Obtain the knowledge of the newest features of RMAN in Oracle Database 12c and how to apply them.
Provide examples of backup and recovery solutions with RMAN 12c
How RMAN and EM 12c are moving hand in hand with DBaaS
1|P a g e
A pluggable Database (PDB) is a user-created container holding the data and code for your specific applications. A
PDB:
2|P a g e
These files are not backed up with Oracles RMAN utility, you need to use a distinct method to back up these types of files.
UNIX/Linux
Windows
OSDBA
dba
OSBACKUPDBA
backupdba
ORA_HOMENAME_SYSBACKUP
3|P a g e
But what is most important about this is that it allows you to not grant the SYSDBA privilege to the user that runs
and administers your backups, so that user will no longer be able to SELECT/INSERT/UPDATE/DELETE ANY TABLE.
[oracle@oracleenespanol2 Desktop]$ rman target '"/ as sysbackup"'
connected to target database: CDB1 (DBID=808250731)
RMAN> select privilege from dba_sys_privs where grantee='SYSBACKUP';
PRIVILEGE
---------------------------------------ALTER SYSTEM
AUDIT ANY
SELECT ANY TRANSACTION
SELECT ANY DICTIONARY
RESUMABLE
CREATE ANY DIRECTORY
UNLIMITED TABLESPACE
ALTER TABLESPACE
ALTER SESSION
ALTER DATABASE
CREATE ANY TABLE
DROP TABLESPACE
CREATE ANY CLUSTER
13 rows selected
Having this privilege allows you to perform the following operations and as well enables you to connect to the
database even if the database is not open.
STARTUP/ SHUTDOWN
ALTER DATABASE/ SYSTEM/ SESSION/ TABLESPACE
CREATE CONTROLFILE/ ANY DIRECTORY/ ANY TABLE/ PFILE/ SPFILE / ANY CLUSTER/ SESSION
CREATE RESTORE POINT (including GUARANTEED restore points)
DROP DATABASE/ TABLESPACE/ RESTORE POINT (including GUARANTEED restore points)
FLASHBACK DATABASE/ RESUMABLE
UNLIMITED TABLESPACE
SELECT ANY DICTIONARY/ ANY TRANSACTION
SELECT
o
X$ tables (that is, the fixed tables)
o
V$ and GV$ views (that is, the dynamic performance views)
o
APPQOSSYS.WLM_CLASSIFIER_PLAN
o
SYSTEM.LOGSTDBY$PARAMETERS
DELETE/INSERT
o
SYS.APPLY$_SOURCE_SCHEMA
o
SYSTEM.LOGSTDBY$PARAMETERS
EXECUTE
o
SYS.DBMS_BACKUP_RESTORE
o
SYS.DBMS_RCVMAN
o
SYS.DBMS_DATAPUMP
o
SYS.DBMS_IR
o
SYS.DBMS_PIPE
o
SYS.SYS_ERROR
o
SYS.DBMS_TTS
o
SYS.DBMS_TDB
o
SYS.DBMS_PLUGTS
o
SYS.DBMS_PLUGTSP
SELECT_CATALOG_ROLE
4|P a g e
5|P a g e
Backing up your databases in 12c does not differ much as with previous versions as long as you understand the
hierarchy that persists with this version. When backing up the container database (CDB1), it will backup your root and all of
your pluggable databases files. With this type of backup it will allow you to recover one or all of your pluggable databases as
well as your container database.
[oracle@oracleenespanol2 admin]$ rman target sys/oracle@cdb1
connected to target database: CDB1 (DBID=808250731)
RMAN> backup database plus archivelog;
Starting backup at 25-JAN-14
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=82 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=42 RECID=39 STAMP=837794802
channel ORA_DISK_1: starting piece 1 at 25-JAN-14
channel ORA_DISK_1: finished piece 1 at 25-JAN-14
piece
handle=/u01/app/oracle/fast_recovery_area/CDB1/backupset/2014_01_25/o1_mf_annnn_TAG20140125T164643_9g8m7
3h2_.bkp tag=TAG20140125T164643 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 25-JAN-14
Starting backup at 25-JAN-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003 name=/u01/app/oracle/oradata/CDB1/datafile/o1_mf_sysaux_9c520w6w_.dbf
input datafile file number=00001 name=/u01/app/oracle/oradata/CDB1/datafile/o1_mf_system_9c522mbz_.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/CDB1/datafile/o1_mf_undotbs1_9c524cnr_.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/CDB1/datafile/o1_mf_users_9c524bjm_.dbf
channel ORA_DISK_1: starting piece 1 at 25-JAN-14
channel ORA_DISK_1: finished piece 1 at 25-JAN-14
piece
handle=/u01/app/oracle/fast_recovery_area/CDB1/backupset/2014_01_25/o1_mf_nnndf_TAG20140125T164644_9g8m7
4qz_.bkp tag=TAG20140125T164644 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:25
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00009
name=/u01/app/oracle/oradata/CDB1/EDDDC5E35CF7216DE043344EB2C0AB6F/datafile/o1_mf_sysaux_9c52fqvt_.dbf
input datafile file number=00008
name=/u01/app/oracle/oradata/CDB1/EDDDC5E35CF7216DE043344EB2C0AB6F/datafile/o1_mf_system_9c52fqt1_.dbf
input datafile file number=00010
name=/u01/app/oracle/oradata/CDB1/EDDDC5E35CF7216DE043344EB2C0AB6F/datafile/o1_mf_users_9c52hof0_.dbf
channel ORA_DISK_1: starting piece 1 at 25-JAN-14
channel ORA_DISK_1: finished piece 1 at 25-JAN-14
piece
handle=/u01/app/oracle/fast_recovery_area/CDB1/EDDDC5E35CF7216DE043344EB2C0AB6F/backupset/2014_01_25/o1_
mf_nnndf_TAG20140125T164644_9g8m9svd_.bkp tag=TAG20140125T164644 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting full datafile backup set
6|P a g e
When you only connect to your pluggable (PDB1), you can also make a backup of this database, but it will only allow you to
recover that particular database. One thing to keep in mind, is that if you include your archivelogs when backing up your
database, it doesnt do an archivelog switch, this will only happen at the container level, when you do it at a pluggable level, it
will tell you that there are no archivelogs in the repository.
[oracle@oracleenespanol2 admin]$ rman target sys/oracle@pdb1
Recovery Manager: Release 12.1.0.1.0 - Production on Sat Jan 25 16:54:00 2014
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
connected to target database: CDB1 (DBID=808250731)
RMAN> backup database plus archivelog;
Starting backup at 25-JAN-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=82 device type=DISK
specification does not match any archived log in the repository
backup cancelled because there are no files to backup
Finished backup at 25-JAN-14
Starting backup at 25-JAN-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00009
name=/u01/app/oracle/oradata/CDB1/EDDDC5E35CF7216DE043344EB2C0AB6F/datafile/o1_mf_sysaux_9c52fqvt_.dbf
input datafile file number=00008
name=/u01/app/oracle/oradata/CDB1/EDDDC5E35CF7216DE043344EB2C0AB6F/datafile/o1_mf_system_9c52fqt1_.dbf
input datafile file number=00010
name=/u01/app/oracle/oradata/CDB1/EDDDC5E35CF7216DE043344EB2C0AB6F/datafile/o1_mf_users_9c52hof0_.dbf
channel ORA_DISK_1: starting piece 1 at 25-JAN-14
channel ORA_DISK_1: finished piece 1 at 25-JAN-14
piece
handle=/u01/app/oracle/fast_recovery_area/CDB1/EDDDC5E35CF7216DE043344EB2C0AB6F/backupset/2014_01_25/o1_
mf_nnndf_TAG20140125T165412_9g8mo4t7_.bkp tag=TAG20140125T165412 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 25-JAN-14
7|P a g e
In this version, Oracle recommends that you frequently backup your root database as it contains critical metadata for
the whole CDB, while each PDB might fall into its own SLAs depending on the lifecycle of it or of your business needs. The
way to backup your root is connecting to the target and issue the backup database root command.
[oracle@oracleenespanol2 admin]$ rman target /
Recovery Manager: Release 12.1.0.1.0 - Production on Sat Jan 25 17:12:31 2014
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
connected to target database: CDB1 (DBID=808250731)
RMAN> backup database root;
Starting backup at 25-JAN-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=82 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=00003 name=/u01/app/oracle/oradata/CDB1/datafile/o1_mf_sysaux_9c520w6w_.dbf
input datafile file number=00001 name=/u01/app/oracle/oradata/CDB1/datafile/o1_mf_system_9c522mbz_.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/CDB1/datafile/o1_mf_undotbs1_9c524cnr_.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/CDB1/datafile/o1_mf_users_9c524bjm_.dbf
channel ORA_DISK_1: starting piece 1 at 25-JAN-14
channel ORA_DISK_1: finished piece 1 at 25-JAN-14
piece
handle=/u01/app/oracle/fast_recovery_area/CDB1/backupset/2014_01_25/o1_mf_nnndf_TAG20140125T171238_9g8nq
p8h_.bkp tag=TAG20140125T171238 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55
Finished backup at 25-JAN-14
Starting Control File and SPFILE Autobackup at 25-JAN-14
piece
handle=/u01/app/oracle/fast_recovery_area/CDB1/autobackup/2014_01_25/o1_mf_s_837796413_9g8nsfo0_.bkp
comment=NONE
Finished Control File and SPFILE Autobackup at 25-JAN-14
8|P a g e
As with previous versions of RMAN, one way to know what backups you have is with the command LIST, and with
the report has been added the record of Container ID, which will allow you to identify to which database your backup belongs
to, keeping in mind that your container database will not have a Container ID reported, it is assumed that is the ID number 1.
RMAN> list backup tag TAG20140125T164644;
List of Backup Sets
===================
BS Key Type LV Size
Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ --------------11
Full
1.34G
DISK
00:01:19
25-JAN-14
BP Key: 11
Status: AVAILABLE Compressed: NO Tag: TAG20140125T164644
Piece Name:
/u01/app/oracle/fast_recovery_area/CDB1/backupset/2014_01_25/o1_mf_nnndf_TAG20140125T164644_9g8m74qz_.bk
p
List of Datafiles in backup set 11
File LV Type Ckp SCN
Ckp Time Name
---- -- ---- ---------- --------- ---1
Full 2230796
25-JAN-14 /u01/app/oracle/oradata/CDB1/datafile/o1_mf_system_9c522mbz_.dbf
3
Full 2230796
25-JAN-14 /u01/app/oracle/oradata/CDB1/datafile/o1_mf_sysaux_9c520w6w_.dbf
4
Full 2230796
25-JAN-14 /u01/app/oracle/oradata/CDB1/datafile/o1_mf_undotbs1_9c524cnr_.dbf
6
Full 2230796
25-JAN-14 /u01/app/oracle/oradata/CDB1/datafile/o1_mf_users_9c524bjm_.dbf
BS Key Type LV Size
Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ --------------12
Full
694.53M
DISK
00:00:34
25-JAN-14
BP Key: 12
Status: AVAILABLE Compressed: NO Tag: TAG20140125T164644
Piece Name:
/u01/app/oracle/fast_recovery_area/CDB1/EDDDC5E35CF7216DE043344EB2C0AB6F/backupset/2014_01_25/o1_mf_nnnd
f_TAG20140125T164644_9g8m9svd_.bkp
List of Datafiles in backup set 12
Container ID: 3, PDB Name: PDB1
File LV Type Ckp SCN
Ckp Time Name
---- -- ---- ---------- --------- ---8
Full 2230931
25-JAN-14
/u01/app/oracle/oradata/CDB1/EDDDC5E35CF7216DE043344EB2C0AB6F/datafile/o1_mf_system_9c52fqt1_.dbf
9
Full 2230931
25-JAN-14
/u01/app/oracle/oradata/CDB1/EDDDC5E35CF7216DE043344EB2C0AB6F/datafile/o1_mf_sysaux_9c52fqvt_.dbf
10
Full 2230931
25-JAN-14
/u01/app/oracle/oradata/CDB1/EDDDC5E35CF7216DE043344EB2C0AB6F/datafile/o1_mf_users_9c52hof0_.dbf
BS Key Type LV Size
Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ --------------13
Full
680.13M
DISK
00:00:31
25-JAN-14
BP Key: 13
Status: AVAILABLE Compressed: NO Tag: TAG20140125T164644
Piece Name:
/u01/app/oracle/fast_recovery_area/CDB1/EDDDB886A1191F07E043344EB2C0BE27/backupset/2014_01_25/o1_mf_nnnd
f_TAG20140125T164644_9g8mbwz1_.bkp
List of Datafiles in backup set 13
Container ID: 2, PDB Name: PDB$SEED
File LV Type Ckp SCN
Ckp Time Name
---- -- ---- ---------- --------- ---5
Full 1732663
18-DEC-13 /u01/app/oracle/oradata/CDB1/datafile/o1_mf_system_9c5257ms_.dbf
7
Full 1732663
18-DEC-13 /u01/app/oracle/oradata/CDB1/datafile/o1_mf_sysaux_9c5257mj_.dbf
9|P a g e
10 | P a g e
database opened
11 | P a g e
Type
---------------------------VARCHAR2(513)
NUMBER
VARCHAR2(30)
NUMBER
NUMBER
VARCHAR2(9)
NUMBER
VARCHAR2(3)
NUMBER
NUMBER
NUMBER
NUMBER
NUMBER
VARCHAR2(7)
NUMBER
12 | P a g e
In 12c, the default method is the pull-based method; RMAN sends datafile data as backupsets to the auxiliary
instance and from within that instance, restores the datafiles. RMAN will create a new backupset on the source and directly
transmit (through Sql*net) to the auxiliary.
There are several factors that determine whether Backup Sets or Image Copies are used:
RMAN will only use image copies when no auxiliary channels are allocated or when the number of allocated
channels is less than the number of channels.
RMAN will use Backup Sets when the connection to the target database is established using a net service name
and any one of the following conditions is satisfied:
o The DUPLICATE ... FROM ACTIVE DATABASE command contains either the USING
BACKUPSET, USING COMPRESSED BACKUPSET, or SECTION SIZE clause.
o The number of auxiliary channels allocated is equal to or greater than the number of target channels
allocated.
oracle@oracleenespanol2.localdomain [cdb2] /home/oracle
oracle $ rman target sys/oracle@cdb1 auxiliary sys/oracle@cdb2
connected to target database: CDB1 (DBID=808250731)
connected to auxiliary database: CDB2 (not mounted)
RMAN> DUPLICATE TARGET DATABASE TO cdb2 FROM ACTIVE DATABASE
PASSWORD FILE
USING COMPRESSED BACKUPSET;
Starting Duplicate Db at 26/01/2014 22:25:43
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK
current log archived
contents of Memory Script:
{
backup as copy reuse
targetfile '/u01/app/oracle/product/12.1.0/db_1/dbs/orapwcdb1' auxiliary format
'/u01/app/oracle/product/12.1.0/db_1/dbs/orapwcdb2'
;
}
13 | P a g e
1 to new;
10 to new;
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "CDB2" RESETLOGS ARCHIVELOG
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
contents of Memory Script:
{
sql clone "alter pluggable database all open";
}
executing Memory Script
sql statement: alter pluggable database all open
Finished Duplicate Db at 26/01/2014 22:32:00
14 | P a g e
Another enhancement that was introduced in 12c is that you can now specify that you dont want the auxiliary
database to be opened when the duplication finishes (NOOPEN option). This is very helpful in environments, like Peoplesoft,
where is critical to not open a database after its been duplicated, as it will start running scripts to the production environment
and can cause errors in you application.
oracle@oracleenespanol2.localdomain [cdb2] /home/oracle
oracle $ rman target sys/oracle@cdb1 auxiliary sys/oracle@cdb2
connected to target database: CDB1 (DBID=808250731)
connected to auxiliary database: CDB2 (not mounted)
RMAN> DUPLICATE TARGET DATABASE TO cdb2
FROM ACTIVE DATABASE
PASSWORD FILE
USING COMPRESSED BACKUPSET
NOOPEN;
Starting Duplicate Db at 27/01/2014 20:24:47
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK
current log archived
contents of Memory Script:
{
backup as copy reuse
targetfile '/u01/app/oracle/product/12.1.0/db_1/dbs/orapwcdb1' auxiliary format
'/u01/app/oracle/product/12.1.0/db_1/dbs/orapwcdb2'
;
}
executing Memory Script
...
datafile 10 switched to datafile copy
input datafile copy RECID=6 STAMP=837981000 file
name=/u01/app/oracle/oradata/CDB2/datafile/o1_mf_users_9gg914ln_.dbf
Leaving database unopened, as requested
Finished Duplicate Db at 27/01/2014 20:29:58
15 | P a g e
To access the RMAN features in EM 12cR3, you need to login and go to the following location, Targets
DatabasesDB_NAMEAvailabilityBackup&Recovery. There you fill find all the Backup And Recovery Options you
have in you hand with EM12cR3
16 | P a g e
In the settings section, you can define if your backup will reside in Disk or you will use a MML, as well were you can
view the RMAN settings for your database
In the third step of this process, you will set the schedule for your backups
One Time (Immediately). - This is a one time only execution of your backup and will start as soon as you submit the
job.
One Time (Later). - This is a one time only execution of your backup and will start at the specified date.
Repeating. This job will run at the desired start time, will repeat through out the defined frequency and it can be
indefinite or end at a specified date.
17 | P a g e
The last step in this process will allow you to revise the script that is going to be executed.
Once the job is submitted, you can view the progress of the backup run
18 | P a g e
Also by clicking on the status, you can view the details of the current step.
19 | P a g e
C) Groups
Backups
One of the greatest advantages of using EM12c, is the feature of setting up and schedule backups for a whole set of
groups. This is not only available for 12c databases, it is available for 10.2 and higher versions in EM12cR3. Taking advantage
of setting up the following only once per group:
Backup Storage Settings
Recovery Catalog Settings
Backup Type
Frequency
If you are using Administrative Groups, this will make the task even easier, as you would setup the Backup
Configuration and Schedule Backup for each of your administrative group and every time you add a new target to an
administrative group, it will automatically use these properties, without worrying about them.
To use this, you will need to have a group or an administrative group created, for this example, I have an admistrative
group defined by Lifecycle StatusLocation, and will do the setup for the group Prod-Mexi-Grp
To access this group, in EM12cR3, you need to go to TargetsGroupsViewExpand All and click on ProdMexi-Grp. Once you have accessed the Prod-Mexi-Grp page, you will see several dashboards that will provide you the Status,
general Information, Incidents Job Activities, etc
To start the group backup setup, you need to define the backup configuration first for this group; you need to go to
Prod-Mexi-GrpGroupBackup Configurations
20 | P a g e
21 | P a g e
Once you have setup your Backup Configurations, you need to go to Prod-Mexi-GrpGroupSchedule Backup,
where you will choose the Backup Scope, that can only be in EM12cR3:
Whole Database
All Recovery Files on Disk. - Tape Backup
As well you can define if you want to include all of the databases in the group, or just a select number of databases.
22 | P a g e
You will now need to define the Database credentials for the whole group, and as well the OS Credentials, so for this
to work, you will need to have the same OS user password as well as the same DB User password across all the targets that are
going to be backed up as a group.
In the options stage of this process, you will define options of your backup
Backup Type. - Full/Incremental
Backup Mode. - Hot/Cold
Maximum Files per Backup Set
Section Size
23 | P a g e
In the settings section, you will choose the Media Destination and the Backup Configuration that was created
previously, MEXICO_PROD_BACKUPS.
Before finishing, you will setup the frequency and start time of these backups.
In the last part, similar to other backup jobs, you get the opportunity to review the job , and if you are set with the
Backup Procedure, you hit submit and you will see an informational banner that the job was submitted.
You can click on the link of the submitted procedure and it will take you to a detail page, where you will see the status
of all your backups, as well as the logs of each of the steps that were submitted. Another way to see the jobs that have been
run for this group is to go to EnterpriseProvisioning and Patching Procedure ActivityAdvanced
SearchTypeBackup and Restore, and if needed filter by the name you gave it above.
24 | P a g e
CONCLUSION
In RMAN 12c there are great new features that will help you if you are ever faced with a disaster, these new features
will allow you to reduce your mean time to recover (MTTR) and as well ease your tasks in duplicating your databases. If you
incorporate EM12c into your backup strategy, you can simplify your backup administration tasks, especially when you have
correctly setup your administrative groups and you have several hundred databases within those groups.
REFERENCES
a) Oracle Database Backup and Recovery User's Guide 12c Release 1 (12.1)
From http://docs.oracle.com/cd/E16655_01/backup.121/e17630/toc.htm
b) RMAN Recipes for Oracle Database 12c: A Problem-Solution Approach, 2nd Ed.
Darl Kuhn, Sam Alapati, and Arup Nanda (2013) Apress
c) Back Up a Thousand Databases Using Enterprise Manager Cloud Control 12c
From http://www.oracle.com/technetwork/articles/oem/havewala-rman-em12c-2104270.html
d) My Oracle Support Notes :
a. 1534487.1
b. 1521005.1
c. 1521524.1
d. 1401574.1
e. 1521075.1
e) RMAN | Pythian - Data Experts Blog
from http://www.pythian.com/blog/tag/rman/
25 | P a g e