aman sharma rman_12c_new_features_sangam2013

49
What’s New in 12c RMAN? Aman Sharma

Upload: aman-sharma

Post on 15-Jan-2015

1.298 views

Category:

Technology


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Aman sharma RMAN_12c_new_features_sangam2013

What’s New in 12c RMAN?

Aman Sharma

Page 2: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 2

Introduction to pre 12.1 Databases

Introduction to 12c Multitenant database

Using RMAN in multitenant environment

Using RMAN for Table-mode recovery

Enhanced support for SQL statements

Separation of duties using SYSBACKUP role

12c Enhancements for Multi-section Backups & Database Duplication

12c Enhancements for Cross platform Data transport

Q & A

Presentation Agenda

Page 3: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma

About 12+ years using Oracle Database

Oracle ACE

Frequent Contributor to OTN Database forum(Aman….)

Oracle Certified

Sun Certified

Twitter : @amansharma81 *

Oracle Blog : http://blog.aristadba.com *

Email: [email protected]

Aman Sharma- Sangam 2013 3

Who Am I?

Page 4: Aman sharma RMAN_12c_new_features_sangam2013

My Books

Aman Sharma- Sangam 2013 4

Page 5: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 5

Introduction to pre 12.1 Databases

Introduction to 12c Multitenant database architecture

Using RMAN in multitenant environment

Using RMAN for Table-mode recovery

Enhanced support for SQL statements

Separation of duties using SYSBACKUP role

12c Enhancements for Multi-section Backups & Database Duplication

12c Enhancements for Cross platform Data transport

Q & A

Presentation Agenda

Page 6: Aman sharma RMAN_12c_new_features_sangam2013

SALES

Shared Pool

LGWR DBWR PMON

Buffer Cache

System

Metadata

User

Metadata User Data

Instance

Database

CTL

SYSTEM SYSAUX UNDO

TEMP FLBLOG BKUP

ARCH

ORL

SALES App

11g Database Architecture(simplified)

Aman Sharma- Sangam 2013 6

Page 7: Aman sharma RMAN_12c_new_features_sangam2013

SALES

Shared Pool

LGWR DBWR PMON

Buffer Cache

System

Metadata

User Metadata User Data

HR

Shared Pool

LGWR DBWR PMON

Buffer Cache

System

Metadata

User Metadata User Data

CTL

UNDO TEMP

ORL

SYSTEM SYSAUX SALES

ARCH

CTL

UNDO TEMP

ORL

SYSTEM SYSAUX HR

ARCH

SALES App HR App

The More The Merrier?

Aman Sharma- Sangam 2013 7

Page 8: Aman sharma RMAN_12c_new_features_sangam2013

• The databases are created for each client/account • Each database is a tenant at the server • Each database would need its own system

resources • Consolidation, if the number of db’s is large,

becomes a major challenge • Schemas are used to ensure privacy • Provisioning takes a huge time • Patching, not only becomes complex but also

takes a huge time

Aman Sharma- Sangam 2013 8

Not really!!

Page 9: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 9

Which Is Better?

Page 10: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 10

Introduction to pre 12.1 Databases

Introduction to 12c Multi-tenant database architecture

Using RMAN in multi-tenant environment

Using RMAN for Table-mode recovery

Enhanced support for SQL statements

Separation of duties using SYSBACKUP role

12c Enhancements for Multi-section Backups & Database Duplication

12c Enhancements for Cross platform Data transport

Q & A

Presentation Agenda

Page 11: Aman sharma RMAN_12c_new_features_sangam2013

• First database release made for cloud and consilidation

• Using 12c Multitenant architecture, DBA’s can create private database clouds

• Enables database to be used as DbaaS

• Much efficient resource sharing among databases

• Reduced overhead for memory and storage

• Ensures privacy and enables role separation for database management

• Rapid provisioning and cloning

• Patching and upgrading becomes easier, less time consuming

Aman Sharma- Sangam 2013 11

12c Multi-tenant Database

Page 12: Aman sharma RMAN_12c_new_features_sangam2013

• Fully RAC compatible

• Compatible with non-CDB databases

• Using Cloud Control 12c and SQL Developer, management of CDB’s and PDB’s become much easier

• Ease in performance troubleshooting

• Easy migration of PDB’s between different environments i.e. database releases

• Complete control over resource management using Resource Manager for both CDB and PDB

• Manage many databases as one!!

Aman Sharma- Sangam 2013 12

12c Multi-tenant Database (cont.)

Page 13: Aman sharma RMAN_12c_new_features_sangam2013

CDB Instance

