以下RMAN新特性主要来自12c备份手册
Cross-platform backup and restore enhancements
这为跨平台迁移数据库、传输表空间提供了更多便利
RMAN enables you to transport data across platforms by using full and incremental backup sets. Incremental backups can be used to reduce application downtime required when transporting tablespaces across platforms.
cross-Platform Backup of the Entire Database
This example creates a cross-platform backup of the entire database for transport to the Linux x86 64-bit platform. The source platform is Microsoft Windows IA (32-bit) and the backup is stored in a backup set named full_db.bck. The database must be placed in read-only mode before the backup is created.
BACKUP
TO PLATFORM='Linux x86 64-bit'
FORMAT '/tmp/xplat_backups/full_db.bck'
DATABASE;
Cross-Platform Backup of a Consistent Tablespace
This example backs up the tablespace example for cross-platform transport. The tablespace must be placed in read-only mode before the backup is performed. The backup set containing the tablespace data is called example_readonly.bck. The metadata required to plug this tablespace into the target database is stored in the backup set example_dmp.bck.
BACKUP
FOR TRANSPORT
FORMAT '/tmp/xplat_backups/example_readonly.bck'
TABLESPACE example
DATAPUMP FORMAT '/tmp/xplat_backups/example_dmp.bck';
Recovering tables and table partitions
11g有了基于表空间时间点的恢复,12c又新增了基于表,分区表等的恢复,更方便实用
RMAN can recover tables and table partitions to a specified point in time from previously-created RMAN backups.
Perform point-in-time recovery of a database (DBPITR), pluggable database (PDB), tablespace (TSPITR), table, or table partition
Recovering Tables to a Specified Log Sequence and Renaming the Tables
This example uses an auxiliary instance to recover the table EMP from the SCOTT schema to the time when the log sequence number of the database was 5466. After the EMP table is recovered, it is imported into the target database using the name MY_EMP.
RECOVER TABLE SCOTT.EMP
UNTIL SEQUENCE 5466
AUXILARY DESTINATION '/tmp/recover'
REMAP TABLE 'SCOTT'.'EMP':'MY_EMP';
Recovering Tables Partitions from a Backup
This example recovers the partitions sales_2009 and sales_2010 from the table SALES to the time when the SCN of the target database was 34582. In the source database, the tables are owned by the schema SH. While importing these partitions into the target database, the partitions are created as tables named historic_sales_2009 and historic_sales_2010.RECOVER TABLE SH.SALES:SALES_2009, SH.SALES:SALES_2010
UNTIL SCN 34582
AUXILIARY DESTINATION '/tmp/oracle/recover'
REMAP TABLE 'SH'.'SALES':'SALES_2009':'HISTORIC_SALES_2009', 'SH'.'SALES':'SALES_2010':'HISTORIC_SALES_2010';
Recovering Tables to a Specified Time and Into a Different Tablespace
This example recovers tables EMP and DEPT to the point in time specified by the UNTIL TIME clause. The tables were originally part of the EXAMPLE tablespace. However, after the recovery operation, they are mapped to the tablespace MY_TBS in the target database.
RECOVER TABLE SCOTT.EMP, SCOTT.DEPT
UNTIL TIME "TO_CHAR('12/23/2012 12:00:00','mm/dd/yyyy hh24:mi:ss')"
AUXILIARY DESTINATION '/tmp/oracle/recover'
REMAP TABLESPACE 'EXAMPLE':'MY_TBS';
Recovering and restoring files over a network
可以通过网络去还原、恢复数据文件、表空间等
RMAN enables you to recover a database, data files, tablespaces, or control files by using backup sets from a physical standby database. RMAN transfers the backup sets over the network to the destination host. This is useful in a Data Guard environment when you want to synchronize the standby and primary databases.
This example restores the data file users.dbf that was lost on the primary database by restoring it, over the network, from the standby database:
RESTORE DATAFILE '/oradata/files/users.dbf'
FROM SERVICE standby_tns
SECTION SIZE 200M
USING COMPRESSED BACKUPSET;
The service name of the remote database that contains the data file to be restored is standby_tns. The SECTION SIZE clause indicates that the data file is restored using multisection backup sets. The USING COMPRESSED BACKUPSET clause specifies that the backup sets are compressed using the default compression algorithm that is configured for RMAN.
Improved support for third-party snapshot technologies using Storage Snapshot Optimization
为第三方备份、还原提供更多便利
Storage Snapshot Optimization enables you to use storage snapshot technology to backup and recover Oracle databases without placing them in BACKUP mode. The snapshot technology must adhere to certain qualifications.In order to backup your Oracle database using storage snapshot optimization, the third-party snapshot technologies must meet the following 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.
If third-party snapshot technology vendor cannot guarantee compliance with above requirements then you must keep the database in BACKUP mode to take the snapshot.
Follow these steps to keep the database in BACKUP mode and take snapshot
To recover a database using a particular snapshot:
- SQL> ALTER DATABASE BEGIN BACKUP
- Take Snapshot using third-part technologies
- SQL> ALTER DATABASE END BACKUP
This example recovers uses a snapshot taken on August 15 at 2:00 P.M. to recover the database. The UNTIL TIME clause can specify any time after the snapshot.
RECOVER DATABASE UNTIL TIME '10/15/2012 15:00:00' SNAPSHOT TIME '10/15/2012 14:00:00';
To perform a partial recovery using archived redo log files:
This example uses the log files from a snapshot taken on August 15 at 2:00 P.M.
RECOVER DATABASE UNTIL CANCEL SNAPSHOT TIME '10/15/2012 14:00:00';
Incremental and multisection backup improvements
11g只支持备份集,12c支持增量备份和镜像复制
The multisection technology provided by RMAN, which allows very large files to be backed up and restored by multiple channels in parallel, can now be applied to both incremental backups and image copies.
Multisection Backup of Data Files as Image Copies
This example creates a multisection backup of the data file users_df.dbf. The backup is created as image copies and each backup piece cannot exceed 150MB.
BACKUP AS COPY
SECTION SIZE 150M
DATAFILE '/oradata/dbs/users_df.dbf';
Multisection Incremental Backup of Database as Backup Sets
This example creates a multisection incremental backup of the database as backup sets. The incremental backup includes all data file blocks that changed at SCN greater than or equal to 8564. The FORMAT clause is mandatory when you use INCREMENTAL FROM SCN to create a multisection incremental backup.
BACKUP
FORMAT '/tmp/datafiles/db_incr_ms_%U'
INCREMENTAL FROM SCN 8564
SECTION SIZE 400M
DATABASE;
SYSBACKUP Privilege
The SYSBACKUP administrative privilege encompasses the permissions required for backup and recovery, including the ability to connect to a closed database. System administrators can grant SYSBACKUP instead of SYSDBA to users who perform backup and recovery, thus reducing the proliferation of the SYSDBA privilege. In contrast to SYSDBA, SYSBACKUP does not include data access privileges such as SELECT ANY TABLE.
Connecting to a Target Database Without a Recovery Catalog
This example starts RMAN in NOCATALOG mode and then connects to the target database with an Oracle Net service name prod1. sbu is a user who is granted the SYSBACKUP privilege.
% rman NOCATALOG
RMAN> CONNECT TARGET "sbu@prod1 AS SYSBACKUP";
target database Password: password
connected to target database: PROD1 (DBID=39525561)
Connecting to a PDB as a Local User
This example connects to the PDB hr_pdb as the local user sbu_pdb who is granted the SYSBACKUP privilege on the hr_pdb PDB. hrpdb is the net service name corresponding to the PDB hr_pdb.
%rman
RMAN> CONNECT TARGET "sbu_pdb@hrpdb AS SYSBACKUP";
Active database duplication enhancements
active duplicate支持备份集、和压缩
RMAN can now use backup sets to perform active database duplication. When sufficient auxiliary channels are allocated, the auxiliary instance connects to the target instance and retrieves the backup sets over the network, thus reducing the processing load on the target instance. Unused block compression can be used during the duplication process, thus reducing the size of backups transported over the network. You can also encrypt backups and use multisection backups while performing active database duplication
USING BACKUPSET
Performs active database duplication by copying all or a subset of data from the source database to the destination database using backup sets.
USING COMPRESSED BACKUPSET
Enables binary compression of the data transfer from the source database to the auxiliary database, thereby reducing the network bandwidth consumption.
SQL Interface Improvements
RMAN支持更多的SQL语句
[oracle@db1 ~]$ rman target /
Recovery Manager: Release 12.1.0.2.0 - Production on Mon Mar 21 21:21:00 2016
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
connected to target database: CDB1 (DBID=879831934)
RMAN> select name from v$database;
using target database control file instead of recovery catalog
NAME
---------
CDB1
RMAN> select * from dual;
D
-
X
RMAN>
RMAN> desc v$controlfile
Name Null? Type
----------------------------------------- -------- ----------------------------
STATUS VARCHAR2(7)
NAME VARCHAR2(513)
IS_RECOVERY_DEST_FILE VARCHAR2(3)
BLOCK_SIZE NUMBER
FILE_SIZE_BLKS NUMBER
CON_ID NUMBER
RMAN> ALTER TABLESPACE users ADD DATAFILE '/disk1/oradata/users02.dbf' SIZE 1M AUTOEXTEND ON NEXT 10K MAXSIZE 2M;
Statement processed
DUPLICATE enhancements
duplicate支持在不打开数据库情况下克隆数据库
You can use the NOOPEN clause to specify that the duplicate database must not be opened using RESETLOGS after it is created. You may prefer not to open the duplicate database if you want to change the initialization parameters of the duplicate database or if opening the duplicate database may start services in the duplicate database that will conflict with the original database.
When you duplicate a database using RMAN DUPLICATE, the database is created and opened with RESETLOGS mode. With Oracle database 12c, you can specify that the database must not be opened with “NOOPEN” clause.
This NOOPEN clause useful under following situations:
If you need to make changes to initialization parameters such as block change tracking, flashback database settings
Opening the database conflict with other source database
If you plan to create database for upgrade and want to open in upgrade mode
The command below creates duplicate database, but it will not open.
RMAN> DUPLICATE TARGET DATABASE TO SBDB FROM ACTIVE DATABASE NOOPEN;
Reference
Database Backup and Recovery Reference