All technological notes.
Complete Recovery: Using Image CopySWITCH commandSWITCH command:
updates the names of the files in the RMAN repository, but the database does not rename the files at the operating system level.
database, tablespace, or data file to the latest image copies available for the specified filesdata files and temp files for which you have issued a SET NEWNAME commandPrerequisites:
tablespaces, data files, or temp files, the files must be offline.database, the database must not be open.Steps
data file offline.SWITCH TO ... COPY command to point to the image copy of the files.SWITCH DATAFILE 'filename' TO COPY;
Steps to put the data files back into their original location: 注意, 该步骤不同于上一节
BACKUP AS COPY command to create an image copy of the data files in the original location.data files offline.SWITCH TO COPY command to switch to the copy you made in step 1与上一节区别仅仅在于, 为保证转换后的文件还在原有路径, 将映像备份的保存在原有路径中. 则恢复时仅需将不工作的数据文件转换到原有路径的映像备份即可.
SET NEWNAMEIf you cannot restore data files to their default locations, then you must update the control file to reflect the new locations of the data files. 当无法使用默认路径恢复数据文件时, 必须更新 cf
SET NEWNAME command:
ALTER DATABASE RENAME FILE, to update the names of the data files in the control file.SWITCH DATAFILE ALL command to update the control file to reflect the new names for all data files.RUN blockExample:
RUN
{
ALLOCATE CHANNEL devl DEVICE TYPE DISK;
ALLOCATE CHANNEL dev2 DEVICE TYPE sbt;
SQL "ALRER TABLESPACE users OFFLINE IMMEDIATE";
SET NEWNAME FOR DATAFILE '/diskl/oradata/prod/users01l.dbf"'
TO '/disk2/users0l.dbf';
RESTORE TABLESPACE users;
SWITCH DATAFILE ALL;
RECOVER TABLESPACE users;
SQL "ALTER TABLESPACE users ONLINE";
}
Instead of individual names, a more efficient way is to use the SET NEWNAME clause to specify the default name format for all data files in a named tablespace and all data files in the database.
DUPLICATE, RESTORE, and SWITCH commands in the RUN block.该默认名将被用于同一个代码中Incremental backups to data file Image copies
To recover Image Copies + incremental backups:
Image copies are updated with all changes up to the incremental backup SCN.image copy after the incremental restoration.Applying incremental backups to data file image copies:
image copy to the specified point in time
image copy with all changes up through the SCN at which the incremental backup was taken.full image copy taken at that SCN, without the overhead of performing a full image copy of the database every day.Benefits:
media recovery (using archive logs)减少恢复时间
archive logs only since the last incremental backup.full image copy after the incremental restoration.无需全备份Characteristics:
If the recovery process fails during the application of the incremental backup file, you simply restart the recovery process. 如果恢复操作出错, 仅需重启
incremental backup files to apply, from before the image data file copy until the time at which you want to stop the recovery process. 自动适用自增备份If there is more than one version of an image copy recorded in the RMAN catalog 如果有多个备份
RMAN reports an error if it cannot merge an incremental backup file with an image copy.
Example: continuously updated image copies(略, 查看 strategy)