Upload
gustavo-rene-antunez
View
1.682
Download
3
Tags:
Embed Size (px)
DESCRIPTION
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 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.
Citation preview
RMAN in 12c: The Next Generation
Presented by : Gustavo René Antúnez Oracle DBA The Pythian Group April, 2014
About Pythian • Recognized Leader:
– Global industry-leader in remote database administration services and consulting for Oracle, Oracle Applications, MySQL and Microsoft SQL Server
– Work with over 250 multinational companies such as Forbes.com, Fox Sports, Nordion and Western Union to help manage their complex IT deployments
• Expertise: – One of the world’s largest concentrations of dedicated, full-time DBA
expertise. Employ 9 Oracle ACEs/ACE Directors.
– Hold 7 Specializations under Oracle Platinum Partner program, including Oracle Exadata, Oracle GoldenGate & Oracle RAC
• Global Reach & Scalability: – Around the clock global remote support for DBA and consulting, systems
administration, special projects or emergency response
About Me – Oracle DBA – Part of the First Oracle
Associate Group • Started with Version 9.2 in 2004
– With The Pythian Group for the last year
– Movie Fanatic – Music Lover – Bringing the best from México
(Mexihtli) to the rest of the world and in the process photographing it :)
– reneantunez.com – @grantunez
• #CLV14
Where do I come from?
How did I get to be a DBA
Happiest Job of 2014!*
*http://www.forbes.com/sites/susanadams/2014/03/20/the-happiest-and-unhappiest-jobs-in-2014/
Work-life balance
Relationship with boss and co-
workers
Daily tasks Job
resources
Field will grow by 15% between
2012 and 2022 DBA can be the
key driver of success
What is a Pluggable Database? • Container database (CDB) is an Oracle
database that includes zero, one, or many customer-created Containers or Pluggable Databases.
• A pluggable Database (PDB) is a user-created container holding the data and code for your specific applications
What is a Pluggable Database?
Root (CDB$ROOT)
CDB
hrpdb salespdb
Seed (PDB$SEED)
CDB Administrator
Sales Application
HR Application
PDB Administrator for hrpdb
PDB Administrator for salespdb
Logical
Physical Database
Control Files
Data Files
Online Redo Log
10101 10101 Archived Redo Log
Flashback Log
What is RMAN?
• Oracle utility to perform backup and recovery, available since version 8
RMAN Utility
Channel
Target DB
Server Session
MML
DISK
Executable found in $ORACLE_HOME/bin recover.bsq (library file)
What do you need to backup? • Critical
– Data files – Control files – Archived Redo logs (If Inconsistent Backup taken) – Root DB (12c)
• In line with the DR strategy – Parameter File (pfile or spfile) – Block Change Tracking File – ORACLE_HOME/GRID_HOME/ configuration files – tnsnames.ora / listener.ora/ sqlnet.ora
Not through RMAN
How does an RMAN backup work?
Datafiles 1 MB 1 MB
1 MB 1 MB
1 MB 1 MB
1 MB 1 MB
1 MB 1 MB
1 MB 1 MB
1 MB 1 MB
1 MB 1 MB
Input I/O Buffers
Validation Compression Encryption
1 MB 1 MB
1 MB 1 MB
Channel
Output Buffers Backup Piece
1
2
3
4
Read Phase Copy Phase Write Phase
Benefits of the RMAN Catalog
RMAN
Target DB Target
DB Target DB
Catalog DB
Repository for multiple incarnations of a single target metadata about RMAN backups
Store RMAN backup scripts
Another Database to keep control off
It can keep backup history longer than the controlfile can keep it (Depends on value of
CONTROL_FILE_RECORD_KEEP_TIME)
Centralized Reporting Purposes
What to consider before configuring your RMAN backups
• Fast Recovery Area (FRA)
Size DB Backup FRA Disk
Quota
Size of Incremental
BU
Size of (n+1) days of Archived Redo logs
Size of controlfile
Size of Online Redo* # of Groups
Size of Flashback logs
DB_RECOVERY_FILE_DEST_SIZE
DB_RECOVERY_FILE_DEST
Useful views • V$FLASH_RECOVERY_AREA_USAGE • V$RECOVERY_FILE_DEST
What to consider before configuring your RMAN backups
• Catalog or no catalog Database • ARCHIVELOG vs NOARCHIVELOG • CONTROL_FILE_RECORD_TIME_KEEP • Set NLS parameters accordingly
– Values from view V$NLS_PARAMETERS – NLS_DATE_FORMAT='DD-MON-YYYY
HH24:MI:SS’
– NLS_LANG=american_america.we8iso8859p1
Configuring RMAN Default Settings
• ������CONFIGURE DEFAULT DEVICE TYPE TO DISK; – When formatting your output, be sure to always include the DBID
• ���CONFIGURE CONTROLFILE AUTOBACKUP ON; • ���CONFIGURE ARCHIVELOG DELETION POLICY TO BE
BACKED UP 3 TIMES TO DISK;
%I %d_%I_%s_%T_%t
%U
12c New features
• Support for multitenant container databases and pluggable databases
• SYSBACKUP Privilege • SQL Interface Improvements • Active Database Duplication Improvements • Recovering Tables and Table Partitions from RMAN
Backups
SYSBACKUP Privilege
• ���Can connect with the “as sysbackup” • OS System Groups (OSDBA or OSBACKUPDBA) • For Windows need to have set
SQLNET.AUTHENTICATION_SERVICES=(NTS)
CONNECT / AS SYSBACKUP
CONNECT /@cdb1 AS SYSBACKUP orapwd FILE='orapwcdb1' ENTRIES=5 DBUNIQUENAME='cdb1' SYSBACKUP=y
SYSBACKUP Privilege
• Operations Allowed : – STARTUP/ SHUTDOWN – ALTER DATABASE/ SYSTEM/ SESSION/ TABLESPACE – FLASHBACK DATABASE/ RESUMABLE – DROP DATABASE/ TABLESPACE/ RESTORE POINT (including
GUARANTEED restore points)
SYSBACKUP Privilege
• Operations Allowed : – SELECT
• X$ tables (that is, the fixed tables) • V$ and GV$ views (that is, the dynamic performance views) • APPQOSSYS.WLM_CLASSIFIER_PLAN • SYSTEM.LOGSTDBY$PARAMETERS
– EXECUTE • SYS.DBMS_BACKUP_RESTORE • SYS.DBMS_RCVMAN • SYS.DBMS_DATAPUMP
SUPPORT FOR MULTITENANT CONTAINER DATABASES AND PLUGGABLE DATABASES
• ���Provides full backup and recovery support, not only for your container database, but also for one or all of your pluggable databases
• Backup of the CDB will include
– CDB$ROOT, PDB$SEED and ALL PDBs
• Backup of the PDB will include – Only the PDB connected to – Important to have control file autobackup on
SUPPORT FOR MULTITENANT CONTAINER DATABASES AND PLUGGABLE DATABASES • Backing up the CDB and all of its PDBs
rman target sys/oracle@cdb1 connected to target database: CDB1 (DBID=808250731)
RMAN> backup database plus archivelog;
• Backing up just one PDB rman target sys/oracle@pdb1 connected to target database: CDB1 (DBID=808250731)
RMAN> backup database;
• Backing up the root rman target sys/oracle@cdb1 connected to target database: CDB1 (DBID=808250731)
RMAN> backup database root;
• Restoring a PDB
oracle $ rman target sys/oracle@cdb1
connected to target database: CDB1 (DBID=808250731)
RMAN> RESTORE PLUGGABLE DATABASE PDB1;
RMAN> RECOVER PLUGGABLE DATABASE PDB1;
RMAN> ALTER PLUGGABLE DATABASE PDB1 OPEN;
SUPPORT FOR MULTITENANT CONTAINER DATABASES AND PLUGGABLE DATABASES
• Be careful when dropping a PDB RMAN> drop pluggable database PDB1;
Statement processed
RMAN> RESTORE PLUGGABLE DATABASE PDB1;
Starting restore at 13/02/2014 11:18:26
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=41 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 02/13/2014 11:18:27
RMAN-06813: could not translate pluggable database PDB1
SUPPORT FOR MULTITENANT CONTAINER DATABASES AND PLUGGABLE DATABASES
• Viewing the Definition of your Containers connected to target database: CDB1 (DBID=808250731) RMAN> report schema; =========================== File Size(MB) Tablespace RB segs Datafile Name ---- -------- -------------------- ------- ------------------------ 1 790 SYSTEM *** /u01/app/oracle/oradata/CDB1/datafile/
o1_mf_system_9c522mbz_.dbf 5 250 PDB$SEED:SYSTEM *** /u01/app/oracle/oradata/CDB1/datafile/
o1_mf_system_9c5257ms_.dbf … 7 590 PDB$SEED:SYSAUX *** /u01/app/oracle/oradata/CDB1/datafile/
o1_mf_sysaux_9c5257mj_.dbf 8 260 PDB1:SYSTEM *** /u01/app/oracle/oradata/CDB1/
EDDDC5E35CF7216DE043344EB2C0AB6F/datafile/o1_mf_system_9c52fqt1_.dbf
SUPPORT FOR MULTITENANT CONTAINER DATABASES AND PLUGGABLE DATABASES
• Viewing the definition of your backups 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_.bkp 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 …
SUPPORT FOR MULTITENANT CONTAINER DATABASES AND PLUGGABLE DATABASES
• Viewing the definition of your backups (continued) … 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 … 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
SUPPORT FOR MULTITENANT CONTAINER DATABASES AND PLUGGABLE DATABASES
Recovering Tables and Table Partitions from RMAN Backups
Target Database
DB in read-write mode
ARCHIVELOG MODE
RMAN backup as existed at the
point in time
1 Gigabyte extra in memory for the auxiliary
database
12.1, you need to use a
SERVICE_NAME
Recovering Tables and Table Partitions from RMAN Backups
oracle $ rman target sys/oracle@cdb1 connected to target database: CDB1 (DBID=808250731) RMAN> RECOVER TABLE 'TEST'.'RENE' OF PLUGGABLE DATABASE PDB1 2> UNTIL TIME "to_date('26-JAN-2014 17:08:20','dd-MON-yyyy hh24:mi:ss')" 3> AUXILIARY DESTINATION '/u01/app/oracle/exports' 4> REMAP TABLE 'TEST'.'RENE':'RENE_RCV';
SQL Interface Improvements • You no longer need to enclose the SQL command
in quotes oracle $ rman target sys/oracle@cdb1 connected to target database: CDB1 (DBID=808250731) RMAN> select name from v$database; NAME --------- CDB1 RMAN> select a.con_id,a.file_id,substr(a.file_name, instr(a.file_name, '/',-1)+1) file_name from cdb_data_files a; CON_ID FILE_ID FILE_NAME ---------- ---------- ------------------------------------------------------------ 2 5 o1_mf_system_9c5257ms_.dbf … 9 rows selected.
Active Database Duplication Improvements
• It is defined as a duplicate database that is created over a network without restoring backups
Source Host
Source Database
Source Instance
Auxiliary Instance Duplicate
Database
Destination Host push-based
active duplication
pull-based active duplication
Connect Target
Connect Auxiliary
RMAN Client
Active Database Duplication Improvements
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
Active Database Duplication Improvements
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' ; } … contents of Memory Script: { … shutdown clone immediate; startup clone force nomount restore clone from service 'cdb1' using compressed backupset primary controlfile; alter clone database mount; } … Starting restore at 26/01/2014 22:25:52 allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: using compressed network backup set from service cdb1 channel ORA_AUX_DISK_1: restoring control file channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03 output file name=/u01/app/oracle/oradata/CDB2/controlfile/o1_mf_9c524smo_.ctl
EM12c and RMAN 12c • You can manage most of RMAN’s features via a GUI
interface. • Using EM 12c also removes the need to continuously
maintain RMAN scripts and crontab jobs • View a more friendly report of your backups • You need to have a credentialed OS account • Targets à Databases à DB_NAME àAvailability
àBackup&Recovery.
Scheduling a Full Backup
Viewing Backup Reports
RMAN> list backup tag TAG20140212T191237; List of Backup Sets =================== BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ ------------------- 67 Full 1.88G DISK 00:02:41 12/02/2014 19:15:19 BP Key: 67 Status: AVAILABLE Compressed: NO Tag: TAG20140212T191237 Piece Name: /u01/app/oracle/fast_recovery_area/CDB1/backupset/2014_02_12/o1_mf_nnndf_TAG20140212T191237_9hrbjrqd_.bkp List of Datafiles in backup set 67 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- ------------------- ---- 1 Full 3220602 12/02/2014 19:12:38 /u01/app/oracle/oradata/CDB1/datafile/o1_mf_system_9c522mbz_.dbf 3 Full 3220602 12/02/2014 19:12:38 /u01/app/oracle/oradata/CDB1/datafile/o1_mf_sysaux_9c520w6w_.dbf 4 Full 3220602 12/02/2014 19:12:38 /u01/app/oracle/oradata/CDB1/datafile/o1_mf_undotbs1_9c524cnr_.dbf 6 Full 3220602 12/02/2014 19:12:38 /u01/app/oracle/oradata/CDB1/datafile/o1_mf_users_9c524bjm_.dbf
Viewing Backup Reports
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ ------------------- 69 Full 680.13M DISK 00:00:24 12/02/2014 19:16:32 BP Key: 69 Status: AVAILABLE Compressed: NO Tag: TAG20140212T191237 Piece Name: /u01/app/oracle/fast_recovery_area/CDB1/EDDDB886A1191F07E043344EB2C0BE27/backupset/2014_02_12/o1_mf_nnndf_TAG20140212T191237_9hrbq8lm_.bkp List of Datafiles in backup set 69 Container ID: 2, PDB Name: PDB$SEED File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- ------------------- ---- 5 Full 1732663 18/12/2013 22:52:25 /u01/app/oracle/oradata/CDB1/datafile/o1_mf_system_9c5257ms_.dbf 7 Full 1732663 18/12/2013 22:52:25 /u01/app/oracle/oradata/CDB1/datafile/o1_mf_sysaux_9c5257mj_.dbf
Viewing Backup Reports
Group Backups
• Great advantage as you have to set up the following only once per group: – Backup Storage Settings – Recovery Catalog Settings – Backup Type – Frequency
• Administrative Groups – Adding a new target to it, it will automatically use
these properties
Group Backups
Group Backups
Group Backups
FIT-ACER
• F – Focus (SLOW DOWN! Are you ready?) • I – Identify server/DB name, time, authorization • T – Type the command (do not hit enter yet) • A – Assess the command (SPEND TIME HERE!) • C – Check the server / database name again • E – Execute the command • R – Review and document the results
Thank you – Q&A To contact us
1-877-PYTHIAN
To follow us http://www.pythian.com/blog
http://www.facebook.com/pages/The-Pythian-Group/163902527671
@pythian
http://www.linkedin.com/company/pythian
We are hiring! Booth 1535