ROOT container

SALES

PDB

HR

PDB

FINANCE

PDB

CDB Database

SEED

Multi-tenant Database Architecture(simplified)

CON_ID=1 CON_ID=2

CON_ID=4 CON_ID=3

CON_ID=5

CON_ID=0

Aman Sharma- Sangam 2013 13

Page 14: Aman sharma RMAN_12c_new_features_sangam2013

• A multitenant CDB database always contains – ROOT container – SEED container

• A CDB may also contain – PDB container

• Within one CDB, there can be maximum 252 PDB’s(for Enterprise Edition)

• Crossing the threshold throws ORA-65010

• Within one CDB,one PDB is allowed for free. More than 1 would require you to pay $

• For Standard Edition, only one Pluggable database is allowed

• An Instance is allocated for the whole CDB database

• V$CONTAINERS

Aman Sharma- Sangam 2013 14

Containers in Multitenant Database

Page 15: Aman sharma RMAN_12c_new_features_sangam2013

SGA PDB1

LGWR DBWR PMON

SGA PDB2

Alert Log SPFILE

CDB Instance

CDB Instance

Maintained by SYS user

Allocated for the CDB only

Maintained by CDB SPfile/PFILE

enable_pluggable_database=TRUE

No PDB specific SPFILE/PFILE

Parameter(s) changed at PDB level don’t go up to their CDB database

Aman Sharma- Sangam 2013 15

Page 16: Aman sharma RMAN_12c_new_features_sangam2013

CDB Database

CDB$ROOT

OBJ$ TAB$ USER$

PDB$SEED

CTL

ORL

SYSTEM SYSAUX UNDO

TEMP FLBLOG BKUP

ARCH

System Metadata

Root Container

RSRCMGR

CON_ID=2

CON_ID=1

CON_ID=0

Aman Sharma- Sangam 2013 16

Page 17: Aman sharma RMAN_12c_new_features_sangam2013

Root Container

• The very first tenant of the multitenant database

• CDB$ROOT(predefined)

• Contains data files, online redo logs, control files, Undo

• Contains system metadata

• Contains information about underlying PDB’s

• Contains common users

• Shouldn’t contain user data

• Resource Manager-for both CDB and underlying PDB’s

• Managed by a Container DBA(CDBA)

• Backup support by RMAN

Aman Sharma- Sangam 2013 17

Page 18: Aman sharma RMAN_12c_new_features_sangam2013

PSDB$SEED

SYSTEM SYSAUX TEMP

Seed Container

Default Pluggable database

Created at the time of creation

of the multitenant database

Named as PDB$SEED

Acts as a template for creating

pluggable databases in the

future

Users/DBA’s can’t create and

modify objects in the seed

database

Can not be deleted

One CDB contains only one

SEED container

Backup support by RMAN

Aman Sharma- Sangam 2013 18

CON_ID=2

Page 19: Aman sharma RMAN_12c_new_features_sangam2013

CDB Database

CDB$ROOT

OBJ$ TAB$ USER$

PDB$SEED

CTL

ORL

SYSTEM SYSAUX UNDO

TEMP FLBLOG

ARCH

System Metadata

OBJ$ TAB$ USER$

USER Metadata

SYSTEM

TEMP SYSAUX USERS SALES

SALES

PDB

Country

Customers

USER

Data

Metadata Link

SYSTEM SYSAUX TEMP

Pluggable Container/DB(PDB)

RSRCMGR

RSRCMGR

Aman Sharma- Sangam 2013 19

Page 20: Aman sharma RMAN_12c_new_features_sangam2013

Pluggable Container

• User defined and created

• Explicitly named

• Stores user-data & user-metadata

• For applications, appear as a normal database

• Contains local users-specific to exactly one PDB

• PDB specific Resource Manager

• 252 Pluggable containers maximum are allowed in one CDB

• Managed by PDB DBA(PDBA)

• Linked with other PDB’s using inter-PDB DB link

• V$PDBS, DBA_PDBS

Aman Sharma- Sangam 2013 20

Page 21: Aman sharma RMAN_12c_new_features_sangam2013

CDB Database

PSDB$SEED

SYSTEM SYSAUX TEMP

SGA PDB1

LGWR

SGA PDB2

CDB Instance

DBWR SMON

CTL

UNDO TEMP

ORL

SYSTEM SYSAUX

FLBL

ARCH

CDB$ROOT

System Metadata

OBJ$ TAB$ USER$

OBJ$

USER Metadata

SALES

PDB

Country

Customers

USER

Data

TEMP SYSTEM SYSAUX SALES

