配置信息存于target database控制文件中,即不同target database可以使用不同配置
To simplify ongoing use of RMAN, you can set several persistent configuration settings for each target database. These settings control many aspects of RMAN behavior. RMAN provides sensible defaults for most parameters required to perform basic backup and recovery. You can modify the value of default parameters or override these values for a particular session.
- Showing and Clearing Persistent RMAN Configurations
RMAN> SHOW ALL;
RMAN> CONFIGURE BACKUP OPTIMIZATION CLEAR;
RMAN> CONFIGURE RETENTION POLICY CLEAR;
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK CLEAR;
RMAN> CONFIGURE RETENTION POLICY TO NONE; --表示永不过期
- CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
可以设置两种策略:基于recovery window或基于redundancy,两者互斥只能选一种
超过保留策略的备份将被标识为OBSOLETE, 使用FAST RECOVERY AREA会在空间不够时自动删除,不使用则需要手动删除DELETE OBSOLETE.
关闭保留策略:CONFIGURE RETENTION POLICY TO NONE;
注如果使用控制文件保存RMAN元数据,参数CONTROL_FILE_RECORD_KEEP_TIME(默认为7天,可设置为0-365)要设置长于备份周期的时间。通过v$controlfile_record_section查看控制文件分配存储数据类型
- REDUNDANCY
超过冗余的备份会视为obsolete
The REDUNDANCY parameter of the CONFIGURE RETENTION POLICY command specifies how many full or level 0 backups of each data file and control file that RMAN keeps. The default retention policy is REDUNDANCY 1.
Assume a different case in which REDUNDANCY is 1. You run a level 0 database backup at noon on Monday, a level 1 cumulative backup at noon on Tuesday and Wednesday, and a level 0 backup at noon on Thursday. Immediately after each daily backup you run the command DELETE OBSOLETE. The Wednesday DELETE command does not remove the Tuesday level 1 backup because this backup is not redundant: the Tuesday level 1 backup could be used to recover the Monday level 0 backup to a time between noon on Tuesday and noon on Wednesday. However, the DELETE command on Thursday removes the previous level 0 and level 1 backups.
示例:CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
- recovery window
指定保证恢复时间点距当前时间间隔,如窗口设置为7天,在9天作了全备,之后一直增量备份,3天前又作了全备,这时9天前的全备也会保留,以保证可以恢复到7天前的状态
The RECOVERY WINDOW parameter of the CONFIGURE command specifies the number of days between the current time and the earliest point of recoverability.
RMAN does not consider any full or level 0 incremental backup as obsolete if it falls within the recovery window. Additionally, RMAN retains all archived logs and level 1 incremental backups that are needed to recover to a random point within the window. Use the CONFIGURE RETENTION POLICY command at the RMAN prompt to configure a recovery window-based retention policy.
示例:CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
- CONFIGURE BACKUP OPTIMIZATION OFF; # default
使用optimization在备份时会跳过已备份文件,跳过的文件需要满足retention policy与backup duplexing设置。如果保留策略设置为冗余2,则要在备份中出现2个此文件的重复备份时才不会再备份
When you enable backup optimization, the BACKUP command skips backing up files when the identical file has been backed up to the specified device type.
RMAN must do further checking to determine whether to skip the file, however, because both the retention policy and the backup duplexing feature are factors in the algorithm that determines whether RMAN has sufficient backups on the specified device type.
Table 5-4 describes criteria that RMAN uses to determine whether a file is identical to a file that it already backed up.
Type of File | Criteria to Determine an Identical File |
Data file | The data file must have the same DBID, checkpoint SCN, creation SCN, and RESETLOGS SCN and time as a data file in a backup. The data file must be offline-normal, read-only, or closed normally. |
Archived log | Same DBID, thread, sequence number, and RESETLOGS SCN and time |
Backup set | Same DBID, backup set record ID, and stamp |
使用optimization前提
RMAN uses backup optimization when the following conditions are true:
- The CONFIGURE BACKUP OPTIMIZATION ON command has been run to enable backup optimization.
- You run BACKUP DATABASE, BACKUP ARCHIVELOG with ALL or LIKE options, or BACKUP BACKUPSET ALL, BACKUP RECOVERY AREA, BACKUP RECOVERY FILES, or BACKUP DATAFILECOPY.
Note: When TO DESTINATION is used with BACKUP RECOVERY AREA or BACKUP RECOVERY FILES, RMAN only skips backups of files that have identical backups in the TO DESTINATION location that you provide.
- Only one type of channel is allocated, do not mix disk and SBT channels in the same backup command.
Note: In backup undo optimization, RMAN excludes undo changes (that are not needed for recovery of a backup) for transactions that have been committed. You can enable and disable backup optimization, but backup undo optimization is built-in behavior.
另外使用BACKUP命令时指定FORCE可强制不使用optimization
BACKUP DATABASE FORCE;
BACKUP ARCHIVELOG ALL FORCE;
- CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
默认设备类型两种: DISK与SBT(System Backup to Tape)
DISK的默认位置为fast recovery area,数据库文件使用的logical blocks必须为DISK块的整数倍
When backing up to disk, the logical block size of the database file must be an even multiple of the physical block size of the destination device. For example, a device of type DISK with a block size of 2 kilobytes can only be used as a destination for backups of database files with logical block sizes of 2 KB, 4 KB, 6 KB, and so on. Most disk drives have physical block sizes of 512 bytes, so this limitation rarely affects backup to disk drives. Nevertheless, you can encounter this limitation when backing up to a writable DVD or a device that has a larger physical block size.
在备份时使用BACKUP的DEVICE TYPE子句来覆盖此设置:
BACKUP DEVICE TYPE sbt DATABASE;
BACKUP DEVICE TYPE DISK DATABASE;
- CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default 生产环境要开
配置是否备份任意数据时自动备份控制文件及SPFILE(它们一起放在单独的备份集中)。如果数据库为归档模式,再出现数据库结构元信息变动时也会自动备份控制文件及SPFILE。
如果关闭只在备份涉及DATAFILE 1备份时才自动备份控制文件及SPFILE。
RMAN automatically backs up the control file and the server parameter file (if the instance was started with a server parameter file) when data file 1 is included in the backup.
If control file autobackup is enabled, then RMAN writes the current control file and server parameter file to a separate autobackup piece. Otherwise, RMAN includes these files in the backup set that contains data file 1.
Note: If the control file block size is different from the block size for data file 1, then the control file cannot be written into the same backup set as the data file. RMAN writes the control file into a backup set by itself if the block size is different. The V$CONTROLFILE.BLOCK_SIZE column indicates the control file block size, whereas the DB_BLOCK_SIZE initialization parameter indicates the block size of data file 1.
数据库结构改变前会自动备份控制文件,不是之后,用于配置之前备份进行恢复
If the database runs in ARCHIVELOG mode, then an autobackup is also taken whenever the database structure metadata in the control file changes. The control file autobackup contains metadata about the previous backup, which is crucial for disaster recovery.
示例:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
- CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
使用FORMAT设置自动备份目录及名称,但一定要有%F,如果不使用默认值在恢复时还要指定
The control file autobackup file name has a default format of %F for all device types, so that RMAN can determine the file location and restore it without a repository.
You can specify a different format with the CONFIGURE CONTROLFILE AUTOBACKUP FORMAT command, but all autobackup formats must include the %F variable.
If you do not use the default format, then during disaster recovery you must specify the format that was used to generate the autobackups. Otherwise, RMAN cannot restore the autobackup.
SET CONTROLFILE AUTOBACKUP会覆盖CONFIGURE CONTROLFILE AUTOBACKUP配置
The order of precedence is:
- SET CONTROLFILE AUTOBACKUP FORMAT (within a RUN block)
- SET CONTROLFILE AUTOBACKUP FORMAT (at RMAN prompt)
- CONFIGURE CONTROLFILE AUTOBACKUP FORMAT
示例:
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'controlfile_%F';
BACKUP AS COPY DATABASE;
The following table lists RMAN substitution variables that are valid in format strings.
Syntax Element | Description |
%a | Specifies the activation ID of the database. |
%b | Specifies the file name stripped of directory paths. It is only valid for SET NEWNAME and backup when producing image copies It yields errors if used as a format specification for a backup that produces backup pieces. |
%c | Specifies the copy number of the backup piece within a set of duplexed backup pieces. If you did not duplex a backup, then this variable is 1 for backup sets and 0 for proxy copies. If a command is enabled, then the variable shows the copy number. The maximum value for %c is 256. |
%d | Specifies the name of the database (see Example 4-23). |
%D | Specifies the current day of the month from the Gregorian calendar in format DD. |
%e | Specifies the archived log sequence number. |
%f | Specifies the absolute file number (see Example 4-23). |
%F | Combines the DBID, day, month, year, and sequence into a unique and repeatable generated name. This variable translates into c-IIIIIIIIII-YYYYMMDD-QQ, where: IIIIIIIIII stands for the DBID. The DBID is printed in decimal so that it can be easily associated with the target database. YYYYMMDD is a time stamp in the Gregorian calendar of the day the backup is generated QQ is the sequence in hexadecimal number that starts with 00 and has a maximum of 'FF' (256) Note: %F is valid only in the CONFIGURE CONTROLFILE AUTOBACKUP FORMAT command. |
%h | Specifies the archived redo log thread number. |
%I | Specifies the DBID. |
%M | Specifies the month in the Gregorian calendar in format MM. |
%N | Specifies the tablespace name. This substitution variable is only valid when backing up data files as image copies. |
%n | Specifies the name of the database, padded on the right with x characters to a total length of eight characters. For example, if prod1 is the database name, then the padded name is prod1xxx. |
%p | Specifies the piece number within the backup set. This value starts at 1 for each backup set and is incremented by 1 as each backup piece is created. Note: If you specify PROXY, then the %p variable must be included in the FORMAT string either explicitly or implicitly within %U. |
%s | Specifies the backup set number. This number is a counter in the control file that is incremented for each backup set. The counter value starts at 1 and is unique for the lifetime of the control file. If you restore a backup control file, then duplicate values can result. Also, CREATE CONTROLFILE initializes the counter back to 1. |
%t | Specifies the backup set time stamp, which is a 4-byte value derived as the number of seconds elapsed since a fixed reference time. You can use a combination of %s and %t to form a unique name for the backup set. |
%T | Specifies the year, month, and day in the Gregorian calendar in this format: YYYYMMDD. |
%u | Specifies an 8-character name constituted by compressed representations of the backup set or image copy number and the time the backup set or image copy was created. |
%U | Specifies a system-generated unique file name (default). The meaning of %U is different for image copies and backup pieces. For a backup piece, %U specifies a convenient shorthand for %u_%p_%c that guarantees uniqueness in generated backup file names. For an image copy of a data file, %U means the following: data-D-%d_id-%I_TS-%N_FNO-%f_%u For an image copy of an archived redo log, %U means the following: arch-D_%d-id-%I_S-%e_T-%h_A-%a_%u For an image copy of a control file, %U means the following: cf-D_%d-id-%I_%u |
%Y | Specifies the year in this format: YYYY. |
%% | Specifies the percent (%) character. For example, %%Y translates to the string %Y. |
- CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
- 配置特定DEVICE TYPE的默认备份格式,注SBT只能使用BACKUP SET
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COPY;
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO BACKUPSET; --此为默认
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET;
CONFIGURE DEVICE TYPE sbt BACKUP TYPE TO COMPRESSED BACKUPSET;
backup命令的as backupset|copy|compressed backupset可覆盖此配置
- 配置并行度
RMAN> CONFIGURE DEVICE TYPE sbt PARALLELISM 2;
如果Configure channel配置了多个channel,数量超过parallelism设置,则以parallelism为准,另外使用ALLOCATE CHANNEL覆盖此默认并行度设置
If you configure specific channels with numbers higher than the parallelism setting, then this setting prevents RMAN from using them.
- CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
配置每个备份片的冗余备份数(隶属于同一备份集),只对backupset有效
controfile的自动备份永远不会冗余备份
Use the CONFIGURE ... BACKUP COPIES command to specify how many copies of each backup piece are created on the specified device type for the specified type of file. This type of backup is known as a duplexed backup set.
The CONFIGURE settings for duplexing only affect backups of data files, control files, and archived logs into backup sets, and do not affect image copies.
Note:A control file autobackup is never duplexed.
RMAN只能配置备份与冗余在同一种设备,不能同时备份到两种设备
RMAN can duplex backups to either disk or tape, but cannot duplex backups to tape and disk simultaneously. When backing up to tape, ensure that the number of copies does not exceed the number of available tape devices.
可以使用BACKUP COPES或是SET BACKUP COPIES命令来覆盖此配置
RMAN> configure DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;
RMAN> Run{set backup copies 2; Backup database; }
RMAN> backup copies 2 datafile 4 format '/u01/myrman/%s_dbf','/u01/myrman1/%s_dbf';
注:应该是只能使用默认channel才会使用此配置,使用了allocate channel命令不会用
配置示例:
CONFIGURE DEVICE TYPE sbt PARALLELISM 1;
CONFIGURE DEFAULT DEVICE TYPE TO sbt;
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/disk1/%U', '/disk2/%U';
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE sbt TO 2;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE sbt TO 2;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;
- CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
归档日志的多路复用,类似数据文件多路复用
- CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 0 M;
此配置为设置CHANNEL属性,属性包括MAXPIECESIZE, FORMAT等
MAXPIECESIZE:设置单个备份片最大大小,超过此大小创建新的备份片,通过ALLOCATE CHANNEL命令中覆盖.
CONFIGURE CHANNEL可以配置一般channel也可配置某个特定channel. 对于一般channel的配置会覆盖之前配置
If you use CONFIGURE CHANNEL to specify generic channel settings for a device, any previous settings are discarded, even if the settings are not in conflict. For example, after the second CONFIGURE CHANNEL command, which specifies only the FORMAT for configured disk channels, the MAXPIECESIZE for the disk channel is returned to its default value:
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 2G;
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT /tmp/%U;
To configure specific channel parameters:
- Run the CONFIGURE CHANNEL n command (where n is a positive integer less than 255) to configure a specific channel.
- When manually numbering channels, you must specify one or more channel options (for example, MAXPIECESIZE or FORMAT) for each channel. When you use that specific numbered channel in a backup, the configured settings for that channel are used instead of the configured generic channel settings.
示例
CONFIGURE DEFAULT DEVICE TYPE TO disk;
CONFIGURE DEVICE TYPE disk PARALLELISM 2;
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/disk1/%U'
CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/disk2/%U'
此时执行backup命令则first channel goes to disk1 and second to disk2
BACKUP DATABASE;
- CONFIGURE MAXSETSIZE TO UNLIMITED; # default
用于设置每个channel创建备份集最大大小,超过会报错,单位支持 Bytes 、KB、MB、GB
The CONFIGURE MAXSETSIZE command limits the size of backup sets created on a channel. This CONFIGURE setting applies to any channel, whether manually allocated or configured, when the BACKUP command is used to create backup sets. The default value is given in bytes and is rounded down to the lowest kilobyte value.
可以通过BACKUP命令的MAXSETSIZE选项覆盖此配置
- CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
- CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
通过V$RMAN_ENCRYPTION_ALGORITHMS查看RMAN可用加密算法,如果未指定算法则使用默认的AES128加密
If no encryption algorithm is specified, then the default encryption algorithm is 128-bit Advanced Encryption Standard (AES). RMAN encryption requires the COMPATIBLE initialization parameter at a target database to be at least 10.2.0.
如果备份到磁带要使用Oracle Secure Backup才能加密
The Oracle Secure Backup media management software is the only supported interface for making encrypted RMAN backups directly to tape. RMAN issues an ORA-19919 error if you attempt to create encrypted RMAN backups using a media manager other than Oracle Secure Backup.
Encrypted backups are decrypted automatically during restore and recovery, if the required decryption keys are available. Each backup set gets a separate key. The key is stored in encrypted form in the backup piece. The backup is decrypted with keys obtained by a user-supplied password or the Oracle software keystore.
RMAN offers the following encryption modes:
- Transparent encryption
This is the default mode and uses the Oracle software keystore. A keystore is a password-protected container used to store a Transparent Data Encryption (TDE) key. In previous releases, this container was referred to as a wallet.
When you use transparent encryption, you must first configure an Oracle software keystore for each database. Transparent backup encryption supports both the auto-login software keystore and password-based software keystore. When you use the auto-login software keystore, encrypted backup operations can be performed at any time, because the auto-login keystore is always open. When you use the password-based software keystore, the keystore must be opened before you can perform backup encryption.
Caution: If you use an auto-login keystore, do not back it up along with your encrypted backup data, because users can read the encrypted backups if they obtain both the backups and the autologin keystore. It is safe to back up the Oracle keystore because that form of the keystore cannot be used without the keystore password.
After the Oracle keystore is configured, encrypted backups can be created and restored with no further DBA intervention. If some columns in the database are encrypted with Transparent Data Encryption (TDE) column encryption, and if those columns are backed up using backup encryption, then those columns are encrypted a second time during the backup. When the backup sets are decrypted during a restore operation, the encrypted columns are returned to their original encrypted form.
Because the Oracle key management infrastructure archives all previous master keys in the Oracle keystore, changing or resetting the current database master key does not affect your ability to restore encrypted backups performed with an older master key. You can reset the database master key at any time. RMAN can restore all encrypted backups that were ever created by this database.
Caution: If you lose your Oracle keystore, then you are unable to restore any transparently encrypted backups.
- Password encryption
Password encryption requires that the DBA provide a password when creating and restoring encrypted backups. Restoring a password-encrypted backup requires the same password that was used to create the backup.
Password encryption is useful for backups that are restored at remote locations, but which must remain secure in transit. Password encryption cannot be persistently configured. You do not need to configure an Oracle keystore if password encryption is used exclusively.
If RMAN restores a set of backups created with different passwords, then all required passwords must be included with SET DECRYPTION .
Caution: If you forget or lose the password that you used to encrypt a password-encrypted backup, then you are unable to restore the backup.
To use password encryption, use the SET ENCRYPTION ON IDENTIFIED BY password ONLY command in your RMAN scripts.
- Dual mode encryption
Dual-mode encrypted backups can be restored either transparently or by specifying a password. When restoring a dual-mode encrypted backup, you can use either the Oracle keystore or a password for decryption.
If password encryption is detected, then RMAN searches for a matching key in the list of passwords entered in the SET DECRYPTION command. If RMAN finds a usable key, then the restore operation proceeds. Otherwise, RMAN searches for a key in the Oracle keystore. If RMAN finds a usable key, then the restore operation proceeds; otherwise, RMAN signals an error that the backup piece cannot be decrypted.
Caution: If you forget or lose the password that you used to encrypt a dual-mode encrypted backup and you also lose your Oracle keystore, then you are unable to restore the backup.
To create dual-mode encrypted backup sets, specify the SET ENCRYPTION ON IDENTIFIED BY password command in your RMAN scripts.
CONFIGURE ENCRYPTION 配置会被SET ENCRYPTION命令覆盖,另外后者可以配置基于密码加密码,不能配置RMAN SESSIONS共用相同加密密码
You can use the CONFIGURE command to persistently configure transparent encryption of backups.
You can also use the SET ENCRYPTION command to perform the following actions:
- Override the encryption settings specified by the CONFIGURE ENCRYPTION command. For example, you can use SET ENCRYPTION OFF to create an unencrypted backup, even though a database is configured for encrypted backups.
- Set a password for backup encryption, persisting until the RMAN client exits. Because of the sensitive nature of passwords, RMAN does not permit configuration of passwords that persist across RMAN sessions.
在满足以下情况将对归档进行加密备份
Using or not using persistent configuration settings controls whether archived redo log backups are encrypted. Backup sets containing archived redo log files are encrypted if any of the following are true:
- SET ENCRYPTION ON is in effect when the archive log backup is being created.
- Encryption is configured for backups of the whole database or at least one tablespace.
This behavior ensures that the redo associated with any encrypted backup of a data file is also encrypted.
加密需要消耗CPU资源可以使用READRATE或减少channel数来减少CPU使用
You may want to consider slowing the rate of the backup by setting the RMAN READRATE parameter. For example, you can set an upper limit for block reads so that RMAN does not consume excessive disk bandwidth and thereby degrade online performance.
示例:
CONFIGURE ENCRYPTION FOR DATABASE ON; --数据库级
configure encryption for tablespace users on; --表空间级
SET ENCRYPTION OFF;
CONFIGURE ENCRYPTION ALGORITHM TO 'AES256';
SET ENCRYPTION ON IDENTIFIED BY encbak ONLY;
ONLY表示只使用密码,没有ONLY可为Dual mode
RMAN> SET ENCRYPTION ON IDENTIFIED BY "PASSWORD" ONLY;
RMAN> backup as compressed backupset database;
此时恢复时需要制定恢复密码才可以继续进行。
RMAN> SET DECRYPTION IDENTIFIED BY "PASSWORD";
- CONFIGURE COMPRESSION ALGORITHM 'BASIC'; # default
RMAN默认就不备份HWM以上块,这里压缩指UNUSED BLOCKS,对于经常插入删除记录的数据文件可使用预压缩,反之预压缩无效果. 压缩只能用于BACKUPSET
Better backup compression ratios are achieved by consolidating the free space in each data block, and setting that free space to binary zeroes. This precompression processing stage has the most benefit for data blocks that have been the subject of many deletes and inserts operations. Conversely, it has no effect on data blocks that are still in their initial loaded state.
OPTIMIZE FOR LOAD选项会控制预压缩进程
The OPTIMIZE FOR LOAD option controls precompression processing.
By specifying the default, OPTIMIZE FOR LOAD TRUE, you ensure that RMAN optimizes CPU usage and avoids precompression block processing. By specifying OPTIMIZE FOR LOAD FALSE, RMAN uses additional CPU resources to perform precompression block processing.
RMAN支持两类的压缩算法:默认压缩算法及使用了Oracle Advanced Compression option的压缩算法(要单独购买)
CONFIGURE COMPRESSION ALGORITHM 'BASIC';
you can choose from the compression levels listed in the following table.
Compression Level | Performance Benefits and Trade-Offs |
HIGH | Best suited for backups over slower networks where the limiting factor is network speed. |
MEDIUM | Recommended for most environments. Good combination of compression ratios and speed. |
LOW | Least effect on backup throughput. |
Because the performance of the various compression levels depends on the nature of the data in the database, network configuration, system resources and the type of computer system and its capabilities, Oracle cannot document universally applicable performance statistics. Which level is best for your environment depends on how balanced your system is regarding bandwidth into the CPU and the actual speed of the CPU. It is highly recommended that you run tests with the different compression levels on the data in your environment. Choosing a compression level based on your environment, network traffic characteristics (workload), and data set is the only way to ensure that the backup set compression level can satisfy your organization's performance requirements and applicable service level agreements.
Note: Restoring a compressed backup is performed inline, and does not require decompression.
- CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
设置归档日志删除策略,设置后BACKUP ... DELETE INPUT or DELETE ARCHIVELOG commands只删除满足此策略的归档日志,另外如果归档存于fast recovery area,在空间不够时会自动删除过时归档,但存于其它位置要手动删除
You can use the CONFIGURE ARCHIVELOG DELETION POLICY command to specify when archived redo logs are eligible for deletion.
Archived redo logs can be deleted automatically by the database or by user-initiated RMAN commands. Only logs in the fast recovery area can be deleted automatically by the database.
For archived redo log files in the fast recovery area, the database retains them as long as possible and automatically deletes eligible logs when additional disk space is required.
默认设置为NONE,此时只有已备份的归档或不被retention policy期间使用的归档视为obsolete,只有flashback database及guaranteed restore point不会被使用的归档日志才能视为obsolete.
By default, there is no archived redo log deletion policy. In this particular case, the fast recovery area considers archived redo log files in the recovery area as eligible for deletion if they have been backed up at least once to disk or SBT or the logs are obsolete according to the backup retention policy. The backup retention policy considers logs obsolete only if the logs are not needed by a guaranteed restore point and the logs are not needed by Oracle Flashback Database.
Archived redo logs are needed by Flashback Database if the logs were created later than SYSDATE-'DB_FLASHBACK_RETENTION_TARGET'.
用CONFIGURE ARCHIVELOG DELETION POLICY BACKED UP integer TIMES TO DEVICE TYPE command 来设置在某设备中备份指定次数的归档日志视为obsolete. 对于满足设置的归档日志backup archivelog会忽略不再备份,使用FORCE可以强制备份。
You can use the CONFIGURE ARCHIVELOG DELETION POLICY BACKED UP integer TIMES TO DEVICE TYPE command to enable an archived log deletion policy.
This configuration specifies that archived logs are eligible for deletion only when the specified number of archived log backups exist on the specified device type.
If the deletion policy is configured with the BACKED UP integer TIMES clause, then a BACKUP ARCHIVELOG command copies the logs unless integer backups exist on the specified device type. If integer backups of the logs exist, then the BACKUP ARCHIVELOG command skips the logs. In this way, the archived log deletion policy functions as a default NOT BACKED UP integer TIMES clause on the BACKUP ARCHIVELOG command. You can override the deletion policy by specifying the FORCE option on the BACKUP command.
示例:
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;
CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 2 TIMES TO SBT;
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
RMAN can delete logs after they have been applied at all mandatory remote destinations.
CONFIGURE ARCHIVELOG DELETION POLICY TO SHIPPED TO ALL STANDBY
RMAN can delete logs when they have been transferred to all mandatory standby destinations.
- CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/oracle/dbs/snapcf_timran11g.f'; # default
在重同步recovery catalog及备份当前控制文件时会创建临时控制文件快照
When RMAN needs a read-consistent version of the control file, it creates a temporary snapshot control file. RMAN needs a snapshot control file when resynchronizing with the recovery catalog or when making a backup of the current control file.
In an Oracle Real Application Clusters (Oracle RAC) environment, the snapshot control file location must be on shared storage—that is, storage that is accessible to all Oracle RAC instances.
控制文件的IO很频繁,RMAN需要控制文件信息在备份操作期间保持一致,即RMAN需要读取一致的控制文件,如果锁定控制文件意味着数据库不能执行检查点操作和切换日志等,这是不可能的,因此RMAN使用snapshot controlfile解决这个问题,它只是控制文件的一个副本
- CONFIGURE EXCLUDE FOR TABLESPACE ....;
用于配置BACKUP命令默认忽略备份的表空间,如:
CONFIGURE EXCLUDE FOR TABLESPACE cwmlite;
CONFIGURE EXCLUDE FOR TABLESPACE example;
此时如果使用BACKUP DATABASE则不会备份以上两个表空间,如果使用BACKUP TALBESPACE cwmlite还是会备份的。在BACKUP命令也可使用NOEXCLUDE选项覆盖此配置,如:
BACKUP DATABASE NOEXCLUDE;
清除某个表空间配置
CONFIGURE EXCLUDE FOR TABLESPACE cwmlite CLEAR;
用于设置DUPICATE命令或TSPITR时SET NEWNAME的默认配置
If you are performing TSPITR or running the DUPLICATE command, then by using CONFIGURE AUXNAME you can preconfigure the file names for use on the auxiliary database without manually specifying the auxiliary file names during the procedure.
When renaming files with the DUPLICATE command, CONFIGURE AUXNAME is an alternative to SET NEWNAME command. The difference is that after you set the AUXNAME the first time, you do not need to reset the file name when you issue another DUPLICATE command; the AUXNAME setting remains in effect until you issue CONFIGURE AUXNAME ... CLEAR. In contrast, you must reissue the SET NEWNAME command every time you rename files.
The command is as follows, where datafileSpec identifies some data file by its original name or data file number, and filename is the new path for the specified file:
CONFIGURE AUXNAME FOR datafileSpec TO 'filename';
示例:
CONFIGURE AUXNAME FOR DATAFILE 2 TO '/newdisk/datafiles/df2.df';
CONFIGURE AUXNAME FOR DATAFILE 2 CLEAR;