Oracle 12c New Features_RMAN_slides
-
Upload
ahmad-saiful-muhajir -
Category
Documents
-
view
57 -
download
12
Transcript of Oracle 12c New Features_RMAN_slides
Oracle 12c New FeaturesRecovery Manager
@saifulmuhajir
Pluggable Database Support
• RMAN supports Pluggable Databases
• Back up entire Container Database or individual Pluggable Databases
• PDB point in time recovery: recover PDB individually
RMAN> alter pluggable database PLUG1 close;
RMAN> RUN {
SET UNTIL SCN 1674493;
RESTORE PLUGGABLE DATABASE PLUG1;
RECOVER PLUGGABLE DATABASE PLUG1;
}
RMAN> alter pluggable database PLUG1 open resetlogs;
Using SQL in RMAN
• No SQL prefix or quotes required
• Provides SQL*Plus DESCRIBE functionality
• Earlier releases:
RMAN> sql 'ALTER TABLESPACE users ADD DATAFILE “/testdata/users02.dbf” SIZE 10M';
• With Oracle Database 12c:
RMAN> ALTER TABLESPACE users ADD DATAFILE '/testdata/users02.dbf' SIZE 10M;
RMAN> SELECT NAME, DBID, LOG_MODE FROM V$DATABASE;
RMAN> DESC table1
Name Null? Type
--------- -------- -------------------
TEST_NAME VARCHAR2(128)
Separation of DBA Duties
Introducing task-specific and least-privileged administrative privilege
SYSBACKUP
• Includes permissions for backup and recovery (connecting to a closed
database)
• Does not include data access privileges such as SELECT ANY TABLE
• Is granted to the SYSBACKUP user that is created during database installation
• Can be explicitly used in RMAN connection by a SYSBACKUP privileged user
$ rman TARGET “john@orcl AS SYSBACKUP”
connected to target database: ORCL (DBID=1297344416)
Backing Up and Restoring Very Large Files
Multisection backups of a single data file:
• Created by RMAN, with your specified size value
• For backup sets and image copies
• For full and incremental backups
Benefits:
• Reduce image copy creation time
• Are processed independently (serially or in parallel)
• Benefit Exadata
Requirements and restrictions:
• COMPATIBLE=12.0
• Not for control files or spfiles
• Not for a large value of parallelism
RMAN> BACKUP AS COPY SECTION SIZE 1024M DATABASE;RMAN> BACKUP INCREMENTAL LEVEL 1 SECTION SIZE 1G DATABASE;
Active Duplicate Enhancements
Default use of backup sets for active duplication
• Original «push» process based on image copies becomes «pull» process based on
backup sets
• Automatic «pull» process when a clause is used:
- Compression
- Section size
- Encryption
RMAN> SET ENCRYPTION …;
RMAN> DUPLICATE TARGET DATABASE TO orcl2 FROM ACTIVE DATABASE
[USING BACKUPSET] [SECTION SIZE …] [USING COMPRESSED BACKUPSET] …;
Data is encrypted on the source database,
before transmission.
The NOOPEN Option
• Option to end database duplication with database in mounted
• Potential NOOPEN use cases:
- Avoid any startup problems: opening the database conflict with other source database
- Adjust the initialization parameters: BCT, flashback
- Moving the location of the database (for example, to ASM)
- Upgrading a database (where the database must not be open with resetlogs, prior to running upgrade scripts)
RMAN> DUPLICATE TARGET DATABASE TO ORCL12 FROM ACTIVE DATABASE NOOPEN;
Duplicating Pluggable Databases
• A single pluggable database:
RMAN> DUPLICATE DATABASE TO cdb1 PLUGGABLE DATABASE pdb1;
• Several pluggable databases:
RMAN> DUPLICATE DATABASE TO cdb1 PLUGGABLE DATABASE pdb1, pdb3;
• All pluggable databases except one:
RMAN> DUPLICATE DATABASE TO cdb1 SKIP PLUGGABLE DATABASE pdb3;
• A PDB and tablespaces of other PDBs:
RMAN> DUPLICATE DATABASE TO cdb1 PLUGGABLE DATABASE pdb1
TABLESPACE pdb2:users;
Storage Snapshot Optimization
• Take a storage snapshot using third-party technologies
• BACKUP mode is not necessary
• Point-in-Time of the snapshot can be used for recovery
• Requirements:
- The snapshot preserves the write order for each file
- The database is crash consistent during the snapshot
- The snapshot technology stores the time at which the snapshot is completed
• Structural changes during the snapshot will make the snapshots unusable
Recovering Databases with Third-Party Snapshots
• Recover a database using the most recent snapshot:RMAN> RECOVER DATABASE;
• Recover a database using a particular snapshot:RMAN> RECOVER DATABASE UNTIL TIME ‘02/15/2012 11:00:00’ SNAPSHOT TIME ‘02/15/2012 10:00:00’;
• Perform a partial recovery using archived redo log files:RMAN> RECOVER DATABASE UNTIL CANCEL SNAPSHOT TIME ‘02/15/2012 10:00:00’;
Table Recovery
• Table recovery from RMAN backups
- Not affecting the remaining database objects
- Reduces time and disk space
• Useful when you can’t use flashback
• Recover tables or table partitions
• Must connect “as sysdba” or “as sysbackup”
RMAN> RECOVER TABLE NCBSHOST.CS_TABLE UNTIL SCN 1674493 AUXILIARY DESTINATION '/tmp/oracle/recover’ DATAPUMP DESTINATION '/tmp/recover/dumpfiles’ REMAP TABLE ‘NCBSHOST'.‘CS_TABLE':‘CS_RECOVERED’;
Supported options: UNTIL TIME,
UNTIL SCN, UNTIL SEQUENCE
RMAN Recover Table: Tips
• Target database must be in READ WRITE mode
• Determine if there are dependent tables that need to be included in the recovery, based on foreign key constraints
• Ensure sufficient disk space on database server for auxiliary instance: SUM [SYSTEM, SYSAUX, UNDO, SYSEXT (if present), User Tablespace(s) that contain table(s)]
• At least one full backup has been taken of the above tablespaces, along with backup of all archived logs
• For recovering tables within a PDB, connect to CDB as ROOT user
• If source table does not exist anymore (e.g. dropped), then table and all associated indexes, constraints, triggers will also be recovered
• If source table exists, then table must be recovered with a new name (REMAP TABLE) or to a new tablespace (REMAP TABLESPACE).
RMAN Recover Table - Process
• Create a temporary auxiliary database on local database server
• Restore and recover the table or table partition
• Export the table/partition that is being recovered using the data pumps
• Optionally import and rename the table/partition in the source database
• Destroys the auxiliary database upon completion
Restore/Recover over Network
• Flexibility to restore full database, specific datafile, controlfile, spfile etc
• Using RESTORE… FROM SERVICE and RECOVER… FROM SERVICE
• Useful to fill-in the huge gap between primary and standby databases
• restore/recover a data file from standby to primary
RMAN> CONNECT TARGET “backupuser@primary_tns AS SYSBACKUP”;RMAN> RESTORE DATAFILE 9 FROM SERVICE standby_tns section size 5120M;
• Roll-forward to in-sync standby with primary
RMAN> CONNECT TARGET “backupuser@standby_tns AS SYSBACKUP”;RMAN> RECOVER DATABASE FROM SERVICE primary_tns USING COMPRESSED BACKUP;
Transporting Data Across Platforms
• Transporting databases, data files, and tablespaces
• Using image copies and backup sets
• Allows inconsistent tablespace backups
Benefits:
• Reduced down time for platform migrations
• Choice of compression and multisection
• Not catalogued in control file, not used for regular restore operations
Notes
• COMPATIBLE=12.0 (or greater)
• Read-only mode for creation of cross-platform database backup
• Database in read-write mode for creation of cross-platform tablespacebackup
• FOR TRANSPORT: backup can be transported to any destination
• TO PLATFORM: conversion performs on the source database
• DATAPUMP clause required for tablespace for last incremental backup
• RESTORE FOREIGN: restore the cross-platform data backup set
Transporting Database
• Database mode: READ_ONLY
• Back up the source database including control files
• RMAN> BACKUP FOR TRANSPORT FORMAT '/bkp_dir/transp.bck‘ DATABASE;
• RMAN> RESTORE FROM PLATFORM ‘AIX-Based Systems (64-bit)’ FOREIGN DATABASE TO NEW FROM BACKUPSET '/bkp_dir/transp.bck';
Transporting Tablespace (AIX to Linux)
On destination Linux host:
- Create ‘shell’ database (SYSTEM, SYSAUX, UNDO)
On source AIX database:
- ALTER TABLESPACE PROJECTS, TASKS READ ONLY;
- EXECUTE DBMS_TTS.TRANSPORT_SET_CHECK(PROJECTS, TASKS, TRUE)
- SELECT * FROM TRANSPORT_SET_VIOLATIONS;
- Check that user tablespaces are self-contained
- BACKUP FOR TRANSPORT FORMAT ‘/tmp/xplat_backups/trans_ts.bck’ DATAPUMP FORMAT ‘/tmp/xplat_backups/trans_ts_dmp.bck’ TABLESPACE PROJECTS, TASKS;
- Copy all backups to destination server
(cont’d)
On destination Linux database:
- Create tablespace users as they exist on source database
- RESTORE FROM PLATFORM ‘AIX-Based Systems (64-bit)’ FOREIGN TABLESPACE PROJECTS, TASKS TO NEW FROM BACKUPSET ‘/tmp/xplat_restores/trans_ts.bck’ DUMP FILE FROM BACKUPSET ‘/tmp/xplat_restores/trans_ts_dmp.bck’;
- Data file blocks automatically endian-converted during restore
- Data Pump metadata dump file automatically imported to plug in user tablespaces
- SQL> ALTER TABLESPACE PROJECTS, TASKS READ WRITE;
Demo
Recover Table Using RMAN Backupset
Oracle Database 12c