TAB$ USER$

OBJ$

USER Metadata

HR

PDB

DEPT

EMP

USER

Data

TEMP SYSTEM SYSAUX HR

TAB$ USER$

Metadata Link

Inter PDB DB Link

SALES App HR App

RSRCMGR

RSRCMGR

RSRCMGR

Aman Sharma- Sangam 2013 21

Page 22: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 22

Are You Thinking?

Page 23: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 23

Well, Don’t Forget!!

Page 24: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 24

Introduction to pre 12.1 Databases

Introduction to 12c Multi-tenant database architecture

Using RMAN in multi-tenant environment

Using RMAN for Table-mode recovery

Enhanced support for SQL statements

Separation of duties using SYSBACKUP role

12c enhancements for multi-section backups & database duplication

12c enhancements for Cross platform Data transport

Q & A

Presentation Agenda

Page 25: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 25

RMAN in Multitenant Environment

RMAN Non-CDB

PDB

CDB$ROOT

CDB

Page 26: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 26

BACKUP command-12c!

RMAN>BACKUP DATABASE;

• Backup of whole database(CDB/non-CDB)

RMAN>BACKUP PLUGGABLE DATABASE HRPDB;

• Backup of pluggable database(s)

RMAN>BACKUP PLUGGABLE DATABASE ROOT;

• Backup of ROOT container database

RMAN> BACKUP TABLESPACE HRPDB:HR_TBS;

• Partial backup of pluggable database

Page 27: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 27

RECOVER command -12c!

RMAN>RECOVER DATABASE;

• To recover whole database(CDB/non-CDB)

RMAN>RECOVER PLUGGABLE DATABASE HRPDB;

• To recover pluggable database(s)

RMAN>RECOVER PLUGGABLE DATABASE ROOT;

• To recover ROOT container database

RMAN>RECOVER TABLESPACE HRPDB:HR_TBS;

• TO recover partially pluggable database

Page 28: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 28

Introduction to pre 12.1 Databases

Introduction to 12c Multitenant database

RMAN in multitenant environment

RMAN for Table-mode recovery

Enhanced support for SQL statements

Separation of duties using SYSBACKUP role

12c Enhancements for Multi-section Backups & Database Duplication

12c Enhancements for Cross platform Data transport

Q & A

Presentation Agenda

Page 29: Aman sharma RMAN_12c_new_features_sangam2013

• Using Tablespace Point-in-time

recovery(TSPITR)

• Using Database Point-in-time

recovery(DBPITR)

• Using Recycle Bin

• Using Flashback Table command

Sounds good, so why we need anything new?

Aman Sharma- Sangam 2013 29

Performing Recovery of Table-pre 12c

You know it already!

Page 30: Aman sharma RMAN_12c_new_features_sangam2013

• Using DBPITR for a one or just a few tables is just like-replacing engine too along with the flat wheel of your car!

• For recovery of a single table, TSPITR is also not much different from DBPITR .

• Both DBPITR & TSPITR move the entire database or tablespace back in the time.

• For TSPITR, the tablespace must be self-contained.

• Table dropped with PURGE option can’t be recovered using Recycle Bin.

• Flashback Table command only works if there is no structural change done over the table.

• If there is no sufficient Undo data available, Flashback Table won’t work.

Aman Sharma- Sangam 2013 30

Limitations in table recovery using old techniques

Page 31: Aman sharma RMAN_12c_new_features_sangam2013

• New feature in RMAN 12c

• Enables the recovery of table(s) and table-partition(s) using RMAN

• Uses database backups(Backup Sets) and archived redo logs

• Database remains online(read-write) while recovery proceeds

• Happens at an auxiliary location

• Uses an automatically created & maintained Auxiliary instance

• Other database objects remain untouched and accessible

• Requires that the database must be – Archive log mode – COMPATIBLE=12.0 – OPEN_MODE=READ WRITE

Aman Sharma- Sangam 2013 31

12c RMAN Table-mode Recovery

Page 32: Aman sharma RMAN_12c_new_features_sangam2013

Recover Table(along with options)

Backup is located

Auxiliary instance creation at the

mentioned destination

Recovery gets performed using

the backups at the auxiliary location

Automatic creation of EXPDP Dump File

containing the recovered table

Automatic Import of the recovered

table in the database

Auxiliary instance, DUMP file are

removed

RMAN renames the recovered

table(optional)

Table Recovery is complete!

Aman Sharma- Sangam 2013 32

RMAN Table Recovery-Process Flow

Page 33: Aman sharma RMAN_12c_new_features_sangam2013

• Recovery Point-in-Time options

– Until Time(requires NLS_LANG & NLS_DATE_FORMAT) – Until SCN – Until Sequence

• Optional Configurations

– AUXILIARY DESTINATION: • Path for the auxiliary instance creation

– DUMP FILE • Name of the dump file which would contain the recovered table

– DATAPUMP DESTINATION • OS path for the export dump file

– NOTABLEIMPORT • To not do the automatic import of the recovered table in the

target database

– REMAP TABLE/TABLESPACE • To rename the recovered table or to move to a new tablespace

Aman Sharma- Sangam 2013 33

RMAN Table Recovery-Options

Page 34: Aman sharma RMAN_12c_new_features_sangam2013

RMAN> RECOVER TABLE AMAN.TESTTAB OF PLUGGABLE DATABASE APDB UNTIL TIME "to_date('2013-09-13:22:30:00','YYYY-MM-

DD:HH24:MI:SS')" AUXILIARY DESTINATION

'/tmp' DATAPUMP DESTINATION '/tmp' DUMP

FILE 'rtab_dump.dmp';

RMAN> RECOVER TABLE AMAN.TESTTAB OF PLUGGABLE DATABASE APDB UNTIL SCN 2235227 AUXILIARY DESTINATION

'/tmp/aux' DATAPUMP DESTINATION

'/tmp/dump/' DUMP FILE 'rtab_dump.dmp';

Aman Sharma- Sangam 2013 34

RMAN Table Recovery-Examples

Page 35: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 35

RMAN Table Recovery-Limitations

• Tables and table partitions belonging to SYS schema can not be recovered

• Tables and table partitions belonging to the tablespaces SYSTEM and SYSAUX can not be recovered

• Tables and table partitions on standby databases can not be recovered

• Tables with named NOT NULL constraints can not be recovered with the REMAP option

Page 36: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 36

Introduction to pre 12.1 Databases

Introduction to 12c Multitenant database

RMAN in multitenant environment

RMAN for Table-mode recovery

Enhanced support for SQL statements

Separation of duties using SYSBACKUP role

12c Enhancements for Incremental Backups & Database Duplication

12c Enhancements for Cross platform Data transport

Q & A

Presentation Agenda

Page 37: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 37

Support for SQL statements in RMAN

• RMAN of versions before 12.1 requires SQL

prefix

• From 12.1 onwards, no SQL prefix is required

• DESC[RIBE]command is supported natively

RMAN> SQL ‘alter system archive log current’;

RMAN> select INSTANCE_NAME,STATUS from V$INSTANCE;

RMAN> DESC HR.DEPARTMENTS

Page 38: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 38

Introduction to pre 12.1 Databases

Introduction to 12c Multi-tenant database architecture

Using RMAN in multi-tenant environment

Using RMAN for Table-mode recovery

Enhanced support for SQL statements

Separation of duties using SYSBACKUP role

12c Enhancements for Multi-Section Backups & Database Duplication

12c Enhancements for Cross platform Data transport

Q & A

Presentation Agenda

Page 39: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 39

SYSBACKUP Role in 12c

• New predefined role-exclusively for backup/recovery operations

• Enables to create separation of duties for different database administration related tasks – SYS user with the SYSDBA role, for complete control

– Non-default user with the DBA role, for day-to-day activities and normal usage

– Non-default user with the SYSBACKUP Role-for backup/recovery related tasks

• Privileges included in the SYSBACKUP role (partial list) – STARTUP/SHUTDOWN – Create Control File, SPFILE, PFILE – FLASHBACK DATABASE

• Does not include SELECT ANY TABLE privilege

• Created with the database installation

• Using SYSBACKUP role in the OS authentication logs you as (new) SYSBACKUP schema

• Best practice- create a new, non-default schema with the SYSBACKUP role assigned to it, for both CDB and PDB containers

Page 40: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 40

Introduction to pre 12.1 Databases

Introduction to 12c Multi-tenant database architecture

Using RMAN in multi-tenant environment

Using RMAN for Table-mode recovery

Enhanced support for SQL statements

Separation of duties using SYSBACKUP role

12c Enhancements for Multi-section Backups & Database Duplication

12c Enhancements for Cross platform Data transport

Q & A

Presentation Agenda

Page 41: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 41

Multi-section Backup Enhancements

• Multi-section backups, in the previous release

– For Backup Set format only

– For full backups only

• Since 12c onwards, Multi-section backups are supported for

– Backup Set & Image Copy formats

– Full & Incremental Backups

• Applies only to the data files

• Benefits remain the same-faster backups/restores

Page 42: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 42

RMAN DUPLICATE command Enhancements

• 11.1 introduced ACTIVE DATABASE DUPLICATION – Uses Image Copies

– Known as Push method

• 11.2 enhanced the same – Connection to the target database made optional

• 12c further enhances the DUPLICATE command – Support for Backup Sets

– Termed as Pull method

• Support for – Compressed backup sets

– Encryption

– Multi-section backups

– NOOPEN option

Page 43: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 43

Introduction to pre 12.1 Databases

Introduction to 12c Multi-tenant database architecture

Using RMAN in multi-tenant environment

Using RMAN for Table-mode recovery

Enhanced support for SQL statements

Separation of duties using SYSBACKUP role

12c Enhancements for Multi-section Backups & Database Duplication

12c Enhancements for Cross platform Data transport

Q & A

Presentation Agenda

Page 44: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 44

Cross-Platform Transport Enhancements

• 8i introduced the feature of Transport Tablespace – Databases, source and destination , must match in the block size

– OS must be the same across the source and target databases

• 9i enhanced the same feature with Multiple Block Size support – OS still must be the same across the source and target database

• 10.1 introduced Cross Platform Tablespace Feature – Uses Image Copies

– Convert DATAFILE/TABLESPACE

• 10.2 enhanced the same feature with the option of Cross Platform Database – Convert DATABASE

• 12c further enhances the Cross Platform Transport – Support for Backup Sets

• Support for – Compressed backup sets

– Multi-section backups

– Allows inconsistent tablespace backups

• Completely supported for Multitenant environment

Backup sets created for cross platform transport are NOT cataloged in the control file

Page 45: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 45

12c Cross Platform Transport-Going Deeper

• Prerequisites – COMPATIBLE = 12.0 – Source Database= Read Only (for Cross Platform Database

transport)

– Source Database= Read Write(for Cross Platform Tablespace transport)

• New Options – To perform Cross Platform database backup using Backup Sets

• BACKUP To Platform(conversion would be done on the source host)

• BACKUP For Transform(conversion would be done on the target host)

– To restore the cross platform database backup over the destination host • RESTORE FOREIGN

– To perform the Cross Platform tablespace backup • BACKUP To Platform….DATAPUMP

• BACKUP For Platform….DATAPUMP

– To perform the inconsistent tablespace backup • ALLOW INCONSISTENT

Page 46: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 46

Cross Platform Tablespace Inconsistent Backups

• Cross Platform Tablespace transport in prior versions – Source Tablespace= Read Only

– Source Database= Read Write

– Can be used right away to plug-in the tablespace at the destination database

– Tablespace being in read-only mode may cause application a downtime

• Cross Platform Tablespace transport using Inconsistent backup – Uses new option ALLOW INCONSISTENT – The source tablespace remains ONLINE (READ ONLY) get host)

– The resultant backup is inconsistent as DML’s keep on hitting the data file

– The foreign data file, resulted during this backup, can not be used directly into the destination database

– Inconsistent data file is made consistent using the cross platform incremental backups

– A base level 0 backup and subsequent level 1 backups are created and applied over the destination database

– These backups are taken when the tablepsace is online

– A final level 1 backup is taken with the tablespace as read only

– RESTORE FOREIGN TABLESPACE/DATAFILE – RECOVER FOREIGN DATAFILE COPY

Page 47: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 47

12c Cross Platform Transport-Example

RMAN>BACKUP To Platform ‘Linux x86 64-bit’ Format ‘/tmp/bkup_trans.bck’ DATABASE;

• To perform the conversion on the source host RMAN>BACKUP For Transport Format

‘/tmp/bkup_trans.bck’ DATABASE;

• To perform the conversion on the target host RMAN>RESTORE Foreign Database to NEW from BACKUP

SET ‘/tmp/bkup_trans.bck’;

• To restore the backup in the target host

RMAN>BACKUP For Transport ‘/tmp/bkup_tbstrans.bck’

DATAPUMP ‘/tmp/tbs.dmp’ TABLESPACE USERS;

• To perform the conversion for tablespace on the source host

Page 48: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 48

Final words!

Usually when it’s about RMAN, response is

or

But remember, RMAN is oracle database’s “the tool” for performing backups and recovery tasks Have been around from a loong time(since 8.0.3) FREE!! Getting improved and more feature-rich with almost every release Worth giving a try and implemented so give RMAN a chance!

Page 49: Aman sharma RMAN_12c_new_features_sangam2013

Aman Sharma- Sangam 2013 49

Thank You!